From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14387C43618 for ; Fri, 23 Apr 2021 17:00:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3F8561006 for ; Fri, 23 Apr 2021 17:00:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3F8561006 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZzA6-0005Bv-Rz for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 13:00:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZz4b-0008NO-78 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 12:54:33 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:41736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZz4S-0008BU-7p for qemu-devel@nongnu.org; Fri, 23 Apr 2021 12:54:33 -0400 Received: by mail-pl1-x62f.google.com with SMTP id e2so21189111plh.8 for ; Fri, 23 Apr 2021 09:54:18 -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 :mime-version:content-transfer-encoding; bh=o32ekfL5QFhqhaXYyN+uFzVuIh/l+z5aZIxS+8hP4yY=; b=gOuGbMbmFNaIRjnyhhfjad3JYE57M2fB0AgjuztoDAuvuLllwEaKZhMNWCY1o9AfPs pt8oPlQEh05aJJ/x4XC2HqmblZIA740/wOpPm2ohvrsJUc4uqrQGiSHqWvzw8pr1zyRS h4gVgvk/LGHfpVy//9xMZi5tn5ZPGB5WtTyybvqxreDpOK1CzlyBrXrHzm31NAmOJG9F 9Ap7pP5UGjGVl+8Yg6LF6JwGFKYkP2W9OLuzkUlmPJ5btVq6B6FFkqmoF84N44+rFB52 ERct4m3uOYzMujLUcoNkj788SQlixBAmX3jvB3EP/K5xMm6rK3y9U+1brke51QyVH9r1 i2wA== 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:mime-version:content-transfer-encoding; bh=o32ekfL5QFhqhaXYyN+uFzVuIh/l+z5aZIxS+8hP4yY=; b=JT+KgVP5O/Tw7/RDYYj3F/86kMDTJm9iTZD8GZLS2xHcXkipkchk4KKeIAecWiTEb9 /oGWtwFE8KwhCSF0LDAgwW3SW90DA32La5aNd7n3e/kvquEdCPXlPCb1XSlo4NZ35BOO 6jJgfzPe7dpKyu/Bai6pvef6zqnTKrlbsQOo8Of8VGrbbDxgCxF945p+4Pdozm74xjgB mC1bjowpJf7igrG4DayD5JLEGClP0waH12D4q/6HNc/jxuQQfaIMzAqvgdV1+EKn2KvN vzqiKPfvZ2uBDqRmXB/Zea4UyDhRaflMRWR6wV1zpeXjprygFNMfnLzpM5noVjrBqM/J E1Cg== X-Gm-Message-State: AOAM531dsR53uQWevVxac6/edFIzHgBDw1el2vvBMjas+rbE90NiR/FC 3eaE8z/5Xf3PeD+3q8Y4OJKRFV+lXi2IDQ== X-Google-Smtp-Source: ABdhPJx2uz5d03OWF50PdOBsY9ninEDTPpQpkErAHdO3nWs10kKtKuT2QA+Eft46m0N0tSY1SXGKZA== X-Received: by 2002:a17:902:361:b029:e9:8392:7abd with SMTP id 88-20020a1709020361b02900e983927abdmr4670089pld.8.1619196857454; Fri, 23 Apr 2021 09:54:17 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id q5sm4918151pfu.5.2021.04.23.09.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Apr 2021 09:54:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 4/4] linux-user/arm: Simplify accumulating and raising fpa11 exceptions Date: Fri, 23 Apr 2021 09:54:13 -0700 Message-Id: <20210423165413.338259-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210423165413.338259-1-richard.henderson@linaro.org> References: <20210423165413.338259-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use bit masking instead of an if tree. Signed-off-by: Richard Henderson --- linux-user/arm/cpu_loop.c | 50 ++++++++++++++------------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 5f61d25717..69632d15be 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -228,6 +228,7 @@ static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) { TaskState *ts = env_cpu(env)->opaque; int rc = EmulateAll(opcode, &ts->fpa, env); + int raise, enabled; if (rc == 0) { /* Illegal instruction */ @@ -240,28 +241,31 @@ static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) } /* FP exception */ - int arm_fpe = 0; + rc = -rc; + raise = 0; /* Translate softfloat flags to FPSR flags */ - if (-rc & float_flag_invalid) { - arm_fpe |= BIT_IOC; + if (rc & float_flag_invalid) { + raise |= BIT_IOC; } - if (-rc & float_flag_divbyzero) { - arm_fpe |= BIT_DZC; + if (rc & float_flag_divbyzero) { + raise |= BIT_DZC; } - if (-rc & float_flag_overflow) { - arm_fpe |= BIT_OFC; + if (rc & float_flag_overflow) { + raise |= BIT_OFC; } - if (-rc & float_flag_underflow) { - arm_fpe |= BIT_UFC; + if (rc & float_flag_underflow) { + raise |= BIT_UFC; } - if (-rc & float_flag_inexact) { - arm_fpe |= BIT_IXC; + if (rc & float_flag_inexact) { + raise |= BIT_IXC; } - /* Exception enabled? */ - FPSR fpsr = ts->fpa.fpsr; - if (fpsr & (arm_fpe << 16)) { + /* Accumulate unenabled exceptions */ + enabled = ts->fpa.fpsr >> 16; + ts->fpa.fpsr |= raise & ~enabled; + + if (raise & enabled) { target_siginfo_t info = { }; /* @@ -275,24 +279,6 @@ static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) } else { env->regs[15] += 4; } - - /* Accumulate unenabled exceptions */ - if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC)) { - fpsr |= BIT_IXC; - } - if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC)) { - fpsr |= BIT_UFC; - } - if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC)) { - fpsr |= BIT_OFC; - } - if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC)) { - fpsr |= BIT_DZC; - } - if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC)) { - fpsr |= BIT_IOC; - } - ts->fpa.fpsr = fpsr; return true; } -- 2.25.1