From patchwork Mon Jul 15 09:03:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= X-Patchwork-Id: 1960530 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=j0FdeF1K; 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 4WMxBs13Rxz1xr4 for ; Mon, 15 Jul 2024 19:06:13 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 68E2D3865C10 for ; Mon, 15 Jul 2024 09:06:11 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id 72A1E3864848 for ; Mon, 15 Jul 2024 09:05:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 72A1E3864848 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 72A1E3864848 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721034345; cv=none; b=vXBRQIjZ9CNW+0kvNsvShDHdCp2JeYtFi1q/1fJkP9ZOOi6vxhfLTei/a3fD59Y8FNWxYbGoeiPKTRplVEe9Is9R3+C0CEHDYgc6R6pMI/Jeuuizl4pvMalnkE1IDjdaH1tDzPohVQtjNxZBYX+v2zqTnpoyp3UK72YN+t/LxX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721034345; c=relaxed/simple; bh=4V49dHDZ+Pfa4bv/QhzOBwo39NZYZ6qCO5OSlv2wEhM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=reO21LSZqDeLjGyIhcn9WC335P85UuYcAp5Fmw+gVzYnvPSmZPrP/geft+ijqx7IZSZJlfPfiaGVH65/JBnt3HEUW2SmnWL2bPNVOUf3JHMbw1pEjm+WcT6bnP3Ni5FDtYjoC+cV/NJWgMsBAaPzR38bqCF5ehzAtv9eVNf8eeU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46F7pU9u008496; Mon, 15 Jul 2024 11:05:39 +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=ayOKB5sP4kRoYm+K5/NXR4 oiddxeJWb+xdYPQaStfGI=; b=j0FdeF1K9GR4oX9FZRzNNTmPRXYZkcf8nMUyK3 BfEMseMSTZ96LN/VzLpmSIcIk/vDLbuzsm0L2yV+Drdg30ZHxJLOxsYj+S/rFxES pIOj7rtE4jMN9Mg0J/o/1mPnmOlhyieFoD2XoYaOMC0oTi+yYOX0sWxwj66CAXg8 x7nWJhcN+VlJ22AcTobVCxL1JABBgmbQ7WpRkHYw1yixYSH6W77cmZnfoUF5a93a sB5xkQvr7FLkxHhxkJSTfYpnSkeWJiz19ofFSVphH/8d+aqt8M/d2JQfqYATY0TT UCJ9qZ92wKNP45MbtnZCD2D7E1sO9whYc2TF7Wb39dyLtZCw== 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 40bf0g666p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Jul 2024 11:05:39 +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 0703E4002D; Mon, 15 Jul 2024 11:05:33 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id CE269210732; Mon, 15 Jul 2024 11:05:23 +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; Mon, 15 Jul 2024 11:05:23 +0200 From: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= To: CC: , , =?utf-8?q?Torbj?= =?utf-8?q?=C3=B6rn_SVENSSON?= Subject: [PATCH v2] testsuite: Avoid running incompatible Arm tests Date: Mon, 15 Jul 2024 11:03:36 +0200 Message-ID: <20240715090335.3568553-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: SHFCAS1NODE2.st.com (10.75.129.73) 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-15_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? Changes since v1: - Fixed a regression for armv8l-unknown-linux-gnueabihf reported by Linaro TCWG-CI. --- 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..e142f37b7ac 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 $et_arm_neon_flags + 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=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 } return 0