From patchwork Sat Sep 21 04:32:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174174 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp248123ill; Fri, 20 Sep 2019 21:33:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8EY0Mq3AnSHbGQzoEpkWPuYp2wFS7ojRPLeNtenEsngavy7o59PFw0dq4kAmfJl/BUk3R X-Received: by 2002:a17:906:5644:: with SMTP id v4mr21676772ejr.52.1569040428894; Fri, 20 Sep 2019 21:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569040428; cv=none; d=google.com; s=arc-20160816; b=rGtdSKM/OT0G7nu/tOzxvXP9JmuWcjCmq31PKdJ41ZcP7TeHhtdn6Pcs2laWD7dAgP Pprr9q25f9/b6sT5lKbPfb66lre/8Pl9KeVvQEgxq0c0ui9aen1FjLzz8Lk3dOgxVMxE i5zzRL4E8q5YdnwtXV+7iLWAHr0ccPOever1Xf+BH31seWIz33eSfxk29cpgmfz5P/Yr pk4+IIAelyQGDf3j9eJiCxmQ9AG8YuiJQMAm0KMVAzQidY2/6E271rhjQV/exJ3Iws6z LpT5bYLtdu725tecMlB2b9RK9MCGUsrlxwo3DuvyEx7rdeEdnqW5znBkaq2yRZbpzhHO hmqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=b9hvT4KM2rHH/vsMDbpWRcPXcj5oYyVhJm17BHsajzk=; b=fycWKC8zjRZnLt/77J627bsQm7V4Ee6rUDpvLyzNUI9oT/4meYgmm6FNYUNQJDBQVa TX+b76ir9GGOKq1h11HeA2Xy7tCzgZIVJNpIEn/svV4kQdHps6IFwFfx+LTcTOOaE5le 4Vy+TS7cSeLYhyMuCdE+z91J6+zOlRRJRC/QY6oXKwV/qaHqHiPBZo656myoHHoD/Yoa 9mWTiYZunNC4VyhzEO16L72zl59jflfK7MKSI00fyMUbbDCbwlUtxGUTDyaH4e1Q2yFT 7VCtje2wNudyc7A3byE5KCb8PdH1I2/1OPpQKNG+OlwaXFPTbhEr55pAamKqfKSAcVqt 1eAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oLFJL9GX; 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 a7si2096674ejx.258.2019.09.20.21.33.48 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Sep 2019 21:33:48 -0700 (PDT) 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=oLFJL9GX; 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]:38126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBX5f-0003KO-Og for patch@linaro.org; Sat, 21 Sep 2019 00:33:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40463) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBX54-0003JE-Pt for qemu-devel@nongnu.org; Sat, 21 Sep 2019 00:33:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBX4x-0006OQ-Ja for qemu-devel@nongnu.org; Sat, 21 Sep 2019 00:33:07 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:36626) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBX4w-0006N3-MJ for qemu-devel@nongnu.org; Sat, 21 Sep 2019 00:33:03 -0400 Received: by mail-pl1-x644.google.com with SMTP id f19so4150458plr.3 for ; Fri, 20 Sep 2019 21:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b9hvT4KM2rHH/vsMDbpWRcPXcj5oYyVhJm17BHsajzk=; b=oLFJL9GXQvvNWFVixLW67J3Rg01HY92uuAArV94f51S6MObOMeWnJXllwd+xEsL2vO PnKCY5AMAqA++FVwJr+bHYu9nxEjIJX0i61zNr15WN2ep3jWB5BCLbZBcs1AAfiTdmrl b2N5vD8FF3OdLQ/XwdRev7fVcE9K0Xn2S7CHwgr046a2fOApext+cZLV0ql9TOC9Rnsd +XdnzVWNR9N/dnUORZr3ajHTRQOopmBDGrSnnrZLPGKmmE5XugDXCfoQ+pH81iKEgBFC saWGkZ6gihQUFbv2P2S2Hpn/0HJWTd1qiXklcbnzVYa1DZnch42vrsewApUC9jLiXiTh xfqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b9hvT4KM2rHH/vsMDbpWRcPXcj5oYyVhJm17BHsajzk=; b=brzTrqsA9PqRNmv2D92FqrKiwq1oLUa5jRN8bc2XFizoWzSe0RiRP62c3D/JSLq8ek 9B5wq2FT1iEBgAfTDma9MLh1x1kB5zHW/jZ4zfFlEHxjaRQQeJuL58235ILmZG6Op10h d2/CzFiPimU3BQUQBjWPqu8TjDxo9hatTj5RGN656N8/8mZM9v8N9djNqpKYP1r7kz3R SOOSocOakTKfmKk9Y4c6/Ixi1aYj/iziiqApHfs609Nw4VmjxgOHFGCPRvKaMqXRanyh fd4/DtTq9UoIuih/pprHsYQg0U82Km98ORY5uNeylZCfyaN5T7ZjhllPaK1/mgaHHLBk tBgA== X-Gm-Message-State: APjAAAXHty8sai8IpH5hNzKnz1RoMhaWDInYx0YFot7FGlzukydrNfB1 wvD2ThRA4fLIoVWTU0E6RMwzL0Quv/U= X-Received: by 2002:a17:902:8d98:: with SMTP id v24mr18471880plo.265.1569040380988; Fri, 20 Sep 2019 21:33:00 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id 193sm4179986pfc.59.2019.09.20.21.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Sep 2019 21:33:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/7] target/alpha: Use array for FPCR_DYN conversion Date: Fri, 20 Sep 2019 21:32:50 -0700 Message-Id: <20190921043256.4575-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190921043256.4575-1-richard.henderson@linaro.org> References: <20190921043256.4575-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is a bit more straight-forward than using a switch statement. No functional change. Signed-off-by: Richard Henderson --- target/alpha/helper.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) -- 2.17.1 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée diff --git a/target/alpha/helper.c b/target/alpha/helper.c index 19cda0a2db..6c1703682e 100644 --- a/target/alpha/helper.c +++ b/target/alpha/helper.c @@ -36,6 +36,13 @@ uint64_t cpu_alpha_load_fpcr(CPUAlphaState *env) void cpu_alpha_store_fpcr(CPUAlphaState *env, uint64_t val) { + static const uint8_t rm_map[] = { + [FPCR_DYN_NORMAL >> FPCR_DYN_SHIFT] = float_round_nearest_even, + [FPCR_DYN_CHOPPED >> FPCR_DYN_SHIFT] = float_round_to_zero, + [FPCR_DYN_MINUS >> FPCR_DYN_SHIFT] = float_round_down, + [FPCR_DYN_PLUS >> FPCR_DYN_SHIFT] = float_round_up, + }; + uint32_t fpcr = val >> 32; uint32_t t = 0; @@ -48,22 +55,7 @@ void cpu_alpha_store_fpcr(CPUAlphaState *env, uint64_t val) env->fpcr = fpcr; env->fpcr_exc_enable = ~t & FPCR_STATUS_MASK; - switch (fpcr & FPCR_DYN_MASK) { - case FPCR_DYN_NORMAL: - default: - t = float_round_nearest_even; - break; - case FPCR_DYN_CHOPPED: - t = float_round_to_zero; - break; - case FPCR_DYN_MINUS: - t = float_round_down; - break; - case FPCR_DYN_PLUS: - t = float_round_up; - break; - } - env->fpcr_dyn_round = t; + env->fpcr_dyn_round = rm_map[(fpcr & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT]; env->fpcr_flush_to_zero = (fpcr & FPCR_UNFD) && (fpcr & FPCR_UNDZ); env->fp_status.flush_inputs_to_zero = (fpcr & FPCR_DNZ) != 0;