On Mon, Dec 14, 2020 at 03:57:27PM +0100, Piotr Kubaj wrote: > > It is both, actually (-mcpu= implies -mtune=) > Yes, but -mtune doesn't imply -mcpu. If I set up only -mtune, -mcpu is the > generic one (ppc970 for BE)
But that is not what the patch does? > > > Linux also does similarly in linux64.h: > > > 74 #undef PROCESSOR_DEFAULT > > > 75 #define PROCESSOR_DEFAULT PROCESSOR_POWER7 > > > 76 #undef PROCESSOR_DEFAULT64 > > > 77 #define PROCESSOR_DEFAULT64 PROCESSOR_POWER8 > > > > Yes, but we still default to power4 on BE Linux (and power8 on LE). I > > get lost in the macro maze here, not sure how that works :-) I still am baffled how this works :-/ > > > Although there is hard to explain (for me) setting to tune for POWER7 on > > > 32-bits. POWER7 is 64-bit and it should be more reasonable to optimize > > > for the last 32-bit machines that still may be in use (so G4). > > > > 7450 has very different optimisation than 970. Power7 and 970 have > > largely similar pipelines. > Yes, but the point is that users on 32-bit machines don't use POWER7, but > most likely G4. Ah, but most users using -m32 are on a 64-bit machine! > > > That said, on the 64-bit front, we will just match the Linux setting. > > > > Compile a very simple test and look at the .machine in the generated .s? > > Does that do what you want? > Yes, I just tested it (on BE). > pkubaj@talos:$/usr/home/pkubaj$ cat test.c > #include <stdio.h> > > int main() > { > printf("Hello world!"); > } > > I built it twice, with GCC 9.3 without my patch and with GCC 10.1 with my > patch. The only difference is: > pkubaj@talos:$/usr/home/pkubaj$ diff -u test.s.9 test.s.10 > --- test.s.9 2020-12-14 15:51:43.203263000 +0100 > +++ test.s.10 2020-12-14 15:52:01.147238000 +0100 > @@ -43,5 +43,5 @@ > .cfi_endproc > .LFE1: > .size main,.-main > - .ident "GCC: (FreeBSD Ports Collection) 9.3.0" > + .ident "GCC: (FreeBSD Ports Collection) 10.2.0" > .section .note.GNU-stack,"",@progbits > > Both have .machine power4: > pkubaj@talos:$/usr/home/pkubaj$ grep .machine test.s.* > test.s.10: .machine power4 > test.s.9: .machine power4 > > I'm not sure where GCC sets power8 for LE, but it's definitely somewhere else. Yes... And I do not know where this power4 comes from. Mysteries :-) > So IMO this patch is good to go. Yes, thanks! Segher