From patchwork Thu Jan 26 04:38:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 647061 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp58757pvb; Wed, 25 Jan 2023 20:42:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXtcxp6OnYImrAs/KaQdMzMDu47taZ8pghUwTr1A2gGBDBJb/ofyVy/lnNgEpgNfzq2TEpSG X-Received: by 2002:ac8:4510:0:b0:3a8:e35:258f with SMTP id q16-20020ac84510000000b003a80e35258fmr50968223qtn.31.1674708150216; Wed, 25 Jan 2023 20:42:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674708150; cv=none; d=google.com; s=arc-20160816; b=PrMlXRGHFNchqcCrmmZ1OaacCy1fc8m8fW+fYr9PWIPxFajk7irfLHMdvIyOTQYBo8 EIUKP1Apds1MzE7OrYbgemkds5Ndud8Vucw+mBRTP2FDJBa6AKvRMsqZGCHL9pDg2Bsh XM90p5Ao1Seqky02de2alRG+A6Sl4CYdYrPFgvXYRKONK69sW+BLt/TWxXQ2VEjVTQQw gSLtcZjXSHyrqSHf+W+H8f6A8dGjZA3CtuK5nSvKyakj/YKtVfBiqy8DqSSD5cN2LfJM NKDBLZ3zoplN+bHs8w3D8VFGukObWXqrYiYFiADiaylSqFMz+xmAnTrYegvo/xkWkjM5 3jwQ== 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=BaPNUV0c7247g5NnraFY0tZEOzKo666SsANsAFMshsk=; b=X3fj8C47nXeqylNUF7g7gnA8Nb3F/MR0psiUPeLZWHk11DkS7MJxVap5brjfUZzU7x uCkemXzc168jiyqf26xsCG5ITywkqthyeHBRdjSxzaawSohWryd79Ky+uRH9SPKD+FAF R2imm7tSNZ7Rfj1+1tZ+vz1jAw1+l0HZvd0xgYboyCGKjGQcxPbVBXVUGizWFNMGESXB 6Se782154cHxCKmx6wAEIC6LZwpmi9J6BXXdH5OXb6OJfdvDI49BDsDbNGKKV/BUMWJB m3G4XFJQF4Pudv+hp10NOjNxaPEFROGRz/j0gTBngbtd86y4XhhaNs515utY3hpuVmxi ysGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XfpXMwT1; 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 r21-20020ac85c95000000b003b80b2c94b4si87552qta.702.2023.01.25.20.42.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jan 2023 20:42:30 -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=XfpXMwT1; 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 1pKu2p-0000Pe-9J; Wed, 25 Jan 2023 23:39:27 -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 1pKu2Y-0000Hq-OS for qemu-devel@nongnu.org; Wed, 25 Jan 2023 23:39:11 -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 1pKu2V-0004TZ-FR for qemu-devel@nongnu.org; Wed, 25 Jan 2023 23:39:10 -0500 Received: by mail-pj1-x1035.google.com with SMTP id m11so563423pji.0 for ; Wed, 25 Jan 2023 20:39:05 -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=BaPNUV0c7247g5NnraFY0tZEOzKo666SsANsAFMshsk=; b=XfpXMwT1eKZ8klyN5pMeD6yVXvJfnP515CrIgKG+MOnMx8REEynWgzXSQCagSzOCZY B8yqAZ6B+96U5d5iHSGaVRhSTEHNv/hO+eCh9i8QZOa1rdcQu3f+T5ft759pwh/VfU5w MOBdN/tyJ0PXvJ0G1trx0mkvYFwqqiyDHllCBQ8bllkED8wKdfd6I+qGqb1d7G+Zx8M8 G8sOTnc3pEyluB1S1Km2hx9VPJtsK0WZa28SAxwawczzyGoUOf4sHC9ZvHO1Bz8bjUOC XHW9IMgKM0gKhB4CtDU8gQ12jYs/kqrP/JiQTWLKKh5YEIqdwdF2Rh8RwDNqmiMwJReh p77w== 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=BaPNUV0c7247g5NnraFY0tZEOzKo666SsANsAFMshsk=; b=gyKNsOOqd2P5phl+Plk5VrLw+DLU2S9PB5onmBgcBXZTMgkR2rQSYDG+iR4ZNZcvBt DWHXvSt/ID9vQY2ZesbnE1czl3yFVHH+76JtXALhHWkg71cB/MqcprppHN2lNUsYI6ju 5Io6DZ4baitvrwFHNCqb12Urec8oREllbLAL8swJSlKpx84hlrkw7xMzA19GS0F0IDoE s8Nu3tcd8mPg1TcgWc8gr8b+7QGsgsCluPj2MTRn7kW5GhV9Co2I2J4Zq2CnN8KEviGS IKA0II/O5KzfI9HYDBvxmD2wJc1NKA8/ZEE5YnWhItdUW6+P2saSFzw0YkXdxJWYQOJp aA3Q== X-Gm-Message-State: AFqh2kpAr4x3/Kxbcum7DlmaDfkmlEmZHePPCFazf2a3Z0vE/Vp8RE3C rzo3Xl+pZhgOXmXQggBnrj+ZqJflwEX9Jp4iEEw= X-Received: by 2002:a17:90b:3eca:b0:22b:b89b:b9d0 with SMTP id rm10-20020a17090b3eca00b0022bb89bb9d0mr21215869pjb.22.1674707945250; Wed, 25 Jan 2023 20:39:05 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id s62-20020a17090a69c400b00228e56d375asm233376pjj.33.2023.01.25.20.39.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 20:39:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, David Hildenbrand , Ilya Leoshkevich Subject: [PATCH v5 24/36] target/s390x: Use a single return for helper_divs32/u32 Date: Wed, 25 Jan 2023 18:38:12 -1000 Message-Id: <20230126043824.54819-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230126043824.54819-1-richard.henderson@linaro.org> References: <20230126043824.54819-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 Reviewed-by: David Hildenbrand Reviewed-by: Philippe Mathieu-Daudé --- v2: Fix operand ordering; use tcg_extr32_i64. Cc: David Hildenbrand Cc: Ilya Leoshkevich --- 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 93923ca153..bc828d976b 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 a339b277e9..169f7ee1b2 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; }