[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2018-01-10 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

Peter Bergner  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-01-10
   Assignee|unassigned at gcc dot gnu.org  |bergner at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #5 from Peter Bergner  ---
Going through the kernel cputable.c file and comparing it to rs6000-cpus.def, I
think the name translation should like:

These kernel AT_PLATFORM names can be used as is:
  .platform = "powerpc",
  .platform = "power3",
  .platform = "power4",
  .platform = "power5",
  .platform = "power5+",
  .platform = "power6",
  .platform = "power6x",
  .platform = "power7",
  .platform = "power8",
  .platform = "power9",

This kernel AT_PLATFORM name should strip the '+' off:
  .platform = "power7+", -> "power7"

These kernel AT_PLATFORM names should strip the 'ppc' prefix off:
  .platform = "ppc970", -> "970"
  .platform = "ppc601", -> "601"
  .platform = "ppc603", -> "603"
  .platform = "ppc604", -> "604"
  .platform = "ppc750", -> "750"
  .platform = "ppc7400", -> "7400"
  .platform = "ppc7450", -> "7450"
  .platform = "ppc823", -> "823"
  .platform = "ppc403", -> "403"
  .platform = "ppc8540", -> "8540"
  .platform = "ppc8548", -> "8548"
  .platform = "ppce5500", -> "e5500"
  .platform = "ppce6500", -> "e6500"

These kernel AT_PLATFORM names should strip their prefix and suffix off:
  .platform = "ppc440gp", -> "440"
  .platform = "ppc-cell-be", -> "cell"

These kernel AT_PLATFORM names should strip the 'ppc' prefix off, as
well as test the AT_HWCAP for PPC_FEATURE_HAS_FPU:
  .platform = "ppc405", -> "405" | "405fp"
  .platform = "ppc440", -> "440" | "440fp"

This kernel AT_PLATFORM name should strip the 'ppc' prefix off, change
470 to 476 as well as test the AT_HWCAP for PPC_FEATURE_HAS_FPU:
  .platform = "ppc470", -> "476" | "476fp"

This kernel AT_PLATFORM name should strip the 'ppc' prefix off, as
well as test the AT_HWCAP for PPC_FEATURE_64::
  .platform = "ppce500mc", -> "e500mc" | "e500mc64"

These kernel AT_PLATFORM names do not seem to have an equivalent
rs6000-cpus.def entry, so we probably should just treat them as
unknown/non-existent names:
  .platform = "pa6t",
  .platform = "ppc5554",

I will take a stab at adding this name translation, which should also fix
PR83743.

I do question though, whether we should test the AT_HWCAP bits or not.  Just
because we're on, say a 476fp system, doesn't mean the toolchain and libraries
are compiled with FP support.  Thoughts anyone?

[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2018-01-23 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

--- Comment #6 from Peter Bergner  ---
Created attachment 43227
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43227&action=edit
Proposed patch

I'm testing the attached patch, which should also fix PR83743.  Can those of
you that have hit this problem test the patch to see if it fixes your specific
failures?

[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2018-01-23 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

Peter Bergner  changed:

   What|Removed |Added

  Attachment #43227|0   |1
is obsolete||

--- Comment #7 from Peter Bergner  ---
Created attachment 43229
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43229&action=edit
Updated patch that caches the AT_PLATFORM value

Sorry for the quick update, but I think it makes sense to cache the AT_PLATFORM
value so we don't have to scan the AUXV from the mounted kernel file each time
we call elf_platform().

[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2018-01-25 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

Segher Boessenkool  changed:

   What|Removed |Added

 CC||segher at gcc dot gnu.org

--- Comment #8 from Segher Boessenkool  ---
(In reply to Peter Bergner from comment #5)
> Going through the kernel cputable.c file and comparing it to
> rs6000-cpus.def, I think the name translation should like:
> 
> These kernel AT_PLATFORM names can be used as is:
>   .platform = "powerpc",
>   .platform = "power3",
>   .platform = "power4",
>   .platform = "power5",
>   .platform = "power5+",
>   .platform = "power6",
>   .platform = "power6x",
>   .platform = "power7",
>   .platform = "power8",
>   .platform = "power9",
> 
> This kernel AT_PLATFORM name should strip the '+' off:
>   .platform = "power7+", -> "power7"

We probably should have a -mcpu=power7+, we have power5+ as well etc.

> These kernel AT_PLATFORM names should strip the 'ppc' prefix off:
>   .platform = "ppc970", -> "970"
>   .platform = "ppc601", -> "601"
>   .platform = "ppc603", -> "603"
>   .platform = "ppc604", -> "604"
>   .platform = "ppc750", -> "750"
>   .platform = "ppc7400", -> "7400"
>   .platform = "ppc7450", -> "7450"
>   .platform = "ppc823", -> "823"
>   .platform = "ppc403", -> "403"
>   .platform = "ppc8540", -> "8540"
>   .platform = "ppc8548", -> "8548"
>   .platform = "ppce5500", -> "e5500"
>   .platform = "ppce6500", -> "e6500"

Yup.

> These kernel AT_PLATFORM names should strip their prefix and suffix off:
>   .platform = "ppc440gp", -> "440"
>   .platform = "ppc-cell-be", -> "cell"
> 
> These kernel AT_PLATFORM names should strip the 'ppc' prefix off, as
> well as test the AT_HWCAP for PPC_FEATURE_HAS_FPU:
>   .platform = "ppc405", -> "405" | "405fp"
>   .platform = "ppc440", -> "440" | "440fp"
> 
> This kernel AT_PLATFORM name should strip the 'ppc' prefix off, change
> 470 to 476 as well as test the AT_HWCAP for PPC_FEATURE_HAS_FPU:
>   .platform = "ppc470", -> "476" | "476fp"

We could also decide not to support those for "native" (except cell?),
they all have problems and no one will try to build on those anyway.
I hope.

> This kernel AT_PLATFORM name should strip the 'ppc' prefix off, as
> well as test the AT_HWCAP for PPC_FEATURE_64::
>   .platform = "ppce500mc", -> "e500mc" | "e500mc64"

e500mc64 is a different core AFAIK, one that was never shipped anyway.

> These kernel AT_PLATFORM names do not seem to have an equivalent
> rs6000-cpus.def entry, so we probably should just treat them as
> unknown/non-existent names:
>   .platform = "pa6t",
>   .platform = "ppc5554",


Could use 970 for pa6t, if we care.  5554 is SPE (e200z6)

> I do question though, whether we should test the AT_HWCAP bits or not.  Just
> because we're on, say a 476fp system, doesn't mean the toolchain and
> libraries are compiled with FP support.  Thoughts anyone?

Not sure.  Maybe just error out?

[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2018-01-25 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

--- Comment #9 from Peter Bergner  ---
(In reply to Segher Boessenkool from comment #8)
>> This kernel AT_PLATFORM name should strip the '+' off:
>>   .platform = "power7+", -> "power7"
>
> We probably should have a -mcpu=power7+, we have power5+ as well etc.

Well, we have a -mcpu=power5+ because power5+ added a few new instructions over
and above what power5 has.  That is not the case with power7+.  It implements
the exact same instructions that power7 does, so power7+ doesn't really buy us
anything.


>> These kernel AT_PLATFORM names should strip their prefix and suffix off:
>>   .platform = "ppc440gp", -> "440"
>>   .platform = "ppc-cell-be", -> "cell"
>> 
>> These kernel AT_PLATFORM names should strip the 'ppc' prefix off, as
>> well as test the AT_HWCAP for PPC_FEATURE_HAS_FPU:
>>   .platform = "ppc405", -> "405" | "405fp"
>>   .platform = "ppc440", -> "440" | "440fp"
>> 
>> This kernel AT_PLATFORM name should strip the 'ppc' prefix off, change
>> 470 to 476 as well as test the AT_HWCAP for PPC_FEATURE_HAS_FPU:
>>   .platform = "ppc470", -> "476" | "476fp"
> 
> We could also decide not to support those for "native" (except cell?),
> they all have problems and no one will try to build on those anyway.
> I hope.

Well, it was easy enough to add support for them in case some did try in the
future.  Up to you though if you want to leave them out.


> e500mc64 is a different core AFAIK, one that was never shipped anyway.

Ok, so the current patch and the updated one I'm working on don't support it,
so I'll leave it that way.


> Could use 970 for pa6t, if we care.

Its up to you if you want me to map that to 970.  Let me know what you want me
to do.

[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2018-01-26 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

--- Comment #10 from Segher Boessenkool  ---
(In reply to Peter Bergner from comment #9)
> (In reply to Segher Boessenkool from comment #8)
> >> This kernel AT_PLATFORM name should strip the '+' off:
> >>   .platform = "power7+", -> "power7"
> >
> > We probably should have a -mcpu=power7+, we have power5+ as well etc.
> 
> Well, we have a -mcpu=power5+ because power5+ added a few new instructions
> over and above what power5 has.  That is not the case with power7+.  It
> implements the exact same instructions that power7 does, so power7+ doesn't
> really buy us anything.

It makes life simpler for users who do not know that -- like the compiler
itself with -mcpu=native :-)  (Compare with 740 vs. 750, although you could
call that historical accident).

power7 and power7+ have different cache sizes, if we ever bother to get that
right, too.

> >> These kernel AT_PLATFORM names should strip their prefix and suffix off:
> >>   .platform = "ppc440gp", -> "440"
> >>   .platform = "ppc-cell-be", -> "cell"
> >> 
> >> These kernel AT_PLATFORM names should strip the 'ppc' prefix off, as
> >> well as test the AT_HWCAP for PPC_FEATURE_HAS_FPU:
> >>   .platform = "ppc405", -> "405" | "405fp"
> >>   .platform = "ppc440", -> "440" | "440fp"
> >> 
> >> This kernel AT_PLATFORM name should strip the 'ppc' prefix off, change
> >> 470 to 476 as well as test the AT_HWCAP for PPC_FEATURE_HAS_FPU:
> >>   .platform = "ppc470", -> "476" | "476fp"
> > 
> > We could also decide not to support those for "native" (except cell?),
> > they all have problems and no one will try to build on those anyway.
> > I hope.
> 
> Well, it was easy enough to add support for them in case some did try in the
> future.  Up to you though if you want to leave them out.

The "fp" ones are not so easy.  I don't know if 440gp is the same core.

> > Could use 970 for pa6t, if we care.
> 
> Its up to you if you want me to map that to 970.  Let me know what you want
> me to do.

I don't think we care.

[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2018-02-01 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

--- Comment #11 from Peter Bergner  ---
Author: bergner
Date: Thu Feb  1 18:26:51 2018
New Revision: 257305

URL: https://gcc.gnu.org/viewcvs?rev=257305&root=gcc&view=rev
Log:
PR target/56010
PR target/83743
* config/rs6000/driver-rs6000.c: #include "diagnostic.h".
#include "opts.h".
(rs6000_supported_cpu_names): New static variable.
(linux_cpu_translation_table): Likewise.
(elf_platform) : Define new static variable and use it.
Translate kernel AT_PLATFORM name to canonical name if needed.
Error if platform name is unknown.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/driver-rs6000.c

[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2018-02-01 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

Peter Bergner  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
URL|https://gcc.gnu.org/ml/gcc- |https://gcc.gnu.org/ml/gcc-
   |patches/2018-01/msg02059.ht |patches/2018-01/msg02469.ht
   |ml  |ml
 Resolution|--- |FIXED

--- Comment #12 from Peter Bergner  ---
Fixed on trunk.  Will wait a few days and then will back port it to FSF 7.

[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2018-02-05 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

--- Comment #13 from Peter Bergner  ---
Author: bergner
Date: Mon Feb  5 19:17:37 2018
New Revision: 257392

URL: https://gcc.gnu.org/viewcvs?rev=257392&root=gcc&view=rev
Log:
Back port from mainline
2018-02-01  Peter Bergner  

PR target/56010
PR target/83743
* config/rs6000/driver-rs6000.c: #include "diagnostic.h".
#include "opts.h".
(rs6000_supported_cpu_names): New static variable.
(linux_cpu_translation_table): Likewise.
(elf_platform) : Define new static variable and use it.
Translate kernel AT_PLATFORM name to canonical name if needed.
Error if platform name is unknown.

Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/config/rs6000/driver-rs6000.c

[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2017-08-04 Thread jrtc27 at jrtc27 dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

James Clarke  changed:

   What|Removed |Added

 CC||glaubitz at physik dot 
fu-berlin.d
   ||e, jrtc27 at jrtc27 dot com

--- Comment #4 from James Clarke  ---
Ping; I just ran into this today on powerpc-linux-gnuspe (a package in Debian
fails to build because of it[0]), and -mtune=native is trying to use "ppc8548"
rather than "8548". Seems like this bug should at least be confirmed.

[0]
https://buildd.debian.org/status/fetch.php?pkg=mptp&arch=powerpcspe&ver=0.2.2-1&stamp=1490178731&raw=0

[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2013-01-17 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010



Jakub Jelinek  changed:



   What|Removed |Added



 CC||dje at gcc dot gnu.org,

   ||jakub at gcc dot gnu.org



--- Comment #1 from Jakub Jelinek  2013-01-17 
10:59:08 UTC ---

Seems the elf_platform () returned strings need some adjustment to match the

RS6000_CPU names.  Grepping Linux kernel, elf_platform can return e.g.

pa6t

power3

power4

power5

power5+

power6

power6x

power7

power7+

power8

powerpc

ppc403

ppc405

ppc440

ppc440gp

ppc470

ppc5554

ppc601

ppc603

ppc604

ppc7400

ppc7450

ppc750

ppc823

ppc8540

ppc8548

ppc970

ppca2

ppc-cell-be

ppce500mc

ppce5500

ppce6500



so, supposedly initialy "ppc" prefix, if any, should be dropped, "ppc-cell-be"

should be replaced by "cell" and most likely the string checked against the

asm_names[].cpu strings.  There are other minor differences, e.g. kernel has

ppc440 and ppc440gp, while gcc 440fp and 440 (do they match in this order, or

differently?).


[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2013-01-17 Thread bergner at vnet dot ibm.com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010



Peter Bergner  changed:



   What|Removed |Added



 CC||bergner at vnet dot ibm.com



--- Comment #2 from Peter Bergner  2013-01-17 
22:27:34 UTC ---

Jakub Jelinek wrote:

> There are other minor differences, e.g. kernel has

> ppc440 and ppc440gp, while gcc 440fp and 440 (do they

> match in this order, or differently?).



Ick, If you look at kernel/cputable.c, it seems some of the

"ppc440" cpus have the PPC_FEATURE_HAS_FPU feature bit set,

while some don't, so we can't really rely on the AT_PLATFORM

value alone for the ppc440 cpus, we'll also have to look

at the HWCAP to see whether we should use 440 or 440fp.


[Bug target/56010] Powerpc, -mcpu=native and -mtune=native use the wrong name for target 7450

2013-07-19 Thread acrux at linuxmail dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56010

acrux  changed:

   What|Removed |Added

 CC||acrux at linuxmail dot org

--- Comment #3 from acrux  ---
here same issue.


root@hermes:/usr/ports/ppc/opt/# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/powerpc-unknown-linux-gnu/4.7.3/lto-wrapper
Target: powerpc-unknown-linux-gnu
Configured with: ../gcc-4.7.3/configure --enable-bootstrap --disable-multilib
--prefix=/usr --mandir=/usr/man --libexecdir=/usr/lib
--enable-languages=c,c++,objc --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-shared --enable-lto --with-ppl
--enable-cloog-backend=ppl --disable-ppl-version-check
--disable-cloog-version-check --disable-nls --with-x=no --enable-long-long
--with-system-zlib --with-pkgversion='CRUX PPC'
--host=powerpc-unknown-linux-gnu --build=powerpc-unknown-linux-gnu
--target=powerpc-unknown-linux-gnu
Thread model: posix
gcc version 4.7.3 (CRUX PPC)

root@hermes:/usr/ports/ppc/opt/# gcc -c -Q -mcpu=native --help=target
cc1: error: unrecognized argument in option '-mcpu=ppc7450'
cc1: note: valid arguments to '-mcpu=' are: 401 403 405 405fp 440 440fp 464
464fp 476 476fp 505 601 602 603 603e 604 604e 620 630 740 7400 7450 750 801 821
823 8540 8548 860 970 G3 G4 G5 a2 cell common e300c2 e300c3 e500mc e500mc64
ec603e native power power2 power3 power4 power5 power5+ power6 power6x power7
powerpc powerpc64 rios rios1 rios2 rs64 rsc rsc1 titan
The following options are target specific:
  -G0
  -m32  [enabled]
  -m64  [disabled]
  -mabi=altivec [disabled]
  -mabi=d32 [enabled]
  -mabi=d64 [disabled]
  -mabi=ibmlongdouble   [enabled]
  -mabi=ieeelongdouble  [disabled]
  -mabi=no-altivec  [enabled]
  -mabi=no-spe  [enabled]
  -mabi=spe [disabled]
  -mads [disabled]
  -maix-struct-return   [disabled]
  -malign-  power
  -malign-branch-targets[enabled]
  -mallow-df-permute[disabled]
  -mallow-movmisalign   [enabled]
  -maltivec [disabled]
  -malways-hint [enabled]
  -mandroid [disabled]
  -mavoid-indexed-addresses [enabled]
  -mbig [enabled]
  -mbig-endian  [enabled]
  -mbionic  [disabled]
  -mbit-align   [disabled]
  -mbit-word[disabled]
  -mblock-move-inline-limit=0
  -mbss-plt [enabled]
  -mcall-
  -mcmpb[disabled]
  -mcpu=[default]
  -mdebug=
  -mdlmzb   [disabled]
  -mdouble-float[disabled]
  -meabi[disabled]
  -memb [disabled]
  -mfloat-gprs= no
  -mfp-in-toc   [enabled]
  -mfprnd   [disabled]
  -mfpu=none
  -mfriz[enabled]
  -mfull-toc[disabled]
  -mfused-madd
  -mgen-cell-microcode  [enabled]
  -mglibc   [enabled]
  -mhard-dfp[disabled]
  -mhard-float  [enabled]
  -minsert-sched-nops=
  -misel[disabled]
  -misel=no
  -misel=yes
  -mlittle  [disabled]
  -mlittle-endian   [disabled]
  -mlong-double- 0
  -mlongcall[disabled]
  -mmfcrf   [disabled]
  -mmfpgpr  [disabled]
  -mminimal-toc [disabled]
  -mmulhw   [disabled]
  -mmultiple[disabled]
  -mmvme[disabled]
  -mnew-mnemonics   [enabled]
  -mnewlib  [disabled]
  -mno-fp-in-toc[disabled]
  -mno-power[disabled]
  -mno-powerpc  [disabled]
  -mno-sum-in-toc   [disabled]
  -mno-toc  [disabled]
  -mno-traceback[disabled]
  -mno-update   [disabled]
  -mold-mnemonics   [disabled]
  -mpaired