From patchwork Tue Aug 15 15:49:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Dapp X-Patchwork-Id: 1821430 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=eH3ePkrF; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQG1Y2gNQz1yfS for ; Wed, 16 Aug 2023 01:50:08 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 311893856975 for ; Tue, 15 Aug 2023 15:50:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 311893856975 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692114606; bh=OCBp//xz+XRWRIB7e+CU+rwS+Vk4esGeXaWGliMkT/g=; h=Date:Cc:To:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=eH3ePkrF00qlM+4vxy33tntX4yu9nE7epaXLrQkxSAbggT5kVnHeJ61JLPRLmyE3e PSuiy+2Ws8LJ349n6Z4/Gf8RKhRew1LyMK9n1A9nHZncAbvhWscMjN1gwc4DdPCp8D 2C0h+sOu98t3jqzORqplGkjQTVAPBDWYnlfI+CUw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id DA4B73857357 for ; Tue, 15 Aug 2023 15:49:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DA4B73857357 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-523b066d7ceso6929437a12.2 for ; Tue, 15 Aug 2023 08:49:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692114583; x=1692719383; h=content-transfer-encoding:subject:from:to:content-language:cc :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=OCBp//xz+XRWRIB7e+CU+rwS+Vk4esGeXaWGliMkT/g=; b=fvaO92g0g3O1hbFrjkd9e5uwbyr0jhHpjPuOHXlIHHMCubw4TJo4v4HkFLkolD4vhr RDyyeAPP/fRLi32VdS0B1o5aVTF2SMyDyIohPdMxrFrj/WNvpxCbQnqzfu2PsxxYhpRa w0JZmJHDuzFzEhqiVzk/FyKJdQ0yacB7dIUc9ortXu8WlWiyDqFrtJ4FMENQqpyi+aVh Lj9xCSPSK4P8kSnCZkZzGbuQci/lEYl/2pfXz4JFY91X2TlKHdk08ZiSpkPS45kJeO0i XPOXdG0rOZTYkKXfpdLL208H5N1i9ijKIbAGduusmZj1rOLfxvyGiq8jDYIc14bTI2lG yPfA== X-Gm-Message-State: AOJu0YzS5hmv6fNMQFuI2nrpOhkoBoSZVQm/VUpWBsEUZYAXkVSzKogR 6cunyP99OWTw5dnx338CqjSB8YQx9x8= X-Google-Smtp-Source: AGHT+IERxW2XTaq+M8wymp58egTfueNypxGf9qWYD5Dp33fx41sq6+Mt3/p2FCp4OUGhov4iyaHKEw== X-Received: by 2002:a17:906:21a:b0:994:4ebe:7a6d with SMTP id 26-20020a170906021a00b009944ebe7a6dmr10353367ejd.19.1692114583089; Tue, 15 Aug 2023 08:49:43 -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 ov14-20020a170906fc0e00b0099290e2c163sm7169279ejb.204.2023.08.15.08.49.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Aug 2023 08:49:42 -0700 (PDT) Message-ID: Date: Tue, 15 Aug 2023 17:49:42 +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 Content-Language: en-US To: gcc-patches , palmer , Kito Cheng , jeffreyalaw , "juzhe.zhong@rivai.ai" Subject: [PATCH] RISC-V: Fix reduc_strict_run-1 test case. X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Robin Dapp via Gcc-patches From: Robin Dapp Reply-To: Robin Dapp Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, this patch changes the equality check for the reduc_strict_run-1 testcase from == to fabs () < EPS. The FAIL only occurs with _Float16 but I'd argue approximate equality is preferable for all float modes. Regards Robin gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/reduc/reduc_strict_run-1.c: Check float equality with fabs < EPS. --- .../riscv/rvv/autovec/reduc/reduc_strict_run-1.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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..93efe2c4333 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 @@ -2,6 +2,9 @@ /* { dg-additional-options "--param=riscv-autovec-preference=scalable -fno-vect-cost-model" } */ #include "reduc_strict-1.c" +#include + +#define EPS 1e-2 #define TEST_REDUC_PLUS(TYPE) \ { \ @@ -10,14 +13,14 @@ TYPE r = 0, q = 3; \ for (int i = 0; i < NUM_ELEMS (TYPE); i++) \ { \ - a[i] = (i * 0.1) * (i & 1 ? 1 : -1); \ - b[i] = (i * 0.3) * (i & 1 ? 1 : -1); \ + a[i] = (i * 0.01) * (i & 1 ? 1 : -1); \ + b[i] = (i * 0.03) * (i & 1 ? 1 : -1); \ r += a[i]; \ q -= b[i]; \ asm volatile ("" ::: "memory"); \ } \ TYPE res = reduc_plus_##TYPE (a, b); \ - if (res != r * q) \ + if (fabs (res - r * q) > EPS) \ __builtin_abort (); \ }