From patchwork Sun Aug 30 02:31:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248716 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp2298628ilg; Sat, 29 Aug 2020 19:32:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMYJmvPVtnyHwTocKJ2OVP/7HjJv201Y7B6nQuevZk3qDE0o0O/Tl9/NHBuUBXfLSHbjd1 X-Received: by 2002:a25:ab87:: with SMTP id v7mr10950010ybi.216.1598754743993; Sat, 29 Aug 2020 19:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598754743; cv=none; d=google.com; s=arc-20160816; b=ab8xaCo1uZPmei9lMi7f0sA0nLNWKjwn+bYQUqAXTERr7FfC6XEzSQsCg82FKCHc5i V30JMhAl/+5jw3aZTMQpqHTUDgtNK7+tUwUVmJFj6FzozGb0mfeo51c82X2MmK/J4XWI ktoBdxfqj/oNlI9sHDY+PWnvYFhDTokkcvB5Xp+fS+O8CVLZsO2TkIav9SVpSV83/5oa BO0kmyQb468uS/H+byiOZAissNK2Ijx/JC7Go8c/eZ18e2QsUQhvSe4e9e3Agy4CEvn9 rivaEcZ2qXSwA8ur2gUpPUE5+r0dIyHzrPm7XpAzSk++ilHT6uHFxOUgSwSdVUNVhT6k yE6A== 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=MTrqYXi8FbHIZwqK1xJgmyOC3wH3/xVVNcE5HVvBvBI=; b=J8g5PWdOCGcWnKlTkTSSBTpwniClZ1JBEDKtccb8munfVGyDZ0X+KXUMxx1lZOelA9 179E1hs2ZgvaTIyEsgsx3dekshT+nghuhlYnB71qlLY8j6XTpQUI8w3nGRrKfaJGGh1F d1onCEm98Fh51b9WaebeKYOj/Dq9TurYRVCVNx+AuzB3gOKRdvzGirFIYHRMRrTJZohy BzpFPfACwrVL1oPSmBz0nZb0czIJjC7AA3iHnWw40CSLjJPav6wz3Fvgzk0foZtCrpno pHeUv3YhhPEzp9btG4EajZudinsyEk4DT9GArfFedplHb8rjl0OljEQhQu+r89Uqg3nF hAsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=s+HXbP9L; 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=fail (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 e206si3711364yba.161.2020.08.29.19.32.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 29 Aug 2020 19:32:23 -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=fail header.i=@linaro.org header.s=google header.b=s+HXbP9L; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCD8p-0002aq-Cb for patch@linaro.org; Sat, 29 Aug 2020 22:32:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCD8c-0002ZT-NN for qemu-devel@nongnu.org; Sat, 29 Aug 2020 22:32:10 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:43812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCD8a-0002XA-Rr for qemu-devel@nongnu.org; Sat, 29 Aug 2020 22:32:10 -0400 Received: by mail-pf1-x432.google.com with SMTP id y206so2663538pfb.10 for ; Sat, 29 Aug 2020 19:32:08 -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=MTrqYXi8FbHIZwqK1xJgmyOC3wH3/xVVNcE5HVvBvBI=; b=s+HXbP9Lk42Q6yAVfvWq57l0gic62WXNQuABmIuOYrEpc1MmS6P/al15IRyy7sHjTh h/FDj5Nvzbrkl5pwqNT0KHHrDwW8mB+iUJ8VkZ7TUfRoJA3DNtR/Y+M3yuz+kz4E4SM2 nVdCCEMG08VClHOBjS326sdzPXffY/XW50wc1nJoxT5h/WJR1KDwZgkr13aCYqJsxBwZ 7qOdpqnOrzKwHQh7jyBXavhZsCvtpdyODGwXUmYgS0do3A/biQwHV95qYg/JAWUG0BX/ DA/1dj7cGHM6rOJEaMizhYljWw3wsHct0yUAm8442VPHVWTS9w2Mcve6w3iR9lw8t1Br dGFg== 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=MTrqYXi8FbHIZwqK1xJgmyOC3wH3/xVVNcE5HVvBvBI=; b=bR1fCz57QVKqG6y6n5ZCrGObA+opYdvYC80gynKo+neUKugdrw2yO9SA1YfcDbjk7L sPRvnbEC74g/9u8O50MEfgaHFI+qzCZyiyTExFZ3L+ZQNNXtv0BnN6pcLVSY0XaNo89r ru45bSwiC7KcFp9VpteDIk+byaBvEXI3QfesutVTa/VhwIa3jYXIW4eCTiZOSJH8vMrX 6ZIo/monwxTicieajtI++er55mA5PCwDsnLatn5+uhD950jhQZ+M6tIp+kcP85/3Hcgx gv2K3cKGjotcrZDmxYAdsgdTDF65z1etaHI6RTF6ewsc5Jir7TM7NNZYAdy7NY8hqnYi 3dTw== X-Gm-Message-State: AOAM5310DF0wpebnXO3NmD50opzuzyKsc8rDVbwVvdfyFtlqnBwrwxgP Bo6JjIfUqO1OO/zwpi2vx4c6xNDpvDVfrg== X-Received: by 2002:a63:b64a:: with SMTP id v10mr3881682pgt.192.1598754727167; Sat, 29 Aug 2020 19:32:07 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id l23sm3546269pgt.16.2020.08.29.19.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Aug 2020 19:32:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 1/7] softfloat: Implement the full set of comparisons for float16 Date: Sat, 29 Aug 2020 19:31:57 -0700 Message-Id: <20200830023203.612312-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200830023203.612312-1-richard.henderson@linaro.org> References: <20200830023203.612312-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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: peter.maydell@linaro.org, Kito Cheng , =?utf-8?q?Alex_Benn=C3=A9e?= , Alistair Francis , Chih-Min Chao Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Kito Cheng Implement them in softfloat and remove the local versions in riscv. Signed-off-by: Kito Cheng Signed-off-by: Chih-Min Chao Acked-by: Alex Bennée Reviewed-by: Alistair Francis Message-Id: <1596102747-20226-2-git-send-email-chihmin.chao@sifive.com> Signed-off-by: Richard Henderson --- include/fpu/softfloat.h | 41 ++++++++++++++++++++++++++++++++++++ target/riscv/vector_helper.c | 25 ---------------------- 2 files changed, 41 insertions(+), 25 deletions(-) -- 2.25.1 diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 659218b5c7..573fce99bc 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -285,6 +285,47 @@ static inline float16 float16_set_sign(float16 a, int sign) return make_float16((float16_val(a) & 0x7fff) | (sign << 15)); } +static inline bool float16_eq(float16 a, float16 b, float_status *s) +{ + return float16_compare(a, b, s) == float_relation_equal; +} + +static inline bool float16_le(float16 a, float16 b, float_status *s) +{ + return float16_compare(a, b, s) <= float_relation_equal; +} + +static inline bool float16_lt(float16 a, float16 b, float_status *s) +{ + return float16_compare(a, b, s) < float_relation_equal; +} + +static inline bool float16_unordered(float16 a, float16 b, float_status *s) +{ + return float16_compare(a, b, s) == float_relation_unordered; +} + +static inline bool float16_eq_quiet(float16 a, float16 b, float_status *s) +{ + return float16_compare_quiet(a, b, s) == float_relation_equal; +} + +static inline bool float16_le_quiet(float16 a, float16 b, float_status *s) +{ + return float16_compare_quiet(a, b, s) <= float_relation_equal; +} + +static inline bool float16_lt_quiet(float16 a, float16 b, float_status *s) +{ + return float16_compare_quiet(a, b, s) < float_relation_equal; +} + +static inline bool float16_unordered_quiet(float16 a, float16 b, + float_status *s) +{ + return float16_compare_quiet(a, b, s) == float_relation_unordered; +} + #define float16_zero make_float16(0) #define float16_half make_float16(0x3800) #define float16_one make_float16(0x3c00) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 793af99067..a156573d28 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -3955,12 +3955,6 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \ } \ } -static bool float16_eq_quiet(uint16_t a, uint16_t b, float_status *s) -{ - FloatRelation compare = float16_compare_quiet(a, b, s); - return compare == float_relation_equal; -} - GEN_VEXT_CMP_VV_ENV(vmfeq_vv_h, uint16_t, H2, float16_eq_quiet) GEN_VEXT_CMP_VV_ENV(vmfeq_vv_w, uint32_t, H4, float32_eq_quiet) GEN_VEXT_CMP_VV_ENV(vmfeq_vv_d, uint64_t, H8, float64_eq_quiet) @@ -4017,12 +4011,6 @@ GEN_VEXT_CMP_VF(vmfne_vf_h, uint16_t, H2, vmfne16) GEN_VEXT_CMP_VF(vmfne_vf_w, uint32_t, H4, vmfne32) GEN_VEXT_CMP_VF(vmfne_vf_d, uint64_t, H8, vmfne64) -static bool float16_lt(uint16_t a, uint16_t b, float_status *s) -{ - FloatRelation compare = float16_compare(a, b, s); - return compare == float_relation_less; -} - GEN_VEXT_CMP_VV_ENV(vmflt_vv_h, uint16_t, H2, float16_lt) GEN_VEXT_CMP_VV_ENV(vmflt_vv_w, uint32_t, H4, float32_lt) GEN_VEXT_CMP_VV_ENV(vmflt_vv_d, uint64_t, H8, float64_lt) @@ -4030,13 +4018,6 @@ GEN_VEXT_CMP_VF(vmflt_vf_h, uint16_t, H2, float16_lt) GEN_VEXT_CMP_VF(vmflt_vf_w, uint32_t, H4, float32_lt) GEN_VEXT_CMP_VF(vmflt_vf_d, uint64_t, H8, float64_lt) -static bool float16_le(uint16_t a, uint16_t b, float_status *s) -{ - FloatRelation compare = float16_compare(a, b, s); - return compare == float_relation_less || - compare == float_relation_equal; -} - GEN_VEXT_CMP_VV_ENV(vmfle_vv_h, uint16_t, H2, float16_le) GEN_VEXT_CMP_VV_ENV(vmfle_vv_w, uint32_t, H4, float32_le) GEN_VEXT_CMP_VV_ENV(vmfle_vv_d, uint64_t, H8, float64_le) @@ -4091,12 +4072,6 @@ GEN_VEXT_CMP_VF(vmfge_vf_h, uint16_t, H2, vmfge16) GEN_VEXT_CMP_VF(vmfge_vf_w, uint32_t, H4, vmfge32) GEN_VEXT_CMP_VF(vmfge_vf_d, uint64_t, H8, vmfge64) -static bool float16_unordered_quiet(uint16_t a, uint16_t b, float_status *s) -{ - FloatRelation compare = float16_compare_quiet(a, b, s); - return compare == float_relation_unordered; -} - GEN_VEXT_CMP_VV_ENV(vmford_vv_h, uint16_t, H2, !float16_unordered_quiet) GEN_VEXT_CMP_VV_ENV(vmford_vv_w, uint32_t, H4, !float32_unordered_quiet) GEN_VEXT_CMP_VV_ENV(vmford_vv_d, uint64_t, H8, !float64_unordered_quiet)