From patchwork Sat Feb 4 16:32:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 650661 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp1447053pva; Sat, 4 Feb 2023 08:37:05 -0800 (PST) X-Google-Smtp-Source: AK7set9JEpWl3r9EgWEIEF2LsxbCg+mOD/RLwDrwAku3hxoCvaeHYOW7D0xrGnmBndwVoVxZ+hiD X-Received: by 2002:ac8:7949:0:b0:3b9:bc8c:c216 with SMTP id r9-20020ac87949000000b003b9bc8cc216mr10561396qtt.33.1675528625106; Sat, 04 Feb 2023 08:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675528625; cv=none; d=google.com; s=arc-20160816; b=eWgGhq+qTtC08eq4JJ1ObmbHgbDF2T0J+EFSfEUIe3Mcuy9RPXWFVk5itU+gwCpWxX TItvaWgaYvIKe/DU6LuJvQTOQQIigubDVfkn+uzL7WLNc46znonScsIqFz7cGWuwcgy1 5un5YRJUV4N99cNRMx9bLyjVztJKvg1IussFcRJkU/JpbxRrPuwW/jmbgskmsS9pbj13 GlW6pQaA+/FfSxsZgp1siY7MVzk92PM9boAzZaMRHNcwqLzQGaQYm4qHuuGi9lBs5Tus YbYt2HNcRTd8DNuLzaPAO+iWYRktN1gtRosjMmZ0387OCr+/jxUqlbAlvKVMXGfqxKib 9I9w== 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=/flZifrbzQQQmxJpuLpAQCV8xYiiduPjwGp5rxcesSA=; b=WxsBzOOSlVAi3Sx92j7idEKv/UATE9K0B2JekbtglpuolAHmHvpqGyxCet7J0bAUmP niqzQjhJBFXqRKzvmVfrycpzUO2tJRU+/cU8QV6t5kmlHiG68fUhe+silVsZd+0FK52X zeJYzKsrAfloo898r1QvgF7Bj25bWy+NIgqCtIEOSumxD17ELwOyG/4SKX5k/BbjEDZm XSaMQ/ucLakotxoxjfN3A8BKeRRBNi9YOFL1+atqVs9RwP+R8p/vCVdkudbiVgly1dD5 FJPRsv0ReDZREwg8KtmJEQbWte3p1Il8nDesaD2das+DqxbsIdtONKBx7bDTIn/Alpcc PW5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kR94lW+7; 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 21-20020a370415000000b0071d94250f64si4239540qke.346.2023.02.04.08.37.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 Feb 2023 08:37:05 -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=kR94lW+7; 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 1pOLUE-0005DT-RG; Sat, 04 Feb 2023 11:33:58 -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 1pOLUE-0005D4-0z for qemu-devel@nongnu.org; Sat, 04 Feb 2023 11:33:58 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOLUC-0002UX-E7 for qemu-devel@nongnu.org; Sat, 04 Feb 2023 11:33:57 -0500 Received: by mail-pj1-x1029.google.com with SMTP id t12-20020a17090aae0c00b00229f4cff534so10049029pjq.1 for ; Sat, 04 Feb 2023 08:33:56 -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=/flZifrbzQQQmxJpuLpAQCV8xYiiduPjwGp5rxcesSA=; b=kR94lW+76cU7hGZTu+qb45Iep4H+Kfr1EZsiERz1WoM8EjpBX5iAruRKsNUbrV8Jc3 UZpo19ebrIdpUXwhavAmAwT/5FMXmWHYnZN39w8lK0ep8SB33mFfDCjr3wstqr72ESAw BgNvgL6l4EGf5PcIHlmYYEbH9Z5XmjtXpqY131wuROh9tSqltRPK6m9k6bxUfMC6Lqm/ T9rDTO6p04ZORjcSKegl/w2is3cTAGNmlwThvmL24bdK2aj3uJH9ZWya1hF/aGz65egB qudEZ7g087oOFtwrpmlcji8mzkm8tXD9uIcHiutgnNdKd1hkn5BVlePAcBACHdFgdWHv /zrQ== 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=/flZifrbzQQQmxJpuLpAQCV8xYiiduPjwGp5rxcesSA=; b=LxTlxopEyiTX8NVrfwfbwBgnw05aCmJxV4W0cypbFpxSK/J2IlElVKx44CnNuLhCNn RLyCmP/CEmKgzz6YfUrgJdD+TLI83UasvYvWXO9AD7+LUS1h2Qbm6ogk95cny0udx+GF 8UDTBWXV/zwmJk3Yq/nplfLjuCtyvwp6duw9YMG/WzrF3Pa5OOge+R+0K1yIkvsE2uYR K5a0bvyPf+ErPfP0/P0ltNdxptPgvihzc9+6oLZqFUDlWrS9N1U1E/8aXBBa3l6fAm4c 0zpdEbEpqwL5gQkoY0gqbN7LZ9qHFVroRWh+eN0Zj+Bm8mGYjAbu7rxQ94Va+5JTEu1R gjpA== X-Gm-Message-State: AO0yUKXfsye+lmfZBeqvYAPmZkBMCDI7JGz99ePFLi3NKOOjVY8sWU8m r0/0HQFj3B+IcOTl39FWSxsV0nCNBG7q7/w4 X-Received: by 2002:a17:902:d4cc:b0:194:d1ee:954 with SMTP id o12-20020a170902d4cc00b00194d1ee0954mr8266657plg.7.1675528435610; Sat, 04 Feb 2023 08:33:55 -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 w19-20020a1709029a9300b00186b69157ecsm3660859plp.202.2023.02.04.08.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 08:33:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Hildenbrand Subject: [PULL 27/40] target/s390x: Use a single return for helper_divs32/u32 Date: Sat, 4 Feb 2023 06:32:57 -1000 Message-Id: <20230204163310.815536-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230204163310.815536-1-richard.henderson@linaro.org> References: <20230204163310.815536-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand Signed-off-by: Richard Henderson --- 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 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; }