From patchwork Fri Aug 4 05:28:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9880523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5BA7A60360 for ; Fri, 4 Aug 2017 05:38:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54D2728906 for ; Fri, 4 Aug 2017 05:38:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49BA628911; Fri, 4 Aug 2017 05:38:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D677F2890E for ; Fri, 4 Aug 2017 05:38:02 +0000 (UTC) Received: from localhost ([::1]:35888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddVJC-00070U-42 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 04 Aug 2017 01:38:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddVAD-0007YP-Nq for qemu-devel@nongnu.org; Fri, 04 Aug 2017 01:28:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddVAC-0001GB-Of for qemu-devel@nongnu.org; Fri, 04 Aug 2017 01:28:45 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:37681) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddVAC-0001Eu-GX for qemu-devel@nongnu.org; Fri, 04 Aug 2017 01:28:44 -0400 Received: by mail-pg0-x244.google.com with SMTP id 83so789166pgb.4 for ; Thu, 03 Aug 2017 22:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=JNnZ+xpRDYAJ19JYipi9Tbdso194ocixTivlCgCkM8I=; b=l53DMUpC3yGxr8S4nHEMvYecpMNT9LBFMfiWwz4UGyAMsX2zRdqW3eX+HiZjFJNgAP yBenjdNngwppwmqVKi+AYD+394spod99/e2BMkH6fcbkSzJj5G/3NU1RoCv22dipEL4v 5HZSscnOWQHuSJM7wVHemJwptUZB28Sk9kdyN0DgDKNQRH8jFTGPouvlz6AsSUTZ2ZSN Tm4MXW08BjXsNTOX2kZMHthdKI4RLPHPH+xrIMFx10moHSReKXSWG+ttuGD/9sWvMqF1 bP8arey9dHh0CcHcystW8KC3ODqnOFGasRfTHlFjgB3MLwBYvfVC8QUJ5L/Hm42X+eTz jV/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=JNnZ+xpRDYAJ19JYipi9Tbdso194ocixTivlCgCkM8I=; b=jicw9SYH37P7Mdv4L+4xW7OqCovE0sBuwmUOK9Tfiao/sth84PddMwJBGQTbJtMp1i eRNL2KRO/HvEokV/mH0+X1yFv2oWshcdQ3xUVDArEbMPe4HzZy2eEgfdMFgW2euU4Ksf PInhBilqz9b+VWIXcDFdkTByB0ZbhiRrs6kzrTsG5LXooeK9N2+K2aVU3yoYMKbY6YAr PR8rCk9OlY9o4xJx2nRRnFOw+2ONAHRS74MqwUU5sD4TT2np5GpZoGsu363O2MNKLefa BoaSSTtq7p+9xAEdNiyxxu5hPikM7Dps/N2QtG8H1UicL52Ae8lWggLXciuvDeRDFLTE 7uMA== X-Gm-Message-State: AIVw111vMFAZy80i+/y4H4ztt7oGSzKAo3XcBKYKSa2kr7xPGdUlcWtZ EWGmH4L/nCc84LEgBQs= X-Received: by 10.99.55.79 with SMTP id g15mr1157177pgn.28.1501824523356; Thu, 03 Aug 2017 22:28:43 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id m5sm1053099pfg.22.2017.08.03.22.28.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Aug 2017 22:28:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 3 Aug 2017 22:28:29 -0700 Message-Id: <20170804052833.10187-8-rth@twiddle.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170804052833.10187-1-rth@twiddle.net> References: <20170804052833.10187-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH 4/8] tcg/s390: Merge add2i facilities check to tcg_target_op_def X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: borntraeger@de.ibm.com, cohuck@redhat.com, agraf@suse.de Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Richard Henderson --- tcg/s390/tcg-target.inc.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c index ff3f644f8e..6b08ccea6d 100644 --- a/tcg/s390/tcg-target.inc.c +++ b/tcg/s390/tcg-target.inc.c @@ -43,7 +43,7 @@ #define TCG_CT_CONST_ORI 0x400 #define TCG_CT_CONST_XORI 0x800 #define TCG_CT_CONST_U31 0x1000 -#define TCG_CT_CONST_ADLI 0x2000 +#define TCG_CT_CONST_S33 0x2000 #define TCG_CT_CONST_ZERO 0x4000 /* Several places within the instruction set 0 means "no register" @@ -387,7 +387,7 @@ static const char *target_parse_constraint(TCGArgConstraint *ct, tcg_regset_set_reg(ct->u.regs, TCG_REG_R3); break; case 'A': - ct->ct |= TCG_CT_CONST_ADLI; + ct->ct |= TCG_CT_CONST_S33; break; case 'I': ct->ct |= TCG_CT_CONST_S16; @@ -478,20 +478,6 @@ static int tcg_match_xori(TCGType type, tcg_target_long val) return 1; } -/* Immediates to be used with add2/sub2. */ - -static int tcg_match_add2i(TCGType type, tcg_target_long val) -{ - if (s390_facilities & FACILITY_EXT_IMM) { - if (type == TCG_TYPE_I32) { - return 1; - } else if (val >= -0xffffffffll && val <= 0xffffffffll) { - return 1; - } - } - return 0; -} - /* Test if a constant matches the constraint. */ static int tcg_target_const_match(tcg_target_long val, TCGType type, const TCGArgConstraint *arg_ct) @@ -511,8 +497,8 @@ static int tcg_target_const_match(tcg_target_long val, TCGType type, return val == (int16_t)val; } else if (ct & TCG_CT_CONST_S32) { return val == (int32_t)val; - } else if (ct & TCG_CT_CONST_ADLI) { - return tcg_match_add2i(type, val); + } else if (ct & TCG_CT_CONST_S33) { + return val >= -0xffffffffll && val <= 0xffffffffll; } else if (ct & TCG_CT_CONST_ORI) { return tcg_match_ori(type, val); } else if (ct & TCG_CT_CONST_XORI) { @@ -2241,6 +2227,12 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) static const TCGTargetOpDef r_0_rJ = { .args_ct_str = { "r", "0", "rJ" } }; static const TCGTargetOpDef r_0_rO = { .args_ct_str = { "r", "0", "rO" } }; static const TCGTargetOpDef r_0_rX = { .args_ct_str = { "r", "0", "rX" } }; + static const TCGTargetOpDef a2_r + = { .args_ct_str = { "r", "r", "0", "1", "r", "r" } }; + static const TCGTargetOpDef a2_ri + = { .args_ct_str = { "r", "r", "0", "1", "ri", "r" } }; + static const TCGTargetOpDef a2_rA + = { .args_ct_str = { "r", "r", "0", "1", "rA", "r" } }; switch (op) { case INDEX_op_goto_ptr: @@ -2389,15 +2381,13 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) = { .args_ct_str = { "b", "a", "0", "r" } }; return &mul2; } + case INDEX_op_add2_i32: - case INDEX_op_add2_i64: case INDEX_op_sub2_i32: + return (s390_facilities & FACILITY_EXT_IMM ? &a2_ri : &a2_r); + case INDEX_op_add2_i64: case INDEX_op_sub2_i64: - { - static const TCGTargetOpDef arith2 - = { .args_ct_str = { "r", "r", "0", "1", "rA", "r" } }; - return &arith2; - } + return (s390_facilities & FACILITY_EXT_IMM ? &a2_rA : &a2_r); default: break;