[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
This commit is contained in:
Freddy Ye 2022-01-04 09:34:45 +08:00
parent 5723261370
commit 0bab742805
2 changed files with 22 additions and 0 deletions

View File

@ -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__

View File

@ -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)