且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么march = native在Apple M1上不起作用?

更新时间:2023-01-11 11:24:03

据我所知,这不是 Apple M1 所特有的,对于其他各种体系结构(大多数是其他种种分支),它也会在clang中发生处理器).例如请在此处查看此错误报告 https://github.com/DMOJ/judge-server/issues/303

As far as I know this is not Apple M1 specific, it occurs also with clang for various other architectures (mostly various other arm processors). e.g. See this bug report here https://github.com/DMOJ/judge-server/issues/303

基本上,用于新体系结构的每个clang版本都必须选择为"march = native"提供默认值.是否为编译器构建的目标;如果没有,那么您将看到此错误消息.即使对于那些确实具有优化目标的手臂处理器,您通常也必须专门使用"-mcpu = xxx"而不是"-march".

Basically every build of clang for a new architecture must choose to provide defaults for "march=native" for the target for which the compiler is built or not; and if not then you will see this error message. Even for those arm processors who do have optimisation targets you often have to use specifically "-mcpu=xxx" instead of "-march".

例如对于iPhone,您可以使用 -mcpu = apple-a11 -mcpu = apple-a12 等.

e.g. For the iphone you would use -mcpu=apple-a11 -mcpu=apple-a12 etc.

但是对于 Apple M1