From patchwork Tue Aug 29 20:47:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 111257 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp1931732qge; Tue, 29 Aug 2017 13:55:19 -0700 (PDT) X-Received: by 10.237.51.37 with SMTP id u34mr7406268qtd.257.1504040119793; Tue, 29 Aug 2017 13:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504040119; cv=none; d=google.com; s=arc-20160816; b=dkRMdGTsKdh1DMEtAlNRzjeX++Y/6w70BNrt/0me+dTGQ0UhyLcISWCNjWBs2AoDDa l4boO2JrmfLP7frlwHR8nOrZQPC/KKERQO8SwgHgH2zeopjikVtSghmyFR0J908e9mQ7 dqDBSj65MCLCKYls4fgnQMUM453m09iMGrBSCMQ1aLovM47Zp4geQviHjmI9G9FFaloJ 2WZjkCu16QxUkNuAF6Vg1GkuNAE8svhAgTyjGevdZilG7Bql7lFL7cqu/t/my2ClOSQZ sj2S1syu6p1jvt36UONmMeW0sS2UCA44kgQ5GIGzOaTlMFMo18qBEYjfvGf/CKN4ubS4 GNCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=+xk74aQne64nnvSHJDOsLuL5qJmlj3IuSazRcsfg9Ns=; b=jlpOBWV0PDPQpKxoH+U0S4kT4Yw1B/M/ZqyRsMIqvzXKOdw3XdU3xLGQerqh8do1Dw QL/GwRjsZ8+W9BH67TRQsAJOdmMPmNeZhQlTKtOfahxv6eTDSMHnneXrsZT76dzhXMiD BJhJDSI6SY2pDbM3qZ73ayt1amcl57vV9w9Ib/Vfy3xh3/O8KIOEdiJyCFQ6Pd9ieT7F l/inP4/oyMiHoA7AwVmOVVsRMWAAaq+PwKpEbiDWZ2A8v3JjMX4G4rvbZyyow8R/sNqb JGXLzawEworAxJ1YSc+FZ4gF7sZD3li44JpbJUEHJ30GlbzM76dsuzaXPt7CKruo1r96 ZIsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UXB8wM10; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w22si3696066qkb.178.2017.08.29.13.55.19 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 29 Aug 2017 13:55:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UXB8wM10; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46920 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmnXZ-00084f-LF for patch@linaro.org; Tue, 29 Aug 2017 16:55:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmnQg-0002RB-R6 for qemu-devel@nongnu.org; Tue, 29 Aug 2017 16:48:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmnQg-0001Uq-06 for qemu-devel@nongnu.org; Tue, 29 Aug 2017 16:48:10 -0400 Received: from mail-pg0-x22a.google.com ([2607:f8b0:400e:c05::22a]:35703) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dmnQf-0001Ua-QW for qemu-devel@nongnu.org; Tue, 29 Aug 2017 16:48:09 -0400 Received: by mail-pg0-x22a.google.com with SMTP id 63so13983044pgc.2 for ; Tue, 29 Aug 2017 13:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+xk74aQne64nnvSHJDOsLuL5qJmlj3IuSazRcsfg9Ns=; b=UXB8wM105do+MTLcKRSMaS3kwSuzvQZQfu7XR5vIr/poJjkCS7IkHQ0MHbj2sL/iuN smTBMVKQoTrlw7xFtaM/I3f1Hbh+LlIErZPz3kymwpac3BnVwA2EmFI70TDChNRspSYi YwDoUYZ1jEW7AASm3bdnrsMkDTrJWcFyb/THE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+xk74aQne64nnvSHJDOsLuL5qJmlj3IuSazRcsfg9Ns=; b=gCB3rXnU2v+dR9Vw7oh49GjbgHh2PkqZvOFiNlYOsAQeyOC3hU784w5ELKILKYcI/u FNYtRPpTXl7bm2d7PIyUNVvPpNona+DBUowd/WJEvhZKI11erqUiJrk9iPcGK/xs6Hm+ 20Y0wQ8G5moRzIY8VAC+yEVbL/168HI47NJ88GyPZdPAV0rfRXGbsBhCySZ6kY3ZruRt Z/OKgXVA5Jx5P4r90iR7dt2Cjr+m5tPTGTXGsQhVX/EnmDbLLei3HV4ub2jcn/9Ubsnu wNmJgBqMBR71ollkSHCBlsGfpHjXRsiL0mRs1vpYMDUF3Y6hpHwkHkbSbpAOi6H/1lFK lBkg== X-Gm-Message-State: AHYfb5gs0RIT+yUhvn9A6Fe6WFLNguFMA3tx3SlcjOrCmQy3DpLHV2EL WViHnDLh3nMSao4W/1t7lg== X-Received: by 10.98.58.73 with SMTP id h70mr1601951pfa.27.1504039688487; Tue, 29 Aug 2017 13:48:08 -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 i84sm6633646pfj.139.2017.08.29.13.48.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Aug 2017 13:48:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 29 Aug 2017 13:47:55 -0700 Message-Id: <20170829204759.6853-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170829204759.6853-1-richard.henderson@linaro.org> References: <20170829204759.6853-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::22a 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, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson --- tcg/s390/tcg-target.inc.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) -- 2.13.5 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;