{"id":810653,"url":"http://patchwork.ozlabs.org/api/patches/810653/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170906144940.30880-9-richard.henderson@linaro.org/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170906144940.30880-9-richard.henderson@linaro.org>","list_archive_url":null,"date":"2017-09-06T14:49:34","name":"[PULL,08/14] tcg/s390: Merge cmpi facilities check to tcg_target_op_def","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"037291e7179e0c15cfca05eba2be1e95e1c6004e","submitter":{"id":72104,"url":"http://patchwork.ozlabs.org/api/people/72104/?format=json","name":"Richard Henderson","email":"richard.henderson@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170906144940.30880-9-richard.henderson@linaro.org/mbox/","series":[{"id":1829,"url":"http://patchwork.ozlabs.org/api/series/1829/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1829","date":"2017-09-06T14:49:28","name":"[PULL,01/14] tcg: Remove support for ia64 as host","version":1,"mbox":"http://patchwork.ozlabs.org/series/1829/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810653/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810653/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"B58WItzz\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xnRR84dbgz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 00:53:24 +1000 (AEST)","from localhost ([::1]:36536 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpbhi-0007nY-OJ\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 10:53:22 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:39975)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <richard.henderson@linaro.org>) id 1dpbeO-0005T6-4r\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 10:49:57 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <richard.henderson@linaro.org>) id 1dpbeM-0000IV-TK\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 10:49:56 -0400","from mail-pg0-x232.google.com ([2607:f8b0:400e:c05::232]:32782)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <richard.henderson@linaro.org>)\n\tid 1dpbeM-0000ID-Kw\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 10:49:54 -0400","by mail-pg0-x232.google.com with SMTP id t3so15708435pgt.0\n\tfor <qemu-devel@nongnu.org>; Wed, 06 Sep 2017 07:49:54 -0700 (PDT)","from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net.\n\t[97.126.108.236]) by smtp.gmail.com with ESMTPSA id\n\th1sm3467646pfg.153.2017.09.06.07.49.52\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 06 Sep 2017 07:49:52 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=2xI+Bv3Slue+8/Kr/D6CnEnYyj7+r0K2GR4PNLIeK1w=;\n\tb=B58WItzzpHolVSZDYnLf7nL9QAgdUNmPqjqUa7FRej+r/+noFFF9V6DQ0BRsDyQQ1z\n\tXoUdbKVS2fhehsJ5ZG0ikMn2plv2hhBwttnJgjwgXFSFEFyojSMDYnEDyPofqFCn0IYD\n\tEtzulzH0K7LyofX+FJtCKXeikjQ26u3xm4CEI=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=2xI+Bv3Slue+8/Kr/D6CnEnYyj7+r0K2GR4PNLIeK1w=;\n\tb=Eg2PhROjz//cuJ684iG4/187Sk1lVQjRgLbB12apeIgZ+8qmEDRJb+PBMOQ9KBwFBK\n\tHMwpdR62bIYuXGU/rWK8FnENHLsZbwpxi7GYp868QaHlFQ7Pgt7xBHq9r03afxRXoSqt\n\ti4ko7CGiW8ZbXUiYUNKQ7uym6sOf+McQRA9HoRnya18PQnoecn3bQZ67z9M84Ad64Wwd\n\tpZTG4s7UVu2UGjUKOv2ab/s0KzX6j0oWGUj3Uz7Q2a2hSuMssicpDx0FrAViilvCdfmY\n\tYKlrOhhvAMeLRg1VvW5khpsKjPIKfAFdgOx9DHK3a5ULK1SAGcafINhCOYqgM+Pqntlf\n\tiLmQ==","X-Gm-Message-State":"AHPjjUhiBLas9VTRCk80svOBMhtzRSFKWWp4IepqjR4/+XnqiPHBoIBd\n\tqVepr7xoeffeL7J+XPxzMA==","X-Google-Smtp-Source":"ADKCNb7/9XATXFaKFdgrMfr2ObytWceBlG02T7C90ViX7JQsUGcAh1tTzoHhB4p7sBi1tnYNS2nybQ==","X-Received":"by 10.99.121.66 with SMTP id u63mr7796176pgc.72.1504709393311;\n\tWed, 06 Sep 2017 07:49:53 -0700 (PDT)","From":"Richard Henderson <richard.henderson@linaro.org>","To":"qemu-devel@nongnu.org","Date":"Wed,  6 Sep 2017 07:49:34 -0700","Message-Id":"<20170906144940.30880-9-richard.henderson@linaro.org>","X-Mailer":"git-send-email 2.13.5","In-Reply-To":"<20170906144940.30880-1-richard.henderson@linaro.org>","References":"<20170906144940.30880-1-richard.henderson@linaro.org>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400e:c05::232","Subject":"[Qemu-devel] [PULL 08/14] tcg/s390: Merge cmpi facilities check to\n\ttcg_target_op_def","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"peter.maydell@linaro.org, Richard Henderson <rth@twiddle.net>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"From: Richard Henderson <rth@twiddle.net>\n\nAcked-by: Cornelia Huck <cohuck@redhat.com>\nSigned-off-by: Richard Henderson <rth@twiddle.net>\n---\n tcg/s390/tcg-target.inc.c | 68 +++++++++++++++++++++--------------------------\n 1 file changed, 30 insertions(+), 38 deletions(-)","diff":"diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c\nindex d34649eb13..e075b4844a 100644\n--- a/tcg/s390/tcg-target.inc.c\n+++ b/tcg/s390/tcg-target.inc.c\n@@ -41,7 +41,7 @@\n #define TCG_CT_CONST_MULI  0x100\n #define TCG_CT_CONST_ORI   0x200\n #define TCG_CT_CONST_XORI  0x400\n-#define TCG_CT_CONST_CMPI  0x800\n+#define TCG_CT_CONST_U31   0x800\n #define TCG_CT_CONST_ADLI  0x1000\n #define TCG_CT_CONST_ZERO  0x2000\n \n@@ -398,7 +398,18 @@ static const char *target_parse_constraint(TCGArgConstraint *ct,\n         ct->ct |= TCG_CT_CONST_XORI;\n         break;\n     case 'C':\n-        ct->ct |= TCG_CT_CONST_CMPI;\n+        /* ??? We have no insight here into whether the comparison is\n+           signed or unsigned.  The COMPARE IMMEDIATE insn uses a 32-bit\n+           signed immediate, and the COMPARE LOGICAL IMMEDIATE insn uses\n+           a 32-bit unsigned immediate.  If we were to use the (semi)\n+           obvious \"val == (int32_t)val\" we would be enabling unsigned\n+           comparisons vs very large numbers.  The only solution is to\n+           take the intersection of the ranges.  */\n+        /* ??? Another possible solution is to simply lie and allow all\n+           constants here and force the out-of-range values into a temp\n+           register in tgen_cmp when we have knowledge of the actual\n+           comparison code in use.  */\n+        ct->ct |= TCG_CT_CONST_U31;\n         break;\n     case 'Z':\n         ct->ct |= TCG_CT_CONST_ZERO;\n@@ -463,35 +474,6 @@ static int tcg_match_xori(TCGType type, tcg_target_long val)\n     return 1;\n }\n \n-/* Imediates to be used with comparisons.  */\n-\n-static int tcg_match_cmpi(TCGType type, tcg_target_long val)\n-{\n-    if (s390_facilities & FACILITY_EXT_IMM) {\n-        /* The COMPARE IMMEDIATE instruction is available.  */\n-        if (type == TCG_TYPE_I32) {\n-            /* We have a 32-bit immediate and can compare against anything.  */\n-            return 1;\n-        } else {\n-            /* ??? We have no insight here into whether the comparison is\n-               signed or unsigned.  The COMPARE IMMEDIATE insn uses a 32-bit\n-               signed immediate, and the COMPARE LOGICAL IMMEDIATE insn uses\n-               a 32-bit unsigned immediate.  If we were to use the (semi)\n-               obvious \"val == (int32_t)val\" we would be enabling unsigned\n-               comparisons vs very large numbers.  The only solution is to\n-               take the intersection of the ranges.  */\n-            /* ??? Another possible solution is to simply lie and allow all\n-               constants here and force the out-of-range values into a temp\n-               register in tgen_cmp when we have knowledge of the actual\n-               comparison code in use.  */\n-            return val >= 0 && val <= 0x7fffffff;\n-        }\n-    } else {\n-        /* Only the LOAD AND TEST instruction is available.  */\n-        return val == 0;\n-    }\n-}\n-\n /* Immediates to be used with add2/sub2.  */\n \n static int tcg_match_add2i(TCGType type, tcg_target_long val)\n@@ -537,8 +519,8 @@ static int tcg_target_const_match(tcg_target_long val, TCGType type,\n         return tcg_match_ori(type, val);\n     } else if (ct & TCG_CT_CONST_XORI) {\n         return tcg_match_xori(type, val);\n-    } else if (ct & TCG_CT_CONST_CMPI) {\n-        return tcg_match_cmpi(type, val);\n+    } else if (ct & TCG_CT_CONST_U31) {\n+        return val >= 0 && val <= 0x7fffffff;\n     } else if (ct & TCG_CT_CONST_ZERO) {\n         return val == 0;\n     }\n@@ -2252,7 +2234,9 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op)\n     static const TCGTargetOpDef r_r = { .args_ct_str = { \"r\", \"r\" } };\n     static const TCGTargetOpDef r_L = { .args_ct_str = { \"r\", \"L\" } };\n     static const TCGTargetOpDef L_L = { .args_ct_str = { \"L\", \"L\" } };\n+    static const TCGTargetOpDef r_ri = { .args_ct_str = { \"r\", \"ri\" } };\n     static const TCGTargetOpDef r_rC = { .args_ct_str = { \"r\", \"rC\" } };\n+    static const TCGTargetOpDef r_rZ = { .args_ct_str = { \"r\", \"rZ\" } };\n     static const TCGTargetOpDef r_r_ri = { .args_ct_str = { \"r\", \"r\", \"ri\" } };\n     static const TCGTargetOpDef r_0_ri = { .args_ct_str = { \"r\", \"0\", \"ri\" } };\n     static const TCGTargetOpDef r_0_rK = { .args_ct_str = { \"r\", \"0\", \"rK\" } };\n@@ -2320,8 +2304,10 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op)\n         return &r_r_ri;\n \n     case INDEX_op_brcond_i32:\n+        /* Without EXT_IMM, only the LOAD AND TEST insn is available.  */\n+        return (s390_facilities & FACILITY_EXT_IMM ? &r_ri : &r_rZ);\n     case INDEX_op_brcond_i64:\n-        return &r_rC;\n+        return (s390_facilities & FACILITY_EXT_IMM ? &r_rC : &r_rZ);\n \n     case INDEX_op_bswap16_i32:\n     case INDEX_op_bswap16_i64:\n@@ -2366,16 +2352,22 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op)\n     case INDEX_op_setcond_i32:\n     case INDEX_op_setcond_i64:\n         {\n-            static const TCGTargetOpDef setc\n+            /* Without EXT_IMM, only the LOAD AND TEST insn is available.  */\n+            static const TCGTargetOpDef setc_z\n+                = { .args_ct_str = { \"r\", \"r\", \"rZ\" } };\n+            static const TCGTargetOpDef setc_c\n                 = { .args_ct_str = { \"r\", \"r\", \"rC\" } };\n-            return &setc;\n+            return (s390_facilities & FACILITY_EXT_IMM ? &setc_c : &setc_z);\n         }\n     case INDEX_op_movcond_i32:\n     case INDEX_op_movcond_i64:\n         {\n-            static const TCGTargetOpDef movc\n+            /* Without EXT_IMM, only the LOAD AND TEST insn is available.  */\n+            static const TCGTargetOpDef movc_z\n+                = { .args_ct_str = { \"r\", \"r\", \"rZ\", \"r\", \"0\" } };\n+            static const TCGTargetOpDef movc_c\n                 = { .args_ct_str = { \"r\", \"r\", \"rC\", \"r\", \"0\" } };\n-            return &movc;\n+            return (s390_facilities & FACILITY_EXT_IMM ? &movc_c : &movc_z);\n         }\n     case INDEX_op_div2_i32:\n     case INDEX_op_div2_i64:\n","prefixes":["PULL","08/14"]}