From patchwork Fri Jul 12 08:02:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Torbjorn SVENSSON X-Patchwork-Id: 1959695 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector1 header.b=xbMB9XTn; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WL3yc22PXz1xqx for ; Fri, 12 Jul 2024 18:04:08 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1B8D83839165 for ; Fri, 12 Jul 2024 08:04:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by sourceware.org (Postfix) with ESMTPS id 52CA6383915B for ; Fri, 12 Jul 2024 08:03:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52CA6383915B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=foss.st.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 52CA6383915B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720771404; cv=none; b=dpEqrlkwHvmTweY1W2CLyqbgAnrZKKCmq64y+OBgtS3neL+ZPqvDzpcopo78jFuHm8aDBoXIymuA+BTYpcV4DX9Gvrj+t973zuYwCNxOkgz99graA3j2ah57SaEpcZReFrw/pJmIt/0/2nzZc5EptRIVOVBDZsdElwFozjFB2N4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720771404; c=relaxed/simple; bh=xKKkQnidBMLrsJX8fiyFcL2QcWWFZKnZ+Q8hVtMMBZ0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=K2kzCAwyTu3UzlL13IW9vhYkIJtoHyRSo7ov04gklsMpWMJWRMDwC7cxwvs2cJJ6VFXWeO16feA9MPXVf8qrR5vyt9bKqoDc4wzDt6N09I+LkJS2U7JNQAZL29+pqou5U64Hly5qfD/lm5TF+jghz4hCHcnni41HMf2oW7Snk0o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46C7wlAh001543; Fri, 12 Jul 2024 10:03:08 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=selector1; bh=p5M/J60ZBorssDFoleIuGU oikp1PPo3VV6F4KuciO8c=; b=xbMB9XTncY37I3AbG2TKDxMy33YTezshHiXCi7 Pglr7HE2Vun9nTP/81T+ebDzJk6TdnqKFwDAD4T/BPFSGHPU4JCIrfmLUgKfvzrh KQtX326TtwZVXVZRwVFKksZQHQsSkoz+cj+wsA273ivqXJduCaYhRaSSwS4x7e3Y T4OQr9qlA7zwMX3ggzCEwfSkDJxYxyDpvy1YoOxjVpp0ZN1X0pbynfluYm8Yqpxv RN2bV+Y9ORavKWHdoH/czD/qB9lppzcd+R1IHorygeRIQdyOo65ASxLG/ZdnQKqF xrgG+IrlYDw6x4wJZmEFIm2Hoq4eS2uqM/TPubCw0GbgS6Pw== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 406wqtrd5s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 10:03:07 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 7107540044; Fri, 12 Jul 2024 10:03:02 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1B6D0231AAE; Fri, 12 Jul 2024 10:02:52 +0200 (CEST) Received: from jkgcxl0004.jkg.st.com (10.74.22.255) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Fri, 12 Jul 2024 10:02:51 +0200 From: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= To: CC: , , =?utf-8?q?Torbj?= =?utf-8?q?=C3=B6rn_SVENSSON?= Subject: [PATCH] testsuite: Avoid running incompatible Arm tests Date: Fri, 12 Jul 2024 10:02:10 +0200 Message-ID: <20240712080209.1286042-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.74.22.255] X-ClientProxiedBy: EQNCAS1NODE3.st.com (10.75.129.80) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-12_05,2024-07-11_01,2024-05-17_01 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Ok for trunk and releases/gcc-14? --- Overriding the -mpfu and -mfloat-abi might be incompatible with selected multilib. As a result, verify that the current multilib is compatible with the effective target without changing the -mfpu or -mfloat-abi options. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_arm_hard_vfp_ok): Check -mfpu value. (check_effective_target_arm_fp16_alternative_ok_nocache): Reuse check_effective_target_arm_fp16_ok. (check_effective_target_arm_fp16_none_ok_nocache): Likewise. (check_effective_target_arm_v8_neon_ok_nocache): Align checks with skeleton from check_effective_target_arm_fp16_ok_nocache. (check_effective_target_arm_neonv2_ok_nocache): Likewise. Signed-off-by: Torbjörn SVENSSON Co-authored-by: Yvan ROUX --- gcc/testsuite/lib/target-supports.exp | 119 ++++++++++++++++++-------- 1 file changed, 83 insertions(+), 36 deletions(-) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index f001c28072f..f90b80bb495 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -4829,6 +4829,7 @@ proc check_effective_target_arm_v8_vfp_ok {} { proc check_effective_target_arm_hard_vfp_ok { } { if { [check_effective_target_arm32] + && ! [check-flags [list "" { *-*-* } { "-mfpu=*" } { "-mfpu=vfp" }]] && ! [check-flags [list "" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } { return [check_no_compiler_messages arm_hard_vfp_ok executable { int main() { return 0;} @@ -5405,11 +5406,12 @@ proc check_effective_target_arm_fp16_alternative_ok_nocache { } { # Not supported by the target system. return 0 } + global et_arm_fp16_flags global et_arm_fp16_alternative_flags set et_arm_fp16_alternative_flags "" - if { [check_effective_target_arm32] } { - foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16" - "-mfpu=neon-fp16 -mfloat-abi=softfp"} { + + if { [check_effective_target_arm32] && [check_effective_target_arm_fp16_ok] } { + foreach flags [list "" $et_arm_fp16_flags] { if { [check_no_compiler_messages_nocache \ arm_fp16_alternative_ok object { #if !defined (__ARM_FP16_FORMAT_ALTERNATIVE) || ! (__ARM_FP & 2) @@ -5434,9 +5436,9 @@ proc check_effective_target_arm_fp16_alternative_ok { } { # format. Some multilibs may be incompatible with the options needed. proc check_effective_target_arm_fp16_none_ok_nocache { } { - if { [check_effective_target_arm32] } { - foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16" - "-mfpu=neon-fp16 -mfloat-abi=softfp"} { + global et_arm_fp16_flags + if { [check_effective_target_arm32] && [check_effective_target_arm_fp16_ok] } { + foreach flags [list "" $et_arm_fp16_flags] { if { [check_no_compiler_messages_nocache \ arm_fp16_none_ok object { #if defined (__ARM_FP16_FORMAT_ALTERNATIVE) @@ -5467,23 +5469,46 @@ proc check_effective_target_arm_fp16_none_ok { } { proc check_effective_target_arm_v8_neon_ok_nocache { } { global et_arm_v8_neon_flags set et_arm_v8_neon_flags "" - if { [check_effective_target_arm32] } { - foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} { - if { [check_no_compiler_messages_nocache arm_v8_neon_ok object { - #if __ARM_ARCH < 8 - #error not armv8 or later - #endif - #include "arm_neon.h" - void - foo () - { - __asm__ volatile ("vrintn.f32 q0, q0"); - } - } "$flags -march=armv8-a"] } { - set et_arm_v8_neon_flags $flags - return 1 - } + if { ! [check_effective_target_arm32] } { + return 0; + } + if [check-flags \ + [list "" { *-*-* } { "-mfpu=*" } \ + { "-mfpu=*fp-armv8*" } ]] { + # Multilib flags would override -mfpu. + return 0 + } + if [check-flags [list "" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] { + # Must generate floating-point instructions. + return 0 + } + if [check_effective_target_arm_hf_eabi] { + # Use existing float-abi and force an fpu which supports fp16 + set et_arm_v8_neon_flags "-mfpu=neon-fp-armv8" + return 1; + } + if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] { + # The existing -mfpu value is OK; use it, but add softfp. + set et_arm_v8_neon_flags "-mfloat-abi=softfp" + return 1; + } + + # Add -mfpu for a VFP fp16 variant since there is no preprocessor + # macro to check for this support. + set flags "-mfpu=neon-fp-armv8 -mfloat-abi=softfp" + if { [check_no_compiler_messages_nocache arm_v8_neon_ok object { + #if __ARM_ARCH < 8 + #error not armv8 or later + #endif + #include "arm_neon.h" + void + foo () + { + __asm__ volatile ("vrintn.f32 q0, q0"); } + } "$flags -march=armv8-a"] } { + set et_arm_v8_neon_flags $flags + return 1 } return 0 @@ -5503,21 +5528,43 @@ proc check_effective_target_arm_neonv2_ok_nocache { } { global et_arm_neonv2_flags global et_arm_neon_flags set et_arm_neonv2_flags "" - if { [check_effective_target_arm32] - && [check_effective_target_arm_neon_ok] } { - foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} { - if { [check_no_compiler_messages_nocache arm_neonv2_ok object { - #include "arm_neon.h" - float32x2_t - foo (float32x2_t a, float32x2_t b, float32x2_t c) - { - return vfma_f32 (a, b, c); - } - } "$et_arm_neon_flags $flags"] } { - set et_arm_neonv2_flags [concat $et_arm_neon_flags $flags] - return 1 - } + if { ! [check_effective_target_arm32] || ! [check_effective_target_arm_neon_ok] } { + return 0; + } + if [check-flags \ + [list "" { *-*-* } { "-mfpu=*" } \ + { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" \ + "-mfpu=*fpv[1-9][0-9]*" "-mfpu=*fp-armv8*" } ]] { + # Multilib flags would override -mfpu. + return 0 + } + if [check-flags [list "" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] { + # Must generate floating-point instructions. + return 0 + } + if [check_effective_target_arm_hf_eabi] { + # Use existing float-abi and force an fpu which supports neonv2 + set et_arm_neonv2_flags [concat $et_arm_neon_flags "-mfpu=vfpv4"] + return 1; + } + if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] { + # The existing -mfpu value is OK; use it, but add softfp. + set et_arm_neonv2_flags [concat $et_arm_neon_flags "-mfloat-abi=softfp"] + return 1; + } + # Add -mfpu for a neonv2 variant since there is no preprocessor + # macro to check for this support. + set flags "-mfpu=vfpv4 -mfloat-abi=softfp" + if { [check_no_compiler_messages_nocache arm_neonv2_ok object { + #include "arm_neon.h" + float32x2_t + foo (float32x2_t a, float32x2_t b, float32x2_t c) + { + return vfma_f32 (a, b, c); } + } "$et_arm_neon_flags $flags"] } { + set et_arm_neonv2_flags [concat $et_arm_neon_flags $flags] + return 1 } return 0