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