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: 135674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:3f2:4152:657d with SMTP id x8csp519744vqo; Tue, 15 Aug 2023 08:50:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0GdtqR371b0PcmikEVL9P2cVQcEFkKlSJURxG58Oo+zx7P8KDxF5PD5Ec7RNY4qqfDNE3 X-Received: by 2002:a17:907:75e3:b0:97e:aace:b6bc with SMTP id jz3-20020a17090775e300b0097eaaceb6bcmr9834977ejc.53.1692114630670; Tue, 15 Aug 2023 08:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692114630; cv=none; d=google.com; s=arc-20160816; b=MEncRZu/QaSflaZpCSNiJ/ZePqj9hzLwuhewoKt2Jk6PqFHYgb3AH02uOfQWpu5zTt ZyxByVb86DpPnBN8v5kWQAlpXggOJSboEHh+Kx2HvLoaeW8kG8SqPs4VhztsojKHUlhd 3uVajqLP/b2o7y+FtoXipMJYBqxRgVwU9O4Dhe40l+sdSErtNVgOtDxYpOY77G4JCRt3 rOKsheoyMxyhJY6GB4hdNtUL4AiXtnztFzU6Wkr/+I+kQCB3KvJzuRT5H/fBX4iQssKL BZfGwlAdnZggoQ/VwcDwCu9KCzTOvd+t6C8akTvr6hPg17Hqda5hxhtpEGZ9jU6vsbMj 9C6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:subject:to:content-language:cc:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=OCBp//xz+XRWRIB7e+CU+rwS+Vk4esGeXaWGliMkT/g=; fh=ndvsZwFmZ+tyX7/x1KzctP6d5wHm+PTZEsDUSis59ys=; b=PZmWDz1rC6V/+HtAlMXfzge3QQRrZanKdmo1P5sit/tsYwTsYvYuMlwkoKCgX72Tr2 NmBUQCwzwysTzJzvijbilqZZHs/tshMng9nu3kxZunNeZUCkE0x9m0CEZyFxlpJKOS3f /KdEDB+W8+JTDOPNnqTU9D+0FTLt4RIwSdncujg2WtTy49KiRVAXfjOq+Bso5IjzCTTb RhZvA5hYwUh88g3LAVnq1bbnv3yc6II0i7F0Ak2zMenlW/+Kgz+jIPDS2F0G39JtBE4q fSpV6QBtuzc65IyZ2dlMs4aPJKdZTRkVOOfcH7DBP0CRhCQ1vBS77Gx6iCwIRYPZshVm rd+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=BCFBlgn3; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id se6-20020a170906ce4600b0099342fc2a87si9652778ejb.692.2023.08.15.08.50.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 08:50:30 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=BCFBlgn3; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8768E385B527 for ; Tue, 15 Aug 2023 15:50:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8768E385B527 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692114629; 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=BCFBlgn3jlgPhk6BD6ziis1yTeUUN3O/hRAKhT31N47TdbaxNj5ZM8QdPJ/KV3EdP /9kSIQ4fVxCBmqD8Q1txUf8Aqjf+0AiBg2p0JLjMPilPxfVM7Y3iLDYNWkrpFdNu9G VQn+25LO8t93IIKyrEAF0C0mt3wiiTiaokfyScTo= 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-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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774310790779107672 X-GMAIL-MSGID: 1774310790779107672 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 (); \ }