[clang] 0bab742 - [X86] Add missing CET intrinsics support
Freddy Ye via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 3 19:41:09 PST 2022
Author: Freddy Ye
Date: 2022-01-04T11:40:40+08:00
New Revision: 0bab7428057048d94774a91c329ae902fcffc170
URL: https://github.com/llvm/llvm-project/commit/0bab7428057048d94774a91c329ae902fcffc170
DIFF: https://github.com/llvm/llvm-project/commit/0bab7428057048d94774a91c329ae902fcffc170.diff
LOG: [X86] Add missing CET intrinsics support
These two intrinsics are documented o SDM and intrinsic guide.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D116325
Added:
Modified:
clang/lib/Headers/cetintrin.h
clang/test/CodeGen/X86/cetintrin.c
Removed:
################################################################################
diff --git a/clang/lib/Headers/cetintrin.h b/clang/lib/Headers/cetintrin.h
index 4290e9d7355b9..019cab0261e7f 100644
--- a/clang/lib/Headers/cetintrin.h
+++ b/clang/lib/Headers/cetintrin.h
@@ -42,10 +42,20 @@ static __inline__ unsigned int __DEFAULT_FN_ATTRS _rdsspd(unsigned int __a) {
return __builtin_ia32_rdsspd(__a);
}
+static __inline__ unsigned int __DEFAULT_FN_ATTRS _rdsspd_i32() {
+ unsigned int t;
+ return __builtin_ia32_rdsspd(t);
+}
+
#ifdef __x86_64__
static __inline__ unsigned long long __DEFAULT_FN_ATTRS _rdsspq(unsigned long long __a) {
return __builtin_ia32_rdsspq(__a);
}
+
+static __inline__ unsigned long long __DEFAULT_FN_ATTRS _rdsspq_i64() {
+ unsigned long long t;
+ return __builtin_ia32_rdsspq(t);
+}
#endif /* __x86_64__ */
#ifdef __x86_64__
diff --git a/clang/test/CodeGen/X86/cetintrin.c b/clang/test/CodeGen/X86/cetintrin.c
index f70d1c80e1cfe..dc55745ec4508 100644
--- a/clang/test/CodeGen/X86/cetintrin.c
+++ b/clang/test/CodeGen/X86/cetintrin.c
@@ -37,6 +37,12 @@ unsigned int test_rdsspd(unsigned int a) {
return _rdsspd(a);
}
+unsigned int test_rdsspd_i32() {
+ // CHECK-LABEL: @test_rdsspd_i32
+ // CHECK: call i32 @llvm.x86.rdsspd(i32 %{{[a-z0-9.]+}})
+ return _rdsspd_i32();
+}
+
#ifdef __x86_64__
unsigned long long test_rdsspq(unsigned long long a) {
// X86_64-LABEL: @test_rdsspq
@@ -44,6 +50,12 @@ unsigned long long test_rdsspq(unsigned long long a) {
return _rdsspq(a);
}
+unsigned long long test_rdsspq_i64() {
+ // X86_64-LABEL: @test_rdsspq_i64
+ // X86_64: call i64 @llvm.x86.rdsspq(i64 %{{[a-z0-9.]+}})
+ return _rdsspq_i64();
+}
+
unsigned long long test_get_ssp(void) {
// X86_64-LABEL: @test_get_ssp
// X86_64: call i64 @llvm.x86.rdsspq(i64 0)
More information about the cfe-commits
mailing list