From patchwork Tue May 25 22:58:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 447348 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp4701227jac; Tue, 25 May 2021 16:01:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUidcKAlQSgkKdU5z3hfmbjpdS2CkSWJJi4Ilyg30ZnvYFO1jQ0nfFyTsiWqqB5ht+V0F6 X-Received: by 2002:aa7:db93:: with SMTP id u19mr34252302edt.227.1621983686885; Tue, 25 May 2021 16:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621983686; cv=none; d=google.com; s=arc-20160816; b=nZA2r3UpZrJtF/DiBkdtdMocGodhHdjS+2jRS4DmmPwrlDGJqAnno5QJvT/tVuEWZJ PIvIth/QBAkjx+1xbkb1m0cpS77E53peAlhodJUhkUc3ukgDO4d2Hha9rvzbHby+wpVn IoNyIxhT0f/v/O4vPt9mx1H5oNmZHlNfJAHrWW+/46Lj1TAAQ65DOBPw2aNVZwXgPIPs NQnYkH9Qfjmz5Fug8E8b8IPM4wewvhkQnO1sKZhBHxPIfryI/TrQEszvIB8rypGktNAy M/xthV2qFXC4Z6Yqiqtu4o8gRVe9xdIRKVmmT2gYWpRdN/cck3UwvmqlZPS6j/1R2XcY mLjw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=inUd/h721Ne/1vYYmFZwK9UzqSXV6+upNZJZePrYay4=; b=SS/d12H+jURQdUYzADoXViUUzG7fs0k0YNlKSTmlB3z/HYRkRGsn0XqAhlxiJfoSNI JIuztmTvT521cd3w5IAs+N3sYFGJjw40zLHyad9RiLfSbfY1BSsenD2rOEvODkFQprUm BLwF2tvFpBhzV6V6upF5NvhWoOrrC6CEoufIT1vCYsDYJUvSYvkzhUn08adg1NMo+zF5 CdqktvdFgEeXWfzoXhaI+uMMzIAD8v4FZVMWdPCYVSW5WEpbqPA0pMoCEbyha26ibrtA LTY+n44oSRb5CM3nyXUTTZxVR4QAmt96OKDKqjRbD+p/n/cOJXoDTOr50ORvVLCkn5Bm s2Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kL1vkKxm; 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 ay17si17269658edb.128.2021.05.25.16.01.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 May 2021 16:01:26 -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=kL1vkKxm; 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]:37890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llg3B-0001g7-Ta for patch@linaro.org; Tue, 25 May 2021 19:01:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llg0T-0002gD-Dd for qemu-devel@nongnu.org; Tue, 25 May 2021 18:58:37 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:43798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llg0F-0004oR-4M for qemu-devel@nongnu.org; Tue, 25 May 2021 18:58:37 -0400 Received: by mail-pf1-x429.google.com with SMTP id d78so23904593pfd.10 for ; Tue, 25 May 2021 15:58:22 -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=inUd/h721Ne/1vYYmFZwK9UzqSXV6+upNZJZePrYay4=; b=kL1vkKxmskvj6qxDLY8hIJ4NVkoE5oaGfjbkYvLOufs7Thtk8meRcnifD9J0Iwcc8w nrhL8OPEnLrHYW4JXj12TaKF3LQlCpDFjpk19HbleG6cyx3WwZTCc/0BgsDaK8zpW9rW FqWenm6jLPDerA8czIVjTk94szmN8pi6ZjDNPrrT5UlGtn1Yw0Jqvjkh7Hz2C9sewiSL 1l1osvFEQ9+FS4vx2fYxJzw7QZ0ItEp7E6xj+SH3LmdfyuWd5+AFzikss1q1Vff30438 pcGS9UNtU0uxv+EKt26dHLojff+8z78fVybOp0pm3YJETUxAIRiRcc/a5SMgc9ww1RxA Tw3Q== 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=inUd/h721Ne/1vYYmFZwK9UzqSXV6+upNZJZePrYay4=; b=OnE8aipQCwk4PR8Pnrb8Viy8bt28a1Dr0apGb5gir2gX7HwAo89xrfYRpozgmCsLqi tl7SJn3CN+5RJkx3BjbqtqX+iNTyitIfplMU2jDeDG6Z6l4WC0nSGsOGnCXk40p1TTh4 0oWpGNFbud5OLTGurshjAxMr+rhTv9k7BWiY1TmNgWOixnXFBIrxX1ZplEP6oy0iIqX8 rtxYgXv6pNaaiVjyvyXOyorFzH9w5wIQSYOSN6BL43CDH+ZvDcqBvfbUEwA0sqlY/o1r TObrLcsWPFKbUMpojSwEBDTYj01WCT451/+Awkfx5di0bvdPx7jN4Sy2R2XeXUJElUT3 c+bw== X-Gm-Message-State: AOAM532obiWHACSTeUGAGN0t0/fvn25rCrxzLVDbEBQ4hSu89LFaFcCw 9yLBHSJkENo/9cO19Hj1wPIBII71PXZE4w== X-Received: by 2002:a05:6a00:cd4:b029:2e1:b937:77e8 with SMTP id b20-20020a056a000cd4b02902e1b93777e8mr31316925pfv.43.1621983501679; Tue, 25 May 2021 15:58:21 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id l6sm1669928pjf.28.2021.05.25.15.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 15:58:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 05/12] softfpu: Add float_round_to_odd_inf Date: Tue, 25 May 2021 15:58:10 -0700 Message-Id: <20210525225817.400336-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525225817.400336-1-richard.henderson@linaro.org> References: <20210525225817.400336-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For Arm BFDOT and BFMMLA, we need a version of round-to-odd that overflows to infinity, instead of the max normal number. Cc: Alex Bennée Signed-off-by: Richard Henderson --- include/fpu/softfloat-types.h | 4 +++- fpu/softfloat-parts.c.inc | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index 8a3f20fae9..3b757c3d6a 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -134,8 +134,10 @@ typedef enum __attribute__((__packed__)) { float_round_up = 2, float_round_to_zero = 3, float_round_ties_away = 4, - /* Not an IEEE rounding mode: round to the closest odd mantissa value */ + /* Not an IEEE rounding mode: round to closest odd, overflow to max */ float_round_to_odd = 5, + /* Not an IEEE rounding mode: round to closest odd, overflow to inf */ + float_round_to_odd_inf = 6, } FloatRoundMode; /* diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index a897a5a743..7f69da1d8f 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -176,13 +176,12 @@ static void partsN(uncanon)(FloatPartsN *p, float_status *s, g_assert_not_reached(); } + overflow_norm = false; switch (s->float_rounding_mode) { case float_round_nearest_even: - overflow_norm = false; inc = ((p->frac_lo & roundeven_mask) != frac_lsbm1 ? frac_lsbm1 : 0); break; case float_round_ties_away: - overflow_norm = false; inc = frac_lsbm1; break; case float_round_to_zero: @@ -199,6 +198,8 @@ static void partsN(uncanon)(FloatPartsN *p, float_status *s, break; case float_round_to_odd: overflow_norm = true; + /* fall through */ + case float_round_to_odd_inf: inc = p->frac_lo & frac_lsb ? 0 : round_mask; break; default: @@ -259,6 +260,7 @@ static void partsN(uncanon)(FloatPartsN *p, float_status *s, ? frac_lsbm1 : 0); break; case float_round_to_odd: + case float_round_to_odd_inf: inc = p->frac_lo & frac_lsb ? 0 : round_mask; break; default: