From patchwork Fri Nov 11 08:08:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 623706 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp628977pvb; Fri, 11 Nov 2022 00:15:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf5o7R6Zsd8aCvVAh78k/jlg9ysG/97j27rBjDLPHmG7rN2JzZ+p8NVcVReGRyxT4Hp+0wpn X-Received: by 2002:a37:bd02:0:b0:6fa:3477:d62f with SMTP id n2-20020a37bd02000000b006fa3477d62fmr239294qkf.279.1668154507933; Fri, 11 Nov 2022 00:15:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668154507; cv=none; d=google.com; s=arc-20160816; b=M3iDpAENSPN34IYmCo6NylVYUczK1Dgz+NFYyymvChCiCRkwLb/VcnFRg3+6aAno6d 0I8I5Rs9dWgZ2xsxKqWKA0LBODT2zNNq7CvVmVuOfn1CYnN9qER/BRFnvdbPZGhiL1ym RFVXMSK6UKcmkdUzIkz3oKT/oxjB4MJ+AiNIVz7cI80xnd2/l+MOwKCDvCGUgw3Buk1q gzJjx71E90n8R6ycgU1RWE+4TLkNqLA6Hrabq7BvoC2LM04O9FF8mII2d7QMGTHSW/9j 7i4l1JGKl92LcEd6wrcd8MrIwezJN2dzQBM9/4NKTRN4aTya5z3zsWGsLKtU522XQgNb 2kaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AXSkt8Lrp0PeRDPttlqt51NDMAb6lhZkPK4hJZHZsVY=; b=dhNrX50+Nwlashx3gSwobHPuted+XHclb9uLhJupeRPIovBaDbcySGBkkb3sLyX0/d DQK3sBTzys2dbkbX/ac7uIXIr+eBJF0B1vKqRsHMhy1A0HU3ZpKg4//+EJS6zscI4g27 4SqHnrWNNasI6apD4YF2YYBX2FaP8q59xgKsbq9RS6PJsJh4USz2Sl40fEzl2fHjb9YG B0nflJ+tRhK/C2mnoKx0vOvxH3zBs5NBbgIEyJ7PwbB4CjxIdnGmWuy5URXOoov5NOJe uFAbA4SCMyiEs39klNcPnXXrkKbS8rowFvwKinIjLISh1WzoKtWThcYps/Tg9Oqoe0SS ZDGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S52OSQ52; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i15-20020ac84f4f000000b003a5914f8333si719015qtw.333.2022.11.11.00.15.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Nov 2022 00:15:07 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S52OSQ52; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otP6J-0001Hj-MH; Fri, 11 Nov 2022 03:09:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otP5d-00014C-AG for qemu-devel@nongnu.org; Fri, 11 Nov 2022 03:08:43 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otP5b-0002Em-Ke for qemu-devel@nongnu.org; Fri, 11 Nov 2022 03:08:41 -0500 Received: by mail-pj1-x1035.google.com with SMTP id b11so3843796pjp.2 for ; Fri, 11 Nov 2022 00:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AXSkt8Lrp0PeRDPttlqt51NDMAb6lhZkPK4hJZHZsVY=; b=S52OSQ52zdoNk9+2gqUuzQLKYxDE5x505D3pz3saK82OZr6I8oN60po8U2tImfrAH2 X/kF4J4RTRX2AlcV2AaJ6oTSdTnYkMOiWh3jfguaX3KLCr9U3h4sfqn3NhUcVXWmird2 SrQt+2eQjXy8XQb6IQ8Aok0m0g5kXMPOYdvs4QeQtA38pDXBH6HFSNprk0dzUqRFK4iI ROnB7/mhnGoRmaYDJhfQkyxalUdbBaxUyfzzOv/ogvp3V2A3BFvUP9490ZXBmeJhuwc+ 7WAo0jXce7yEId0sf/09frJUcM/lSKiUd4XUdc+RCDKQOBEhHMOtEk0qRp4RX3k7powc XmiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AXSkt8Lrp0PeRDPttlqt51NDMAb6lhZkPK4hJZHZsVY=; b=KwcqJCttiJisdVvwfuTGw5eAC1X6mdGC7XXaJZzhyI2/tb7mMIFgbSxTYaOSQld6HR l80Kh7SxEH5QCYjK3MKcKeafkW2K5vUvt50dH2EL6N+4V4dMHmzeWALsZ4VeZHeTGIG0 ww55ibIZY/uC/KBPELTiUepUuGfZuATNCnk9/pMwNtvG1H/ONzpQar+/FLDhKfPBMJkz SOTZ5aADlJ9fJXRR1aDZsffnVCMk6kgvTzyRwcO9V2LxiBTWxbnuqordolvAH2O7bmbt vVoEFZ1oXBtYKNIsbqGehj1oDS99CGKDDW7vgpXCoYlr259K0tARXvUjzx1VaDtVu6HD dQlA== X-Gm-Message-State: ANoB5pkWcYRc44XqtoPEAudRWLzDXxEUybWvRc23GCcBcQTtp5CmsZFj uskmYQFQci/EPooIhfhwrxZprypsNLTbpaPw X-Received: by 2002:a17:90a:8c0c:b0:218:10c0:1afd with SMTP id a12-20020a17090a8c0c00b0021810c01afdmr755932pjo.36.1668154118356; Fri, 11 Nov 2022 00:08:38 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-0aef-59aa-1faf-7e61.static.ipv6.internode.on.net. [2001:44b8:2176:c800:aef:59aa:1faf:7e61]) by smtp.gmail.com with ESMTPSA id j4-20020a170902c3c400b00186a2dd3ffdsm1046341plj.15.2022.11.11.00.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 00:08:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: iii@linux.ibm.com, david@redhat.com Subject: [PATCH for-8.0 v2 04/13] target/s390x: Use a single return for helper_divs32/u32 Date: Fri, 11 Nov 2022 18:08:11 +1000 Message-Id: <20221111080820.2132412-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221111080820.2132412-1-richard.henderson@linaro.org> References: <20221111080820.2132412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Pack the quotient and remainder into a single uint64_t. Signed-off-by: Richard Henderson Acked-by: Ilya Leoshkevich --- v2: Fix operand ordering; use tcg_extr32_i64. --- target/s390x/helper.h | 2 +- target/s390x/tcg/int_helper.c | 26 +++++++++++++------------- target/s390x/tcg/translate.c | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index bf33d86f74..97a9668eef 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -10,7 +10,7 @@ DEF_HELPER_FLAGS_4(clc, TCG_CALL_NO_WG, i32, env, i32, i64, i64) DEF_HELPER_3(mvcl, i32, env, i32, i32) DEF_HELPER_3(clcl, i32, env, i32, i32) DEF_HELPER_FLAGS_4(clm, TCG_CALL_NO_WG, i32, env, i32, i32, i64) -DEF_HELPER_FLAGS_3(divs32, TCG_CALL_NO_WG, s64, env, s64, s64) +DEF_HELPER_FLAGS_3(divs32, TCG_CALL_NO_WG, i64, env, s64, s64) DEF_HELPER_FLAGS_3(divu32, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_3(divs64, TCG_CALL_NO_WG, s64, env, s64, s64) DEF_HELPER_FLAGS_4(divu64, TCG_CALL_NO_WG, i64, env, i64, i64, i64) diff --git a/target/s390x/tcg/int_helper.c b/target/s390x/tcg/int_helper.c index 954542388a..7260583cf2 100644 --- a/target/s390x/tcg/int_helper.c +++ b/target/s390x/tcg/int_helper.c @@ -34,45 +34,45 @@ #endif /* 64/32 -> 32 signed division */ -int64_t HELPER(divs32)(CPUS390XState *env, int64_t a, int64_t b64) +uint64_t HELPER(divs32)(CPUS390XState *env, int64_t a, int64_t b64) { - int32_t ret, b = b64; - int64_t q; + int32_t b = b64; + int64_t q, r; if (b == 0) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } - ret = q = a / b; - env->retxl = a % b; + q = a / b; + r = a % b; /* Catch non-representable quotient. */ - if (ret != q) { + if (q != (int32_t)q) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } - return ret; + return deposit64(q, 32, 32, r); } /* 64/32 -> 32 unsigned division */ uint64_t HELPER(divu32)(CPUS390XState *env, uint64_t a, uint64_t b64) { - uint32_t ret, b = b64; - uint64_t q; + uint32_t b = b64; + uint64_t q, r; if (b == 0) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } - ret = q = a / b; - env->retxl = a % b; + q = a / b; + r = a % b; /* Catch non-representable quotient. */ - if (ret != q) { + if (q != (uint32_t)q) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } - return ret; + return deposit64(q, 32, 32, r); } /* 64/64 -> 64 signed division */ diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 2fbdab7252..9c2ea15c8d 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -2395,15 +2395,15 @@ static DisasJumpType op_diag(DisasContext *s, DisasOps *o) static DisasJumpType op_divs32(DisasContext *s, DisasOps *o) { - gen_helper_divs32(o->out2, cpu_env, o->in1, o->in2); - return_low128(o->out); + gen_helper_divs32(o->out, cpu_env, o->in1, o->in2); + tcg_gen_extr32_i64(o->out2, o->out, o->out); return DISAS_NEXT; } static DisasJumpType op_divu32(DisasContext *s, DisasOps *o) { - gen_helper_divu32(o->out2, cpu_env, o->in1, o->in2); - return_low128(o->out); + gen_helper_divu32(o->out, cpu_env, o->in1, o->in2); + tcg_gen_extr32_i64(o->out2, o->out, o->out); return DISAS_NEXT; }