public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/110901] New: -march does not override -mcpu on aarch64
@ 2023-08-04 16:28 raj.khem at gmail dot com
  2023-08-04 16:52 ` [Bug target/110901] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: raj.khem at gmail dot com @ 2023-08-04 16:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110901

            Bug ID: 110901
           Summary: -march does not override -mcpu on aarch64
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: raj.khem at gmail dot com
  Target Milestone: ---

As per 

https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html#index-mcpu

When -march is used then relevant part of -mcpu are overridden by that. However
this seems to be not happening in following case with GCC13

a.s
===
.text
ptrue p0.b

=====


aarch64-yoe-linux-gcc  -mcpu=cortex-a72.cortex-a53 -mbranch-protection=standard

--sysroot=/mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/glibc/2.38-r0/recipe-sysroot
-fuse-ld=bfd -c -march=armv8.2-a+sve a.s -v
Using built-in specs.
COLLECT_GCC=../recipe-sysroot-native/usr/bin/aarch64-yoe-linux/aarch64-yoe-linux-gcc
Target: aarch64-yoe-linux
Configured with:
../../../../../../work-shared/gcc-13.2.0-r0/gcc-13.2.0/configure
--build=x86_64-linux --host=x86_64-linux --target=aarch64-yoe-linux
--prefix=/host-native/usr --exec_prefix=/host-native/usr
--bindir=/host-native/usr/bin/aarch64-yoe-linux
--sbindir=/host-native/usr/bin/aarch64-yoe-linux
--libexecdir=/host-native/usr/libexec/aarch64-yoe-linux
--datadir=/host-native/usr/share --sysconfdir=/host-native/etc
--sharedstatedir=/host-native/com --localstatedir=/host-native/var
--libdir=/host-native/usr/lib/aarch64-yoe-linux
--includedir=/host-native/usr/include --oldincludedir=/host-native/usr/include
--infodir=/host-native/usr/share/info --mandir=/host-native/usr/share/man
--disable-silent-rules --disable-dependency-tracking
--with-libtool-sysroot=/host-native --enable-clocale=generic --with-gnu-ld
--enable-shared --enable-languages=c,c++ --enable-threads=posix
--disable-multilib --enable-default-pie --enable-c99 --enable-long-long
--enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=aarch64-yoe-linux-
--without-local-prefix --disable-install-libiberty --disable-libssp
--enable-libitm --enable-lto --disable-bootstrap --with-system-zlib
--with-linker-hash-style=sysv --enable-linker-build-id --with-ppl=no
--with-cloog=no --enable-checking=release --enable-cheaders=c_global
--without-isl --with-gxx-include-dir=/not/exist/usr/include/c++/13.2.0
--with-sysroot=/not/exist --with-build-sysroot=/host
--enable-poison-system-directories=error --with-system-zlib --disable-static
--disable-nls --with-glibc-version=2.28 --enable-initfini-array
--enable-__cxa_atexit
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (GCC)
COLLECT_GCC_OPTIONS='-mcpu=cortex-a72.cortex-a53'
'-mbranch-protection=standard'
'--sysroot=/mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/glibc/2.38-r0/recipe-sysroot'
'-fuse-ld=bfd' '-c' '-march=armv8.2-a+sve' '-v' '-mlittle-endian' '-mabi=lp64'

/mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/glibc/2.38-r0/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../../libexec/aarch64-yoe-linux/gcc/aarch64-yoe-linux/13.2.0/as
-v -EL -march=armv8.2-a+sve -march=armv8-a+crc -mabi=lp64 -o a.o a.s
GNU assembler version 2.41.0 (aarch64-yoe-linux) using BFD version (GNU
Binutils) 2.41.0.20230731
a.s: Assembler messages:
a.s:2: Error: selected processor does not support `ptrue p0.b'


However if I remove -mcpu=cortex-a72.cortex-a53 or change it to
-mcpu=cortex-a72.cortex-a53+sve then it works ok. Interesting part is -march
values in the assembler commandline order.

as -v -EL -march=armv8.2-a+sve -march=armv8-a+crc -mabi=lp64 -o a.o a.s

as we can see the -march computed from -mcpu is specified *after* the -march
passed by user.

is this a bug?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/110901] -march does not override -mcpu on aarch64
  2023-08-04 16:28 [Bug driver/110901] New: -march does not override -mcpu on aarch64 raj.khem at gmail dot com
@ 2023-08-04 16:52 ` pinskia at gcc dot gnu.org
  2023-08-04 16:56 ` raj.khem at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-04 16:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110901

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Order matters. In this case -march is after -mcpu ...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/110901] -march does not override -mcpu on aarch64
  2023-08-04 16:28 [Bug driver/110901] New: -march does not override -mcpu on aarch64 raj.khem at gmail dot com
  2023-08-04 16:52 ` [Bug target/110901] " pinskia at gcc dot gnu.org
@ 2023-08-04 16:56 ` raj.khem at gmail dot com
  2023-08-04 17:01 ` [Bug target/110901] -march does not override -mcpu (big.little " pinskia at gcc dot gnu.org
  2023-08-07 13:26 ` rearnsha at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: raj.khem at gmail dot com @ 2023-08-04 16:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110901

--- Comment #2 from Khem Raj <raj.khem at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> Order matters. In this case -march is after -mcpu ...

It does not seem to be effective in this case. I tried to specify -mcpu after
-march and vice-versa, result is same 


% ../recipe-sysroot-native/usr/bin/aarch64-yoe-linux/aarch64-yoe-linux-gcc
-mbranch-protection=standard 
--sysroot=/mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/glibc/2.38-r0/recipe-sysroot
-fuse-ld=bfd -c -march=armv8.2-a+sve -mcpu=cortex-a72.cortex-a53  a.s
a.s: Assembler messages:
a.s:2: Error: selected processor does not support `ptrue p0.b'

../recipe-sysroot-native/usr/bin/aarch64-yoe-linux/aarch64-yoe-linux-gcc
-mbranch-protection=standard 
--sysroot=/mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/glibc/2.38-r0/recipe-sysroot
-fuse-ld=bfd -c -mcpu=cortex-a72.cortex-a53 -march=armv8.2-a+sve  a.s
a.s: Assembler messages:
a.s:2: Error: selected processor does not support `ptrue p0.b'

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/110901] -march does not override -mcpu (big.little on aarch64
  2023-08-04 16:28 [Bug driver/110901] New: -march does not override -mcpu on aarch64 raj.khem at gmail dot com
  2023-08-04 16:52 ` [Bug target/110901] " pinskia at gcc dot gnu.org
  2023-08-04 16:56 ` raj.khem at gmail dot com
@ 2023-08-04 17:01 ` pinskia at gcc dot gnu.org
  2023-08-07 13:26 ` rearnsha at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-04 17:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110901

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
With C code, these use of -march and -mcpu would normally be rejected even.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/110901] -march does not override -mcpu (big.little on aarch64
  2023-08-04 16:28 [Bug driver/110901] New: -march does not override -mcpu on aarch64 raj.khem at gmail dot com
                   ` (2 preceding siblings ...)
  2023-08-04 17:01 ` [Bug target/110901] -march does not override -mcpu (big.little " pinskia at gcc dot gnu.org
@ 2023-08-07 13:26 ` rearnsha at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2023-08-07 13:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110901

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-08-07
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #4 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
I think this is a driver bug.  The MCPU_TO_MARCH_SPEC should be wrapped with 

%{!march=*:...} 

so that the CPU architecture is ignored if -march has been explicitly
specified.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-07 13:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-04 16:28 [Bug driver/110901] New: -march does not override -mcpu on aarch64 raj.khem at gmail dot com
2023-08-04 16:52 ` [Bug target/110901] " pinskia at gcc dot gnu.org
2023-08-04 16:56 ` raj.khem at gmail dot com
2023-08-04 17:01 ` [Bug target/110901] -march does not override -mcpu (big.little " pinskia at gcc dot gnu.org
2023-08-07 13:26 ` rearnsha at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).