From patchwork Thu Apr 28 15:55:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 53320 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 07DD93898C72 for ; Thu, 28 Apr 2022 15:58:49 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 8A7A23888C48 for ; Thu, 28 Apr 2022 15:58:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A7A23888C48 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pj1-x102b.google.com with SMTP id d23-20020a17090a115700b001d2bde6c234so6086417pje.1 for ; Thu, 28 Apr 2022 08:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:mime-version:content-transfer-encoding:cc :from:to; bh=Usmh2JVsdnXzoYmrEEIVxR3UMDuAGIQMFNnOuTV97BI=; b=lELQxiv/bl1Us0Rl9SQLaGRivewyPUyC683h1ZVmqynXVEdSXav1SlglOja0SJHkbN 82ce/Ak5ysiPVt37Va+LBsJbD9aWlFaKQknRwfPe7H8DwPJI3ndzHzf/FsGUbO15Bc0y KbDmjtWLrESqyZyoeUh77yE/7aBcqpLQt9dMeUExALs/dz2wT1EZoq5/x58h+t+TGg2Q 8RZ7/T4GWVF1wnMhahciA2kb3kajRMxIfTfm6IFJ/VcBqAy+hd/nUJwOgQr0KWdtHXqK xmmlsWsXvOvQqtbfF3lH8z9nY1Fl08jQZnj/OGkmRthUp5BouBETj43rFDndf2p0ggAO RDiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:mime-version :content-transfer-encoding:cc:from:to; bh=Usmh2JVsdnXzoYmrEEIVxR3UMDuAGIQMFNnOuTV97BI=; b=W7ZGy3zjFL14j3eiE8EXAL+0hHZtP+HAkgNqao7ADiP37eSmZoVmNqmyyK2kjO2YX6 kdA8CtG+wT620OJ3gfwVGwy4Y59yUdYQmYjiP9HRFr6vrhZhlu0UNdpyL549qWv6glWh dkjdhhUqtNzOTEaojoAFaUmKmfxjsEie+w/gj8b621kroMTl0ArN4gyE/KvPqzceawPn z04DsAm5AZsKk1SNN8GHQLpxlZCxdfG2GEL8YcgxLDzqbTz0tPq0vu2EaamkK75OjmMJ k0H/E0Zrp0jfcI/Tvp1EuhJmy1wKn0rwnkBEMJOmDxWoEihHk/IF5qzW5Ehp+YDSAwkF dsuA== X-Gm-Message-State: AOAM533ubvsCOZkPpczoiLEaA+eSg76Aq7YbrA/OxSCdTErZUGhITT/m Bzvr7a3VWFKfcIgQnk6efEDym7NXJHD/HA== X-Google-Smtp-Source: ABdhPJwMhETTSevgLzPWaT+ZasdBGUwxIbVXI6lc0u82iUKBfbo08ICQM8Jxtu9o5UOvP1LinojWqQ== X-Received: by 2002:a17:902:ce86:b0:15d:1950:835c with SMTP id f6-20020a170902ce8600b0015d1950835cmr20196558plg.52.1651161509913; Thu, 28 Apr 2022 08:58:29 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id s15-20020a63f04f000000b003c14af50613sm3334714pgj.43.2022.04.28.08.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 08:58:29 -0700 (PDT) Subject: [PATCH] Disable tests that require fesetround() on platforms without it Date: Thu, 28 Apr 2022 08:55:14 -0700 Message-Id: <20220428155514.27063-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 From: Palmer Dabbelt To: gcc-patches@gcc.gnu.org X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Some tests check for fenv and then proceed to use fesetround() directly, but some platforms (at least RISC-V soft-float) have fenv but don't support rounding modes. This adds a DG check that fesetround() actually functions, which is then used by all the tests that call fesetround() explicitly. gcc/testsuite/ChangeLog * lib/target-supports.exp (check_effective_target_fenv_setround): New function. * gcc.dg/torture/fp-double-convert-float-1.c: Check fenv_fesetround. * gcc.dg/torture/fp-int-convert-float128-timode-3.c: Likewise. * gcc.dg/torture/fp-int-convert-timode-2.c: Likewise. * gcc.dg/torture/fp-int-convert-timode-3.c: Likewise. * gcc.dg/torture/fp-int-convert-timode-4.c: Likewise. * gcc.dg/torture/fp-uint64-convert-double-1.c: Likewise. * gcc.dg/torture/fp-uint64-convert-double-2.c: Likewise. --- I started getting a bunch of atomic-related failures with this patch, but they persist when I've gone back and disabled it so I'm pretty sure it's something in my environment. Without this patch I get a bunch of failures on the RISC-V soft float targets, I haven't tried anywhere else. --- .../gcc.dg/torture/fp-double-convert-float-1.c | 2 +- .../torture/fp-int-convert-float128-timode-3.c | 2 +- .../gcc.dg/torture/fp-int-convert-timode-2.c | 2 +- .../gcc.dg/torture/fp-int-convert-timode-3.c | 2 +- .../gcc.dg/torture/fp-int-convert-timode-4.c | 2 +- .../torture/fp-uint64-convert-double-1.c | 2 +- .../torture/fp-uint64-convert-double-2.c | 2 +- gcc/testsuite/lib/target-supports.exp | 18 ++++++++++++++++++ 8 files changed, 25 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/gcc.dg/torture/fp-double-convert-float-1.c b/gcc/testsuite/gcc.dg/torture/fp-double-convert-float-1.c index ec23274ea98..656e5c345e7 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-double-convert-float-1.c +++ b/gcc/testsuite/gcc.dg/torture/fp-double-convert-float-1.c @@ -1,6 +1,6 @@ /* PR57245 */ /* { dg-do run } */ -/* { dg-require-effective-target fenv } */ +/* { dg-require-effective-target fenv_setround } */ /* { dg-additional-options "-frounding-math" } */ #include diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c index c445d10522e..499e8c0cabf 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c @@ -4,7 +4,7 @@ /* { dg-require-effective-target __float128 } */ /* { dg-require-effective-target base_quadfloat_support } */ /* { dg-require-effective-target int128 } */ -/* { dg-require-effective-target fenv } */ +/* { dg-require-effective-target fenv_setround } */ /* { dg-options "-frounding-math" } */ /* { dg-add-options __float128 } */ diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-2.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-2.c index a82f03d079c..3f91f8f3833 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-2.c +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-2.c @@ -2,7 +2,7 @@ float. */ /* { dg-do run } */ /* { dg-require-effective-target int128 } */ -/* { dg-require-effective-target fenv } */ +/* { dg-require-effective-target fenv_setround } */ /* { dg-options "-frounding-math" } */ #include diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-3.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-3.c index 707d539335f..816fcb1120e 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-3.c +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-3.c @@ -2,7 +2,7 @@ float. */ /* { dg-do run } */ /* { dg-require-effective-target int128 } */ -/* { dg-require-effective-target fenv } */ +/* { dg-require-effective-target fenv_setround } */ /* { dg-options "-frounding-math" } */ #include diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-4.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-4.c index 09600f90903..6337a6d3f1e 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-4.c +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode-4.c @@ -2,7 +2,7 @@ float. */ /* { dg-do run } */ /* { dg-require-effective-target int128 } */ -/* { dg-require-effective-target fenv } */ +/* { dg-require-effective-target fenv_setround } */ /* { dg-options "-frounding-math" } */ #include diff --git a/gcc/testsuite/gcc.dg/torture/fp-uint64-convert-double-1.c b/gcc/testsuite/gcc.dg/torture/fp-uint64-convert-double-1.c index fadad8c3198..43aeb81a602 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-uint64-convert-double-1.c +++ b/gcc/testsuite/gcc.dg/torture/fp-uint64-convert-double-1.c @@ -1,6 +1,6 @@ /* PR84407 */ /* { dg-do run } */ -/* { dg-require-effective-target fenv } */ +/* { dg-require-effective-target fenv_setround } */ /* { dg-additional-options "-frounding-math -fexcess-precision=standard" } */ #include diff --git a/gcc/testsuite/gcc.dg/torture/fp-uint64-convert-double-2.c b/gcc/testsuite/gcc.dg/torture/fp-uint64-convert-double-2.c index 952f96b33c9..d380b4a80e8 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-uint64-convert-double-2.c +++ b/gcc/testsuite/gcc.dg/torture/fp-uint64-convert-double-2.c @@ -1,6 +1,6 @@ /* PR84407 */ /* { dg-do run } */ -/* { dg-require-effective-target fenv } */ +/* { dg-require-effective-target fenv_setround } */ /* { dg-additional-options "-frounding-math" } */ #include diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 2d5d0539bb4..1a9b41a73bb 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -10685,6 +10685,24 @@ proc check_effective_target_fenv_exceptions_dfp {} { } [add_options_for_ieee "-std=gnu99"]] } + +# Return 1 if is availiable and supports fesetround. + +proc check_effective_target_fenv_setround {} { + return [check_runtime fenv_setround { + #include + #include + int + main (void) + { + if (fesetround (1) == 0) + exit (0); + else + abort (); + } + } [add_options_for_ieee "-std=gnu99"]] +} + # Return 1 if -fexceptions is supported. proc check_effective_target_exceptions {} {