[compiler-rt] [llvm] [clang] [clang-tools-extra] [X86] Support more ISAs to enable __builtin_cpu_supports (PR #79086)
Shengchen Kan via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 4 01:26:02 PST 2024
================
@@ -173,85 +173,86 @@ X86_FEATURE_COMPAT(AVX512VNNI, "avx512vnni", 34)
X86_FEATURE_COMPAT(AVX512BITALG, "avx512bitalg", 35)
X86_FEATURE_COMPAT(AVX512BF16, "avx512bf16", 36)
X86_FEATURE_COMPAT(AVX512VP2INTERSECT, "avx512vp2intersect", 37)
-// Features below here are not in libgcc/compiler-rt.
-X86_FEATURE (3DNOW, "3dnow")
+// Below Features has some missings comparing to gcc, it's because gcc has some
+// not one-to-one mapped in llvm.
+X86_FEATURE_COMPAT(3DNOW, "3dnow", 0)
X86_FEATURE (3DNOWA, "3dnowa")
+X86_FEATURE_COMPAT(ADX, "adx", 0)
X86_FEATURE (64BIT, "64bit")
-X86_FEATURE (ADX, "adx")
-X86_FEATURE (AMX_BF16, "amx-bf16")
-X86_FEATURE (AMX_COMPLEX, "amx-complex")
-X86_FEATURE (AMX_INT8, "amx-int8")
-X86_FEATURE (AMX_TILE, "amx-tile")
-X86_FEATURE (CLDEMOTE, "cldemote")
-X86_FEATURE (CLFLUSHOPT, "clflushopt")
-X86_FEATURE (CLWB, "clwb")
-X86_FEATURE_COMPAT(F16C, "f16c", 38)
-X86_FEATURE (CLZERO, "clzero")
-X86_FEATURE (CMPXCHG16B, "cx16")
+X86_FEATURE_COMPAT(CLDEMOTE, "cldemote", 0)
+X86_FEATURE_COMPAT(CLFLUSHOPT, "clflushopt", 0)
+X86_FEATURE_COMPAT(CLWB, "clwb", 0)
+X86_FEATURE_COMPAT(CLZERO, "clzero", 0)
+X86_FEATURE_COMPAT(CMPXCHG16B, "cx16", 0)
X86_FEATURE (CMPXCHG8B, "cx8")
+X86_FEATURE_COMPAT(ENQCMD, "enqcmd", 0)
+X86_FEATURE_COMPAT(F16C, "f16c", 0)
+X86_FEATURE_COMPAT(FSGSBASE, "fsgsbase", 0)
X86_FEATURE (CRC32, "crc32")
-X86_FEATURE (ENQCMD, "enqcmd")
-X86_FEATURE (FSGSBASE, "fsgsbase")
-X86_FEATURE (FXSR, "fxsr")
X86_FEATURE (INVPCID, "invpcid")
-X86_FEATURE (KL, "kl")
-X86_FEATURE (WIDEKL, "widekl")
-X86_FEATURE (LWP, "lwp")
-X86_FEATURE (LZCNT, "lzcnt")
-X86_FEATURE (MOVBE, "movbe")
-X86_FEATURE (MOVDIR64B, "movdir64b")
-X86_FEATURE (MOVDIRI, "movdiri")
-X86_FEATURE (MWAITX, "mwaitx")
-X86_FEATURE (PCONFIG, "pconfig")
-X86_FEATURE (PKU, "pku")
-X86_FEATURE (PREFETCHI, "prefetchi")
-X86_FEATURE (PREFETCHWT1, "prefetchwt1")
-X86_FEATURE (PRFCHW, "prfchw")
-X86_FEATURE (PTWRITE, "ptwrite")
-X86_FEATURE (RDPID, "rdpid")
X86_FEATURE (RDPRU, "rdpru")
-X86_FEATURE (RDRND, "rdrnd")
-X86_FEATURE (RDSEED, "rdseed")
-X86_FEATURE (RTM, "rtm")
X86_FEATURE (SAHF, "sahf")
-X86_FEATURE (SERIALIZE, "serialize")
-X86_FEATURE (SGX, "sgx")
-X86_FEATURE (SHA, "sha")
-X86_FEATURE (SHSTK, "shstk")
-X86_FEATURE (TBM, "tbm")
-X86_FEATURE (TSXLDTRK, "tsxldtrk")
-X86_FEATURE (UINTR, "uintr")
-X86_FEATURE (VAES, "vaes")
X86_FEATURE (VZEROUPPER, "vzeroupper")
-X86_FEATURE (WAITPKG, "waitpkg")
-X86_FEATURE (WBNOINVD, "wbnoinvd")
+X86_FEATURE_COMPAT(LWP, "lwp", 0)
+X86_FEATURE_COMPAT(LZCNT, "lzcnt", 0)
+X86_FEATURE_COMPAT(MOVBE, "movbe", 0)
+X86_FEATURE_COMPAT(MOVDIR64B, "movdir64b", 0)
+X86_FEATURE_COMPAT(MOVDIRI, "movdiri", 0)
+X86_FEATURE_COMPAT(MWAITX, "mwaitx", 0)
X86_FEATURE (X87, "x87")
-X86_FEATURE (XSAVE, "xsave")
-X86_FEATURE (XSAVEC, "xsavec")
-X86_FEATURE (XSAVEOPT, "xsaveopt")
-X86_FEATURE (XSAVES, "xsaves")
-X86_FEATURE_COMPAT(AVX512FP16, "avx512fp16", 39)
-X86_FEATURE (HRESET, "hreset")
-X86_FEATURE (RAOINT, "raoint")
-X86_FEATURE (AMX_FP16, "amx-fp16")
-X86_FEATURE (CMPCCXADD, "cmpccxadd")
-X86_FEATURE (AVXNECONVERT, "avxneconvert")
-X86_FEATURE (AVXVNNI, "avxvnni")
-X86_FEATURE (AVXIFMA, "avxifma")
-X86_FEATURE (AVXVNNIINT8, "avxvnniint8")
-X86_FEATURE (SHA512, "sha512")
-X86_FEATURE (SM3, "sm3")
-X86_FEATURE (SM4, "sm4")
-X86_FEATURE (AVXVNNIINT16, "avxvnniint16")
-X86_FEATURE (EVEX512, "evex512")
-X86_FEATURE (AVX10_1, "avx10.1-256")
-X86_FEATURE (AVX10_1_512, "avx10.1-512")
-X86_FEATURE (USERMSR, "usermsr")
-X86_FEATURE (EGPR, "egpr")
+X86_FEATURE_COMPAT(PCONFIG, "pconfig", 0)
+X86_FEATURE_COMPAT(PKU, "pku", 0)
+X86_FEATURE_COMPAT(PREFETCHWT1, "prefetchwt1", 0)
+X86_FEATURE_COMPAT(PRFCHW, "prfchw", 0)
+X86_FEATURE_COMPAT(PTWRITE, "ptwrite", 0)
+X86_FEATURE_COMPAT(RDPID, "rdpid", 0)
+X86_FEATURE_COMPAT(RDRND, "rdrnd", 0)
+X86_FEATURE_COMPAT(RDSEED, "rdseed", 0)
+X86_FEATURE_COMPAT(RTM, "rtm", 0)
+X86_FEATURE_COMPAT(SERIALIZE, "serialize", 0)
+X86_FEATURE_COMPAT(SGX, "sgx", 0)
+X86_FEATURE_COMPAT(SHA, "sha", 0)
+X86_FEATURE_COMPAT(SHSTK, "shstk", 0)
+X86_FEATURE_COMPAT(TBM, "tbm", 0)
+X86_FEATURE_COMPAT(TSXLDTRK, "tsxldtrk", 0)
+X86_FEATURE_COMPAT(VAES, "vaes", 0)
+X86_FEATURE_COMPAT(WAITPKG, "waitpkg", 0)
+X86_FEATURE_COMPAT(WBNOINVD, "wbnoinvd", 0)
+X86_FEATURE_COMPAT(XSAVE, "xsave", 0)
+X86_FEATURE_COMPAT(XSAVEC, "xsavec", 0)
+X86_FEATURE_COMPAT(XSAVEOPT, "xsaveopt", 0)
+X86_FEATURE_COMPAT(XSAVES, "xsaves", 0)
+X86_FEATURE_COMPAT(AMX_TILE, "amx-tile", 0)
+X86_FEATURE_COMPAT(AMX_INT8, "amx-int8", 0)
+X86_FEATURE_COMPAT(AMX_BF16, "amx-bf16", 0)
+X86_FEATURE_COMPAT(UINTR, "uintr", 0)
+X86_FEATURE_COMPAT(HRESET, "hreset", 0)
+X86_FEATURE_COMPAT(KL, "kl", 0)
+X86_FEATURE (FXSR, "fxsr")
+X86_FEATURE_COMPAT(WIDEKL, "widekl", 0)
+X86_FEATURE_COMPAT(AVXVNNI, "avxvnni", 0)
+X86_FEATURE_COMPAT(AVX512FP16, "avx512fp16", 0)
+X86_FEATURE (CCMP, "ccmp")
X86_FEATURE (Push2Pop2, "push2pop2")
X86_FEATURE (PPX, "ppx")
X86_FEATURE (NDD, "ndd")
-X86_FEATURE (CCMP, "ccmp")
+X86_FEATURE_COMPAT(AVXIFMA, "avxifma", 0)
+X86_FEATURE_COMPAT(AVXVNNIINT8, "avxvnniint8", 0)
+X86_FEATURE_COMPAT(AVXNECONVERT, "avxneconvert", 0)
+X86_FEATURE_COMPAT(CMPCCXADD, "cmpccxadd", 0)
+X86_FEATURE_COMPAT(AMX_FP16, "amx-fp16", 0)
+X86_FEATURE_COMPAT(PREFETCHI, "prefetchi", 0)
+X86_FEATURE_COMPAT(RAOINT, "raoint", 0)
+X86_FEATURE_COMPAT(AMX_COMPLEX, "amx-complex", 0)
+X86_FEATURE_COMPAT(AVXVNNIINT16, "avxvnniint16", 0)
+X86_FEATURE_COMPAT(SM3, "sm3", 0)
+X86_FEATURE_COMPAT(SHA512, "sha512", 0)
+X86_FEATURE_COMPAT(SM4, "sm4", 0)
+X86_FEATURE_COMPAT(EGPR, "egpr", 0)
----------------
KanRobert wrote:
I suggest we can create another PR for APX features. What we should use for X86_FEATURE_COMPAT is not clear so far.
https://github.com/llvm/llvm-project/pull/79086
More information about the cfe-commits
mailing list