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?