From patchwork Mon Jan 30 21:48:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 648634 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp1396049pva; Mon, 30 Jan 2023 13:53:21 -0800 (PST) X-Google-Smtp-Source: AK7set98xIdZkapJ6KSmhUqpmCNzVfCU/W1n3UPMok8UadQMXCwDZDd3NVJP48wDc+Pskokd36UN X-Received: by 2002:a05:622a:1492:b0:3b8:6a41:c329 with SMTP id t18-20020a05622a149200b003b86a41c329mr9101534qtx.21.1675115600884; Mon, 30 Jan 2023 13:53:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675115600; cv=none; d=google.com; s=arc-20160816; b=lmTWbjm4knCM6rCA77YKK1QY4fWmDOVF0iYOdQoAFqoHLR3OlepM/cO5btcysX/y0M BJZ6JOlYajSzMqlJ+UXH9C4WnfpJW+Lg7ikLCQvjusEGis+luCzN5zxf3t9AyYguH4JT qz9r+9BM8I7XepqgyHtU5w5mS/gA+Ifn/lOmXxvgd8HOq4Z19D41U1wIGNOagWPkfLVC SEZB5NC43fG5Rt7WcV4/PoJJ69Uzi/LRPlqykmlx83qY/bbrpTkZuSySzaTTBaYW9C4k EfMdJpueUYiyJuTvBfbk/Fm5MnvXHanL+JytoH4L6XfrrmNFNk6Rp+Kn/IKoWkstkHHn 2lrA== 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=ca0LhjRDzzdQAalKzF4VeYcMdD7zBavZ3b6jU54akzNynyD6hqGyFglKJPLMYJGiQn g42Py16fmY+GIYjEulUkjoL3Oqb9v/a+6mktTQikzZJK6NHToEXT2zVtM64BH50v9Fhr eEqJI+wy55Cso1WgkttuXyxhsdXjpuUTXkdSA27ZhD1peAIIYNiNpVCxfvq7gJhw3QTu OMIWsElat0ZX03LqJVWEzwy64nNLGiYN8LtB156hLEhmN/advDodVPmQTKjopsrz6ZC8 5Ia9hOty4MkLkt83BuvCx5Q4l/piINI2vszqVHgBuEz8KWJGDWKLe4AAJ49+TlkOrGpg YYJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eOxk8OBv; 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 j16-20020a05620a289000b00706999a2a82si2369825qkp.554.2023.01.30.13.53.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jan 2023 13:53:20 -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=eOxk8OBv; 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 1pMc1r-0002D7-Ot; Mon, 30 Jan 2023 16:49:31 -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 1pMc1q-0002A3-8F for qemu-devel@nongnu.org; Mon, 30 Jan 2023 16:49:30 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pMc1o-0005hO-LI for qemu-devel@nongnu.org; Mon, 30 Jan 2023 16:49:29 -0500 Received: by mail-pl1-x636.google.com with SMTP id jh15so4050489plb.8 for ; Mon, 30 Jan 2023 13:49:28 -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=eOxk8OBvRMhVRPokuRn1E4jQzI1bVOFEZtePbdTNNahSHMrSrJW/hYyH5oeh8PYotD QQqb3wLZch5ikfy6thgzh+hsmfRuOiSRK+tWZGsOJ1HT2YUqbOcxg/ihNqh92+byKQsI Gp0OMh6iQduT6V1/pYOSIhMNq4CSt7WFDZBFTob11BWzvM5/PAO+Je6HInn47eeTD6Wz O9fik2brkixUMSEFZ8yczIumvU3G18VPFMQd4aaZDR03nXl2Kf/YJrc/AHY7faoKdaeQ zH4qhnoMMiKE6tdN1hVHRFUHGLJethsb4TZvO3Xg7kz/rKjCNNBXTCcWxniS3De/VFkw AWNQ== 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=mxwSlqIof8gA41IRKhlqACaQ8HBX6GEIcjYiJMmZZstaKi1KPdKEqSezCm4FF4XM4P NfSXaR6f7MdQJgzSctLnaZrKLLj4ng8xZ447A+V6NdnB7fRkKrk7ozuVgiQub0AC7nxv 7ANBITYEaQ+EZpUp4FDDJ/hVAmm0Ht8ExcqotXLG/a07EECsWMLHiciLAVNDC+qS85hE DikXs287GsGIqqA0Rk+caosD89bA1QcQFx/by0eLP5odSd/4vGJxEAGzeZ5GKBLasMKS rZLxwt/1lp8fPREs8uIol66NKkDmtM4t9OD4cH0ytZYqzZl5aM3t2UFe7KgqbUTM0uit cThQ== X-Gm-Message-State: AO0yUKVk3gtIN3vyRpiegVqHPUJ0IqPGD5kiXvITzgCLW8eyGYoSdEai nmevvO3WqmCtNDe+ojEWMQ1bxDon+9tX28sV X-Received: by 2002:a17:90b:2250:b0:22c:36a6:71a6 with SMTP id hk16-20020a17090b225000b0022c36a671a6mr17190856pjb.41.1675115367438; Mon, 30 Jan 2023 13:49:27 -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 t4-20020a17090ad14400b00219220edf0dsm7451215pjw.48.2023.01.30.13.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:49:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org, David Hildenbrand Subject: [PATCH v6 24/36] target/s390x: Use a single return for helper_divs32/u32 Date: Mon, 30 Jan 2023 11:48:32 -1000 Message-Id: <20230130214844.1158612-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130214844.1158612-1-richard.henderson@linaro.org> References: <20230130214844.1158612-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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; }