[PATCH] testsuite: ppc: libstdc++ checks vect with -O2

Alexandre Oliva oliva@adacore.com
Fri Mar 20 10:42:05 GMT 2026


Some of the ppc effective target tests for vector instructions can get
the tested-for instruction optimized away when compiling with
optimization, like the libstdc++ testsuite does.  Add volatile to the
asm statements, like other such tests.

Regstrapped on x86_64-linux-gnu and ppc64el-linux-gnu.  Also tested with
ppc-vx7r2, ppc64-vx7r2, arm-vx7r2, and aarch64-vx7r2.  Ok to install?


for  gcc/testsuite/ChangeLog

	* lib/target-supports.exp (check_p8vector_hw_available): Make
	asm volatile.
	(check_vsx_hw_available): Likewise.
	(check_vmx_hw_available): Likewise.
---
 gcc/testsuite/lib/target-supports.exp |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index bfb8ecadf880f..d611eb97e29b9 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3258,7 +3258,7 @@ proc check_p8vector_hw_available { } {
 		{
 		  vector long long v1 = {0x1, 0x2};
 		  vector long long v2;
-		  asm ("xxlorc %0,%1,%1" : "=wa" (v2) : "wa" (v1));
+		  asm volatile ("xxlorc %0,%1,%1" : "=wa" (v2) : "wa" (v1));
 		  return 0;
 		}
 	    } $options
@@ -3557,7 +3557,7 @@ proc check_vsx_hw_available { } {
 		{
 		  vector int v1 = {0, 0, 0, 0};
 		  vector int v2;
-		  asm ("xxlor %0,%1,%1" : "=wa" (v2) : "wa" (v1));
+		  asm volatile ("xxlor %0,%1,%1" : "=wa" (v2) : "wa" (v1));
 		  return 0;
 		}
 	    } $options
@@ -3588,7 +3588,7 @@ proc check_vmx_hw_available { } {
 		{
 		  vector int v1 = {0, 0, 0, 0};
 		  vector int v2;
-		  asm ("vor %0,%1,%1" : "=v" (v2) : "v" (v1));
+		  asm volatile ("vor %0,%1,%1" : "=v" (v2) : "v" (v1));
 		  return 0;
 		}
 	    } $options

-- 
Alexandre Oliva, happy hacker            https://blog.lx.oliva.nom.br/
Free Software Activist     FSFLA co-founder     GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!


More information about the Libstdc++ mailing list