PR63177 shows a bug in how we determine which gas options we decide to pass to 
the
assembler.  Normally, we pass the -m<CPU> option to the assembler if we used the
-mcpu=<CPU> option.  However, if we don't compile with -mcpu=<CPU>, then we will
check some of the -m<vector option> options and pass an appropriate -m<CPU> 
option
to the assembler.  This is all fine and good except for when we compile with
-mpower9-vector -mcpu=power8.  The problem here is that POWER9 added new 
lxvx/stxvx
instructions which already existed in POWER8 as extended mnemonics of 
lxvd2x/stxvd2x
which are different instructions and behave differently in LE mode.  The "bug" 
is
that -mpower9-vector enables the generation of the POWER9 lxvx instruction, but 
the
-mcpu=power8 option causes us to use the -mpower8 assembler option so we get the
wrong instruction. :-(

The fix used here is to catch the special case when we use -mpower9-vector and
-mcpu=power8 together and then force ourselves to use the -mpower9 gas option.

This passed bootstrap and regtesting with no regressions and fixes a little over
150 testsuite failures.  Ok for trunk and the appropriate release branches once
it's baked on trunk for a while?

Peter

        PR target/63177
        * /config/rs6000/rs6000.h (ASM_CPU_SPEC): Add support for -mpower9.
        Don't handle -mcpu=power8 if -mpower9-vector is also used.
        
Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h  (revision 260913)
+++ gcc/config/rs6000/rs6000.h  (working copy)
@@ -120,7 +120,7 @@
 %{mcpu=power6: %(asm_cpu_power6) -maltivec} \
 %{mcpu=power6x: %(asm_cpu_power6) -maltivec} \
 %{mcpu=power7: %(asm_cpu_power7)} \
-%{mcpu=power8: %(asm_cpu_power8)} \
+%{mcpu=power8: %{!mpower9-vector: %(asm_cpu_power8)}} \
 %{mcpu=power9: %(asm_cpu_power9)} \
 %{mcpu=a2: -ma2} \
 %{mcpu=powerpc: -mppc} \
@@ -169,6 +169,7 @@
 %{maltivec: -maltivec} \
 %{mvsx: -mvsx %{!maltivec: -maltivec} %{!mcpu*: %(asm_cpu_power7)}} \
 %{mpower8-vector|mcrypto|mdirect-move|mhtm: %{!mcpu*: %(asm_cpu_power8)}} \
+%{mpower9-vector: %{!mcpu*|mcpu=power8: %(asm_cpu_power9)}} \
 -many"
 
 #define CPP_DEFAULT_SPEC ""

Reply via email to