On Mon, Jun 04, 2018 at 08:57:24PM -0500, Peter Bergner wrote:
> 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.

Ideally -mpowerN-vector will just go away.

> --- 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"

Why do you need the !mpower9-vector in the mcpu=power8 clause?  Is how
mpower8-vector is handled not correct, or is something fundamentally
different there?


Segher

Reply via email to