93dc2d
commit e64235ff4266e87b20505101877fe57350ab69ab
93dc2d
Author: Paul A. Clarke <pc@us.ibm.com>
93dc2d
Date:   Tue Sep 14 13:13:33 2021 -0500
93dc2d
93dc2d
    powerpc: Fix unrecognized instruction errors with recent GCC
93dc2d
    
93dc2d
    Recent binutils commit b25f942e18d6ecd7ec3e2d2e9930eb4f996c258a
93dc2d
    changes the behavior of `.machine` directives to override, rather
93dc2d
    than augment, the base CPU. This can result in _reduced_ functionality
93dc2d
    when, for example, compiling for default machine "power8", but explicitly
93dc2d
    asking for ".machine power5", which loses Altivec instructions.
93dc2d
    
93dc2d
    In tst-ucontext-ppc64-vscr.c, while the instructions provoking the new
93dc2d
    error messages are bracketed by ".machine power5", which is ostensibly
93dc2d
    Power ISA 2.03 (POWER5), the POWER5 processor did not support the
93dc2d
    VSX subset, so these instructions are not recognized as "power5".
93dc2d
    
93dc2d
    Error: unrecognized opcode: `vspltisb'
93dc2d
    Error: unrecognized opcode: `vpkuwus'
93dc2d
    Error: unrecognized opcode: `mfvscr'
93dc2d
    Error: unrecognized opcode: `stvx'
93dc2d
    
93dc2d
    Manually adding the VSX subset via ".machine altivec" is sufficient.
93dc2d
    
93dc2d
    Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
93dc2d
    (cherry picked from commit 064b475a2e5662b6b3973fabf505eade86e61510)
93dc2d
93dc2d
diff --git a/sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c b/sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c
93dc2d
index 28c87fcef72bded6..d3fc4ab589f4752a 100644
93dc2d
--- a/sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c
93dc2d
+++ b/sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c
93dc2d
@@ -50,6 +50,7 @@ do_test (void)
93dc2d
   /* Set SAT bit in VSCR register.  */
93dc2d
   asm volatile (".machine push;\n"
93dc2d
 		".machine \"power5\";\n"
93dc2d
+		".machine altivec;\n"
93dc2d
 		"vspltisb %0,0;\n"
93dc2d
 		"vspltisb %1,-1;\n"
93dc2d
 		"vpkuwus %0,%0,%1;\n"