From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OWqVCds8g2p8RC0AWB0awg (envelope-from ) for ; Mon, 17 Aug 2026 12:54:51 -0400 Received: by simark.ca (Postfix, from userid 112) id 23A471E0A3; Mon, 17 Aug 2026 12:54:51 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 66F0B1E033 for ; Mon, 17 Aug 2026 12:54:50 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1698C4BAE7F2 for ; Mon, 17 Aug 2026 16:54:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1698C4BAE7F2 Received: from angie.orcam.me.uk (angie.orcam.me.uk [78.133.224.34]) by sourceware.org (Postfix) with ESMTP id 1714C4BAE7CD for ; Mon, 17 Aug 2026 16:53:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1714C4BAE7CD Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=orcam.me.uk ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1714C4BAE7CD Authentication-Results: sourceware.org; arc=none smtp.remote-ip=78.133.224.34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786985607; cv=none; b=CMnqsp3k2SWOoG2oziLR2/4mefaaE+3PWv6hwZQdcJfFnELu5F5RGtcCIQCyfpy/qCEnr9Gx6nYqM+VxwbG/nLv3hPeS9cS/1KHSXnljSr1/eR35ez34s6TJtVeVPram0nl8gPGPkeivBJ268Z9ntYVePiCaxL1K3gZUdbSPglo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786985607; c=relaxed/simple; bh=nM4lNfkEXwiIzhEdpYt/4BENUywbhjA6sqDizNYuo3s=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=H9IakAm1U9o4+mmnRo54HEG/w4n4zZzqpxfQtXkD2TwXabW9/LSC1f1qwoP6Hk+cqC3tgIjqHmQEZgiLAiUaJeQAw2rPLwl2z2xheAzasHrI9Pni05WqAPdsPltsCuEliStujf3Jqbx8+B+IcNzf8iwILebrL4LboBc6o/t3W8o= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1714C4BAE7CD Received: by angie.orcam.me.uk (Postfix, from userid 500) id 9762F92009D; Mon, 17 Aug 2026 18:53:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 949D692009B; Mon, 17 Aug 2026 17:53:26 +0100 (BST) Date: Mon, 17 Aug 2026 17:53:26 +0100 (BST) From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org cc: Jovan Dmitrovic , Djordje Todorovic , Milica Matic , "Maciej W. Rozycki" Subject: [PATCH v2 02/12] PowerPC/testsuite: Reduce feature tests in terms of `allow_target_tests' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "Maciej W. Rozycki" Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org From: Maciej W. Rozycki Reimplement `allow_altivec_tests', `allow_power_isa_3_1_tests', and `allow_vsx_tests' in terms of `allow_target_tests', removing duplicate code. No functional change. Eventually it may make sense to migrate the resulting wrappers to testsuite/gdb.arch/ so as to declutter generic test framework from target-specific stuff. --- No change from v1 (2/7), . --- gdb/testsuite/lib/gdb.exp | 163 +++++++++------------------------------------- 1 file changed, 35 insertions(+), 128 deletions(-) gdb-powerpc-test-target-allow.diff Index: binutils-gdb/gdb/testsuite/lib/gdb.exp =================================================================== --- binutils-gdb.orig/gdb/testsuite/lib/gdb.exp +++ binutils-gdb/gdb/testsuite/lib/gdb.exp @@ -4339,8 +4339,6 @@ proc allow_target_tests { me feature mes # 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite. gdb_caching_proc allow_altivec_tests {} { - global srcdir subdir gdb_prompt inferior_exited_re - set me "allow_altivec_tests" # Some simulators are known to not support VMX instructions. @@ -4356,110 +4354,47 @@ gdb_caching_proc allow_altivec_tests {} # Make sure we have a compiler that understands altivec. if {[test_compiler_info gcc*]} { - set compile_flags "additional_flags=-maltivec" + set flags "-maltivec" } elseif {[test_compiler_info xlc*]} { - set compile_flags "additional_flags=-qaltivec" + set flags "-qaltivec" } else { verbose "Could not compile with altivec support, returning 0" 2 return 0 } # Compile a test program containing VMX instructions. - set src { - int main() { - #ifdef __MACH__ - asm volatile ("vor v0,v0,v0"); - #else - asm volatile ("vor 0,0,0"); - #endif - return 0; - } - } - if {![gdb_simple_compile $me $src executable $compile_flags]} { - return 0 - } - - # Compilation succeeded so now run it via gdb. - - gdb_exit - gdb_start - gdb_reinitialize_dir $srcdir/$subdir - gdb_load "$obj" - gdb_run_cmd - gdb_expect { - -re ".*Illegal instruction.*${gdb_prompt} $" { - verbose -log "\n$me altivec hardware not detected" - set allow_vmx_tests 0 - } - -re ".*$inferior_exited_re normally.*${gdb_prompt} $" { - verbose -log "\n$me: altivec hardware detected" - set allow_vmx_tests 1 - } - default { - warning "\n$me: default case taken" - set allow_vmx_tests 0 - } - } - gdb_exit - remote_file build delete $obj - - verbose "$me: returning $allow_vmx_tests" 2 - return $allow_vmx_tests + return [allow_target_tests $me "altivec hardware" "Illegal instruction" \ + { + int main() { + #ifdef __MACH__ + asm volatile ("vor v0,v0,v0"); + #else + asm volatile ("vor 0,0,0"); + #endif + return 0; + } + } \ + $flags] } # Run a test on the power target to see if it supports ISA 3.1 instructions gdb_caching_proc allow_power_isa_3_1_tests {} { - global srcdir subdir gdb_prompt inferior_exited_re - - set me "allow_power_isa_3_1_tests" - # Compile a test program containing ISA 3.1 instructions. - set src { - int main() { - asm volatile ("pnop"); // marker + return [allow_target_tests "allow_power_isa_3_1_tests" \ + "Power ISA 3.1 hardware" "Illegal instruction" \ + { + int main() { + asm volatile ("pnop"); // marker asm volatile ("nop"); return 0; } - } - - if {![gdb_simple_compile $me $src executable ]} { - return 0 - } - - # No error message, compilation succeeded so now run it via gdb. - - gdb_exit - gdb_start - gdb_reinitialize_dir $srcdir/$subdir - gdb_load "$obj" - gdb_run_cmd - gdb_expect { - -re ".*Illegal instruction.*${gdb_prompt} $" { - verbose -log "\n$me Power ISA 3.1 hardware not detected" - set allow_power_isa_3_1_tests 0 - } - -re ".*$inferior_exited_re normally.*${gdb_prompt} $" { - verbose -log "\n$me: Power ISA 3.1 hardware detected" - set allow_power_isa_3_1_tests 1 - } - default { - warning "\n$me: default case taken" - set allow_power_isa_3_1_tests 0 - } - } - gdb_exit - remote_file build delete $obj - - verbose "$me: returning $allow_power_isa_3_1_tests" 2 - return $allow_power_isa_3_1_tests + }] } # Run a test on the target to see if it supports vmx hardware. Return 1 if so, # 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite. gdb_caching_proc allow_vsx_tests {} { - global srcdir subdir gdb_prompt inferior_exited_re - set me "allow_vsx_tests" # Some simulators are known to not support Altivec instructions, so @@ -4471,56 +4406,28 @@ gdb_caching_proc allow_vsx_tests {} { # Make sure we have a compiler that understands altivec. if {[test_compiler_info gcc*]} { - set compile_flags "additional_flags=-mvsx" + set flags "-mvsx" } elseif {[test_compiler_info xlc*]} { - set compile_flags "additional_flags=-qasm=gcc" + set flags "-qasm=gcc" } else { verbose "Could not compile with vsx support, returning 0" 2 return 0 } # Compile a test program containing VSX instructions. - set src { - int main() { - double a[2] = { 1.0, 2.0 }; - #ifdef __MACH__ - asm volatile ("lxvd2x v0,v0,%[addr]" : : [addr] "r" (a)); - #else - asm volatile ("lxvd2x 0,0,%[addr]" : : [addr] "r" (a)); - #endif - return 0; - } - } - if {![gdb_simple_compile $me $src executable $compile_flags]} { - return 0 - } - - # No error message, compilation succeeded so now run it via gdb. - - gdb_exit - gdb_start - gdb_reinitialize_dir $srcdir/$subdir - gdb_load "$obj" - gdb_run_cmd - gdb_expect { - -re ".*Illegal instruction.*${gdb_prompt} $" { - verbose -log "\n$me VSX hardware not detected" - set allow_vsx_tests 0 - } - -re ".*$inferior_exited_re normally.*${gdb_prompt} $" { - verbose -log "\n$me: VSX hardware detected" - set allow_vsx_tests 1 - } - default { - warning "\n$me: default case taken" - set allow_vsx_tests 0 - } - } - gdb_exit - remote_file build delete $obj - - verbose "$me: returning $allow_vsx_tests" 2 - return $allow_vsx_tests + return [allow_target_tests $me "VSX hardware" "Illegal instruction" \ + { + int main() { + double a[2] = { 1.0, 2.0 }; + #ifdef __MACH__ + asm volatile ("lxvd2x v0,v0,%[addr]" : : [addr] "r" (a)); + #else + asm volatile ("lxvd2x 0,0,%[addr]" : : [addr] "r" (a)); + #endif + return 0; + } + } \ + $flags] } # Run a test on the target to see if it supports TSX hardware. Return 1 if so,