From patchwork Fri Dec 20 22:29:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 103548 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 784703858D38 for ; Fri, 20 Dec 2024 22:32:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 784703858D38 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=UBbfMX7p X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 74E3B3858C54 for ; Fri, 20 Dec 2024 22:29:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74E3B3858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 74E3B3858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::629 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734733774; cv=none; b=BoXXPSlaVCVCcjfQ43x2DEf/XIu1vrN2/11thv3UiwY0NrWajcUQRtQvuEFFyYApqzcERTYK4QKyrhvk6QG5CQbiDvcWtQsXyV38NSrkyZCVqz/mOS3GcYgdlAfrcehd6Q1WjjtZAaP4Z3oBqF44fvRQD4E+W2HAm0t7i37ZUUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734733774; c=relaxed/simple; bh=reaEbvsWMQ9TebfQELunvVg/Qwqc5S4zxzhQXcWy4dc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=VLaL3hoFLr24R9fcm3g19HAORAgV0WXEoproSQ00z6NJOlR7Jos41rnTBM+8wn639Cmva+eiNjPrGUaPt7/cY6CHPlS6xIOgCGBfx5KLNnvxLeE31rNnQGs+VPOBiQ2TqRsll1Q5oPD9f/7TvNtt4WjCIBUJr+4Pxad/SqBb+MU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74E3B3858C54 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-2166f1e589cso26997445ad.3 for ; Fri, 20 Dec 2024 14:29:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734733773; x=1735338573; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jpoVzc+vgUdHawMTJoPekS7g21cjqNqKMpvomGsbyLY=; b=UBbfMX7p/8AJtgSHZQrPHxVO7xZkNaa1dofV9br3o/v1PhaZzEoNM00Wt9PHEBISnY 1bihmjK4Gocnzjw14bPlN/YvNKuFMxCOZA1KnMEXUics48a7utfZClQlrhtfN7HOK09F a9TTrxIh/j5x00PzNdqx5lFf12CbOrNxs+l46QTYmtUtbRuqWMKlUkLHG/YW8slsqinJ 0oeVsvTfpfoNFmVc8dlo0GepITQ0/hyDMH+yJSnPpiA+Zw5yjQp1Y3bDHVO9Db/oUHVa K4bk//JbmyqzWgSaplBxOC/gezM5GCICwngNq7aIYNdvAFfQupSSJsW+5s9QPs+rjXAi FmkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734733773; x=1735338573; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jpoVzc+vgUdHawMTJoPekS7g21cjqNqKMpvomGsbyLY=; b=lzmAfl/AOd+/Anl9nmSfqI04HSBf+Ku6W6YhQakusSaez3yQTKoYLDwxb/Sj/jVW3z t0Pxjq8wAShqEql41tiO2XiIynThyFZk0IbtFvmVUQyQ2i2jzqRTrD3HTKt7nBxzxaDZ fcQFdcsUUkHN35CgAQ6Y4slj/7nqKLjucPUGDsITHIKRoxZ6zhVwBZfAKfp3O2l1FtmT aOUvzjICjku3UTUdmwVqmHowuVBzMqu2hUpoJ2ltnc5yMV4VtBAcD7i4NIdrqEdxmRob cQig6zOQQbIStzA8Ct0QFw1mVrrekfxFT1uKfCke8ZTDDxKs/cjzCvLaukVHZhwqPcYi LVLg== X-Gm-Message-State: AOJu0YxDHYHgLZw//6ar5rIv3l8rK2VsD0R5Dyq/EEm5cm/sQuW8H5Kq eLbi4CNLQhS1YHSG5U2st+sPSBun8yKIRE/AO6ODCpPsH5I5skNn2rgY7dJT7tO3qA== X-Gm-Gg: ASbGncsZ9rRvrwSLXgqPYruluFqHtoK8R+RIxehbDLQrMDPy8khEX30+GbIgQVBG6St HZ12Es5jIV1ZG5LXYVM+ClXqmUduSj4rgjFvXhmYchW+v0OVUxOyNvnEd7Wmb+FyIJiGMHsa90s ap6RkvA31AKxs54ASPNDEWvOsGyYjenSEoz9e7IMQzvIBv1WBHFsMRqxUBGqw/ReLAuOqUsPzqY eM84RUFHjLJ+bczL8YmFFenBQkRQe2OjvWsWO9aRrdJ0lvdZIBQfUrpqwW9L3nDnB42mPg= X-Google-Smtp-Source: AGHT+IHAOGGWIsIfWxaLCTMoaJ5bs0Tud9nzbRCYk0XzVjwuWTaJ7ffq8vXc5dwL5k3PAu3Em0wpjA== X-Received: by 2002:a17:902:dac6:b0:216:32c4:f807 with SMTP id d9443c01a7336-219e6f25fdcmr52972985ad.45.1734733773302; Fri, 20 Dec 2024 14:29:33 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc96e919sm33976075ad.69.2024.12.20.14.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 14:29:33 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id E97E7C01F8; Sat, 21 Dec 2024 06:29:30 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org Subject: [PATCH v3] x86: Include test-flt-eval-method-387 if -mfpmath=387 works Date: Sat, 21 Dec 2024 06:29:30 +0800 Message-ID: <20241220222930.710344-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3019.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org On x86, include test-flt-eval-method-387 only if -mfpmath=387 works. Signed-off-by: H.J. Lu --- sysdeps/x86/configure | 34 ++++++++++++++++++++++++++++++++++ sysdeps/x86/configure.ac | 10 ++++++++++ sysdeps/x86/fpu/Makefile | 4 +++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure index a6d37778d1..c7ea9ac6ad 100644 --- a/sysdeps/x86/configure +++ b/sysdeps/x86/configure @@ -175,6 +175,40 @@ x86-isa-level-3-or-above = 3 4" config_vars="$config_vars enable-x86-isa-level = $libc_cv_include_x86_isa_level" + + +saved_CC="$CC" +CC="$TEST_CC" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if -mfpmath=387 works in testing" >&5 +printf %s "checking if -mfpmath=387 works in testing... " >&6; } +if test ${libc_cv_have_test_cc_cflags_mfpmath_387+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if { ac_try='${CC-cc} -c -Werror -mfpmath=387 -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + libc_cv_have_test_cc_cflags_mfpmath_387=yes +else case e in #( + e) libc_cv_have_test_cc_cflags_mfpmath_387=no + ;; +esac +fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_have_test_cc_cflags_mfpmath_387" >&5 +printf "%s\n" "$libc_cv_have_test_cc_cflags_mfpmath_387" >&6; } + +CC="$saved_CC" + + +config_vars="$config_vars +have-test-cc-cflags-mfpmath-387 = $libc_cv_have_test_cc_cflags_mfpmath_387" + printf "%s\n" "#define SUPPORT_STATIC_PIE 1" >>confdefs.h diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac index 8a259d3971..031f91719d 100644 --- a/sysdeps/x86/configure.ac +++ b/sysdeps/x86/configure.ac @@ -120,5 +120,15 @@ LIBC_CONFIG_VAR([have-x86-isa-level], [$libc_cv_have_x86_isa_level]) LIBC_CONFIG_VAR([x86-isa-level-3-or-above], [3 4]) LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level]) +dnl Check if TEST_CC supports -mfpmath=387 +LIBC_TRY_TEST_CC_OPTION([if -mfpmath=387 works], + [-c -Werror -mfpmath=387], + libc_cv_have_test_cc_cflags_mfpmath_387, + [libc_cv_have_test_cc_cflags_mfpmath_387=yes], + [libc_cv_have_test_cc_cflags_mfpmath_387=no] +) +LIBC_CONFIG_VAR(have-test-cc-cflags-mfpmath-387, + $libc_cv_have_test_cc_cflags_mfpmath_387) + dnl Static PIE is supported. AC_DEFINE(SUPPORT_STATIC_PIE) diff --git a/sysdeps/x86/fpu/Makefile b/sysdeps/x86/fpu/Makefile index 705dd9d715..91b2444f3a 100644 --- a/sysdeps/x86/fpu/Makefile +++ b/sysdeps/x86/fpu/Makefile @@ -8,9 +8,11 @@ tests += \ test-fenv-sse \ test-fenv-sse-2 \ test-fenv-x87 \ - test-flt-eval-method-387 \ test-flt-eval-method-sse \ # tests +ifeq ($(have-test-cc-cflags-mfpmath-387),yes) +tests += test-flt-eval-method-387 +endif CFLAGS-test-fenv-sse.c += -msse2 -mfpmath=sse CFLAGS-test-fenv-clear-sse.c += -msse2 -mfpmath=sse CFLAGS-test-fenv-sse-2.c += -msse2 -mfpmath=sse