iains / gcc-14-branch

GCC 14 for Darwin with experimental Arm64 support. Current release 14.2-darwin-r0 [August 2024]
GNU General Public License v2.0
4 stars 2 forks source link

Apparent conflict between `-mtune=native` and `-march=native` #2

Open fxcoudert opened 2 months ago

fxcoudert commented 2 months ago

Reported first at https://github.com/fxcoudert/gfortran-for-macOS/issues/65

meau /tmp $ gfortran-14 a.f90 -O3 -mtune=native -march=native             
f951: Error: unknown value 'apple-m1' for '-march'
f951: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a armv8.6-a armv8.7-a armv8.8-a armv8.9-a armv8-r armv9-a armv9.1-a armv9.2-a armv9.3-a armv9.4-a native
f951: note: did you mean '-mcpu=apple-m1'?
iains commented 2 months ago

yeah.. I think that (like PowerPC) the incantation is -mcpu= for AArch64

iains commented 2 months ago

although, having checked with one of our Arm colleagues, apparently both should work (mcpu is said to be more user-friendly) .. so we need to look at why -march is being missed.

I'm currently chasing the second bootstrap break for Darwin [this week] so it will not be immediate.

iains commented 2 months ago

A better explanation from said colleague:

using e.g. -march=armv8.2-a+sve will give you "architectural" SVE codegen whereas e.g. -mcpu=neoverse-v1 will give SVE codegen that's better tuned to that core.

So, for our users (who are not, generally, equipped with suitable info to do -march=armv8.4-a+xx+yy+zz), we should be strongly recommending -mcpu=apple-mN.

iains commented 2 months ago

to allow -march=native to work, if that is a useful thing to do, I guess that means converting the apple-mN into the equivalent "armv8.x-a+...." string.

$ ./gcc/xgcc -Bgcc /source/test/hello.c -mcpu=native -mtune=native works OK AFAICT.