From patchwork Mon Feb 27 05:41:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 656920 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2230447wrb; Mon, 27 Feb 2023 00:20:40 -0800 (PST) X-Google-Smtp-Source: AK7set9Zmbtf7UERgvOv4RMi1Oqp5aRPkyuJkG4DcK6lCDaXaoKnjzw+gHCEwS3eUrLPXJ6gca0N X-Received: by 2002:a05:6214:2021:b0:570:bf43:47a with SMTP id 1-20020a056214202100b00570bf43047amr43108084qvf.1.1677486040525; Mon, 27 Feb 2023 00:20:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677486040; cv=none; d=google.com; s=arc-20160816; b=IQG/aHAOJqicX7fnULJtbFbF7T/CibpDvs621zvdMsDo64HI5sgFzjFCARKb5kQWLM nODkCYff5Y8nAGRe22tBImYxLiJzNTHErd+9a3WaxPJ5LCl3udutxw/rRT0FQXKnSAoD KEqTwoTCifOYCO3hBnvxUCLRyMBhIQg61b9TTMAO81Igyg+YpNndJxjuI99rUDxJZ4B4 2zJKhXhW6MWPod29FowKyMCn+w7H5THNihMZTGDwHblOc+VqcS+BEmHHBa8pD5DUYg55 oa8k1M6N/29pYoU3qdu8Fz3eUeZr7p/KtUIHtoihpxAJLwtwDV6Iga97TcfcUbsiQycu QHmg== 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=Q/8HAAeS3hT4Bnex7q2APNTWH9x2zw557quwYCEIRaQ=; b=BoYMBmgvOlF1ZH0wWLDV/93CV3ge3b1nMOPh2tuvrS3+kLQWxwamfBh8tAy1awnuJt TL4f4kGaLrNqfL7WMKxwHYdJxNVb2WnRrh5wJ3DVOXkhqnM2BUL0YultRVXHypKfjsQo cLnboszKVq+kIkwVg6uJJJXtKKDSbXiQKEzyWfVr0+KB5j385IAe+O58a31ZVGNaNm0O or+79PK3AnJiTV0fcEI8+vzGzSudvr2cDfN3hxWQaG5+iVNMstbwaCC8gHAvZRGKhYwo XZVWiwkp6Fp+p/sMchNYJeSWK7NdI4298SIRfXLhUCeBbS7x1WhXLvOjJmKSyOYU8xKu r8OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u0+BkiBZ; 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 az31-20020a05620a171f00b00708fd79fac9si6356745qkb.122.2023.02.27.00.20.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2023 00:20:40 -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=u0+BkiBZ; 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 1pWWHl-0001eF-8U; Mon, 27 Feb 2023 00:42:53 -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 1pWWHi-0001Rz-4a for qemu-devel@nongnu.org; Mon, 27 Feb 2023 00:42:50 -0500 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWWHg-0004k5-4i for qemu-devel@nongnu.org; Mon, 27 Feb 2023 00:42:49 -0500 Received: by mail-pg1-x535.google.com with SMTP id bn17so2832660pgb.10 for ; Sun, 26 Feb 2023 21:42:47 -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=Q/8HAAeS3hT4Bnex7q2APNTWH9x2zw557quwYCEIRaQ=; b=u0+BkiBZnKnGpUKZF44x1IuFytXnJ2DS20SB/3twp2hCMgwTQZDXltpCSdmHvd2Kmq 5u87pXXVvDU7RKFCGW2amrGmPB9Le+yT4mXoUk0a5rksZfSlTU50OMOGvkh+c+kyVtgj 5G/PTATXtWEZhRmxU3RrdOVMWfBRcxg7/+UGo6vSNqo6PudCmvlgz7Yt8gMxpCYAyWN4 UPvJNO6oSxEu6XNI6A/5ZTJAKu0xm/5QxAwBg4oXQCbgOf/fPvqL0M0C3cyDXNoGp5X6 4mecqsfzDG1ApX5fuuZfad+RdNMP++jCXx872rPiG3scYHcWD+NRZr1vR8Fb6t8REvt8 foUA== 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=Q/8HAAeS3hT4Bnex7q2APNTWH9x2zw557quwYCEIRaQ=; b=0sox44JS1jgu6SgX3mYrFfYienCTsNADEi5BXYRMEkiL3VLgt+CAlZN43STBDMtAfp 0OJUUXScI9b64sgUAbnq8a5vJXWSoy1UcINeRZk8MwbeG2NUmNWtv0qKazAlUDiqlGQZ UG92Mn1DV0C7NrhHmE59kBU7gp1JcQlN30S2ekUa9EJ9ywY7ktnTOqjFCMQdMyr1oZ/v pz1PEG84n2964V09vTqvtWbqx0CxPJebxbX3iGpqAhq3nKFuntexaYYDjqGJ+7QmT0Ww wb4bRkLOOjYcHlhzznvGWXMHR2QWga3mUdM/my1ASrmNp+Eht+2/7imVq0/usDHh9Z/3 0i+w== X-Gm-Message-State: AO0yUKW1FDtBBbDAxJPKvoywokTb0E3JVkVQunjDSdp/Y6KlPHNU1asw dC+w+YOkwNZJK0wRCtuC6LoeQ2YRD8vUBvb6qGs= X-Received: by 2002:a62:1bd2:0:b0:5ab:bf5d:a0d1 with SMTP id b201-20020a621bd2000000b005abbf5da0d1mr22325289pfb.7.1677476566772; Sun, 26 Feb 2023 21:42:46 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id d10-20020aa7868a000000b005cdc64a287dsm3317137pfo.115.2023.02.26.21.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 21:42:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, jcmvbkbc@gmail.com, kbastian@mail.uni-paderborn.de, ysato@users.sourceforge.jp, gaosong@loongson.cn, jiaxun.yang@flygoat.com, tsimpson@quicinc.com, ale@rev.ng, mrolnik@gmail.com, edgar.iglesias@gmail.com Subject: [PATCH 01/70] target/arm: Use rmode >= 0 for need_rmode Date: Sun, 26 Feb 2023 19:41:24 -1000 Message-Id: <20230227054233.390271-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230227054233.390271-1-richard.henderson@linaro.org> References: <20230227054233.390271-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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=unavailable 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 Initialize rmode to -1 instead of keeping two variables. This is already used elsewhere in translate-a64.c. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/arm/translate-a64.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index b1fa210d64..1c575de3e0 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -12133,7 +12133,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) int rn = extract32(insn, 5, 5); int rd = extract32(insn, 0, 5); bool need_fpstatus = false; - bool need_rmode = false; int rmode = -1; TCGv_i32 tcg_rmode; TCGv_ptr tcg_fpstatus; @@ -12283,7 +12282,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x7a: /* FCVTPU */ case 0x7b: /* FCVTZU */ need_fpstatus = true; - need_rmode = true; rmode = extract32(opcode, 5, 1) | (extract32(opcode, 0, 1) << 1); if (size == 3 && !is_q) { unallocated_encoding(s); @@ -12293,7 +12291,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x5c: /* FCVTAU */ case 0x1c: /* FCVTAS */ need_fpstatus = true; - need_rmode = true; rmode = FPROUNDING_TIEAWAY; if (size == 3 && !is_q) { unallocated_encoding(s); @@ -12352,7 +12349,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x19: /* FRINTM */ case 0x38: /* FRINTP */ case 0x39: /* FRINTZ */ - need_rmode = true; rmode = extract32(opcode, 5, 1) | (extract32(opcode, 0, 1) << 1); /* fall through */ case 0x59: /* FRINTX */ @@ -12364,7 +12360,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } break; case 0x58: /* FRINTA */ - need_rmode = true; rmode = FPROUNDING_TIEAWAY; need_fpstatus = true; if (size == 3 && !is_q) { @@ -12380,7 +12375,6 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) break; case 0x1e: /* FRINT32Z */ case 0x1f: /* FRINT64Z */ - need_rmode = true; rmode = FPROUNDING_ZERO; /* fall through */ case 0x5e: /* FRINT32X */ @@ -12406,12 +12400,12 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) return; } - if (need_fpstatus || need_rmode) { + if (need_fpstatus || rmode >= 0) { tcg_fpstatus = fpstatus_ptr(FPST_FPCR); } else { tcg_fpstatus = NULL; } - if (need_rmode) { + if (rmode >= 0) { tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); } else { @@ -12595,7 +12589,7 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) } clear_vec_high(s, is_q, rd); - if (need_rmode) { + if (tcg_rmode) { gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); } } @@ -12625,9 +12619,8 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) int pass; TCGv_i32 tcg_rmode = NULL; TCGv_ptr tcg_fpstatus = NULL; - bool need_rmode = false; bool need_fpst = true; - int rmode; + int rmode = -1; if (!dc_isar_feature(aa64_fp16, s)) { unallocated_encoding(s); @@ -12676,27 +12669,22 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) case 0x3f: /* FRECPX */ break; case 0x18: /* FRINTN */ - need_rmode = true; only_in_vector = true; rmode = FPROUNDING_TIEEVEN; break; case 0x19: /* FRINTM */ - need_rmode = true; only_in_vector = true; rmode = FPROUNDING_NEGINF; break; case 0x38: /* FRINTP */ - need_rmode = true; only_in_vector = true; rmode = FPROUNDING_POSINF; break; case 0x39: /* FRINTZ */ - need_rmode = true; only_in_vector = true; rmode = FPROUNDING_ZERO; break; case 0x58: /* FRINTA */ - need_rmode = true; only_in_vector = true; rmode = FPROUNDING_TIEAWAY; break; @@ -12706,43 +12694,33 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) /* current rounding mode */ break; case 0x1a: /* FCVTNS */ - need_rmode = true; rmode = FPROUNDING_TIEEVEN; break; case 0x1b: /* FCVTMS */ - need_rmode = true; rmode = FPROUNDING_NEGINF; break; case 0x1c: /* FCVTAS */ - need_rmode = true; rmode = FPROUNDING_TIEAWAY; break; case 0x3a: /* FCVTPS */ - need_rmode = true; rmode = FPROUNDING_POSINF; break; case 0x3b: /* FCVTZS */ - need_rmode = true; rmode = FPROUNDING_ZERO; break; case 0x5a: /* FCVTNU */ - need_rmode = true; rmode = FPROUNDING_TIEEVEN; break; case 0x5b: /* FCVTMU */ - need_rmode = true; rmode = FPROUNDING_NEGINF; break; case 0x5c: /* FCVTAU */ - need_rmode = true; rmode = FPROUNDING_TIEAWAY; break; case 0x7a: /* FCVTPU */ - need_rmode = true; rmode = FPROUNDING_POSINF; break; case 0x7b: /* FCVTZU */ - need_rmode = true; rmode = FPROUNDING_ZERO; break; case 0x2f: /* FABS */ @@ -12775,11 +12753,11 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) return; } - if (need_rmode || need_fpst) { + if (rmode >= 0 || need_fpst) { tcg_fpstatus = fpstatus_ptr(FPST_FPCR_F16); } - if (need_rmode) { + if (rmode >= 0) { tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rmode)); gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); }