From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id ECB9E3858D33 for ; Wed, 16 Aug 2023 13:50:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECB9E3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5259cf39154so410043a12.2 for ; Wed, 16 Aug 2023 06:50:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692193843; x=1692798643; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=A1/UqyUgdRKfOTANiE6IOz2eBf5V/oXDJyGVYtKix98=; b=P3GrCIETsO8oodkLv8Zn4viby1qN6tHx8btEvq8hEooU0tq3IyqP7mYhig5FiiyZ70 h7eE0FpWmFHSIL0dktxJQmYRy2yXm4HX/F1WoNVAONXTRsHf3hzUV7GpBxng50/DWbY+ EgeHArmDLFeJojt5h/2O9O7rblxH+B5cAbB8PxUWVmMAZh76jIZcOlZr06z5F+3AAykS Oerp0B577PZohVlWH+d+joLLzcrlmlHz1VG3vXg5/wRsiOUTAetgvTI/E1bjDskfcWVE z1KfAvHoEb5UEihxa1BFjHBhZOTJf3U9h6hIlCneSLbz5C5wKsfCzIUNqTl4GYXUotei bGUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692193843; x=1692798643; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=A1/UqyUgdRKfOTANiE6IOz2eBf5V/oXDJyGVYtKix98=; b=WVF+45c1wgPQ0DF+6Yx9JOD9B2H8hLTOI3jXFMumQb6dBSP1df8hRubvImhsUEFdGP bUnXZvFwxIiADYJQTsElZWxg5Rg0nMIkRZWYf6dldhmVJGkIqhSudypespZAe6V6ifS6 txP542n9WJ8+yAF9e0zsKsCsuLW1ZUwSQ/YdG2k8ocT4OO4uPj4azN3IzHerhaurRqcy IvfEC1QRzpi6V8p6qusSCujTlngckkWMM4mkv9zSq725PegMGZfByRn61cy574OEYzMn 01X2tKe2Wh4o+VkQMDwz2RvPLrzzz7u2NFe+ieXvwxpqA1OUx7wRDX20poaY97nkQxmm rcHg== X-Gm-Message-State: AOJu0YwkOh9WfUfnG3Htn6CpWlLIg4ke1KBvrwOc67yK6D2JRbR5OIrA 0vmpP8mz6LyEzONd5PNozfE= X-Google-Smtp-Source: AGHT+IGbFP2k1avwQzniodiyYMgX2f0LgI8PynSs4b40FYTzf2TnW433kBkrG3yQIUBk2xQCQMgSPQ== X-Received: by 2002:aa7:d80e:0:b0:525:528d:836f with SMTP id v14-20020aa7d80e000000b00525528d836fmr1879162edq.18.1692193842647; Wed, 16 Aug 2023 06:50:42 -0700 (PDT) Received: from [192.168.1.23] (ip-046-005-130-086.um12.pools.vodafone-ip.de. [46.5.130.86]) by smtp.gmail.com with ESMTPSA id u14-20020aa7d98e000000b005231e3d89efsm8406216eds.31.2023.08.16.06.50.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Aug 2023 06:50:42 -0700 (PDT) Message-ID: <053a66e1-5d7d-57db-3b51-e5514c18a7f1@gmail.com> Date: Wed, 16 Aug 2023 15:50:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: rdapp.gcc@gmail.com Subject: Re: [PATCH] RISC-V: Fix reduc_strict_run-1 test case. Content-Language: en-US To: Jeff Law , "juzhe.zhong@rivai.ai" , gcc-patches , palmer , "kito.cheng" References: <2c442b39-f76f-47ad-d1ee-48ee5f3976d6@gmail.com> <3504783322052EC6+2023081609211024328811@rivai.ai> From: Robin Dapp In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > But if it's a float16 precision issue then I would have expected both > the computations for the lhs and rhs values to have suffered > similarly. Yeah, right. I didn't look closely enough. The problem is not the reduction but the additional return-value conversion that is omitted when calculating the reference value inline. The attached is simpler and does the trick. Regards Robin Subject: [PATCH v2] RISC-V: Fix reduc_strict_run-1 test case. This patch fixes the reduc_strict_run-1 testcase by converting the reference value to double and back to the tested type. Without that omitted the implicit return-value conversion and would produce a different result for _Float16. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/reduc/reduc_strict_run-1.c: Perform type -> double -> type conversion for reference value. --- .../gcc.target/riscv/rvv/autovec/reduc/reduc_strict_run-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/reduc/reduc_strict_run-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/reduc/reduc_strict_run-1.c index 516be97e9eb..d5a544b1cc9 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/reduc/reduc_strict_run-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/reduc/reduc_strict_run-1.c @@ -17,7 +17,7 @@ asm volatile ("" ::: "memory"); \ } \ TYPE res = reduc_plus_##TYPE (a, b); \ - if (res != r * q) \ + if (res != (TYPE)(double)(r * q)) \ __builtin_abort (); \ } -- 2.41.0