[clang] [Clang] Support target attr specifying CPU (PR #68678)

Qiu Chaofan via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 16 02:08:03 PDT 2023


================
@@ -76,10 +80,14 @@ int __attribute__((target("fpmath=387"))) walrus(void) { return 4; }
 int __attribute__((target("float128,arch=hiss"))) meow(void) {  return 4; }
 // no warning, same as saying 'nothing'.
 int __attribute__((target("arch="))) turtle(void) { return 4; }
+// no warning, same as saying 'nothing'.
+int __attribute__((target("cpu="))) equus(void) { return 4; }
 //expected-warning at +1 {{unknown CPU 'hiss' in the 'target' attribute string; 'target' attribute ignored}}
 int __attribute__((target("arch=hiss,arch=woof"))) pine_tree(void) { return 4; }
 //expected-warning at +1 {{duplicate 'arch=' in the 'target' attribute string; 'target' attribute ignored}}
 int __attribute__((target("arch=pwr9,arch=pwr10"))) oak_tree(void) { return 4; }
+//expected-warning at +1 {{duplicate 'cpu=' in the 'target' attribute string; 'target' attribute ignored}}
----------------
ecnelises wrote:

AArch64 has its own implementation, this behavior is consistent with it. Maybe another patch to unify the warning message of AArch64 and other to `duplicate 'arch=/cpu=' in ...` helps.

https://github.com/llvm/llvm-project/pull/68678


More information about the cfe-commits mailing list