diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-10-29 16:35:41 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-10-29 16:35:41 +0000 |
commit | 11a3310234511a806bb17fe6b412f94368af10ad (patch) | |
tree | 39bb5db624408a3136c90a9098a17650d7536fc8 /test/CodeGen/ms-intrinsics.c | |
parent | f5f351f9918d533a7c45186a3c5bc53d63e0704b (diff) | |
download | clang-11a3310234511a806bb17fe6b412f94368af10ad.tar.gz |
CodeGen: add __readfsdword builtin
The Windows NT SDK uses __readfsdword and declares it as a compiler provided
builtin (#pragma intrinsic(__readfsword). Because intrin.h is not referenced
by winnt.h, it is not possible to provide an out-of-line definition for the
intrinsic. Provide a proper compiler builtin definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220859 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ms-intrinsics.c')
-rw-r--r-- | test/CodeGen/ms-intrinsics.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/CodeGen/ms-intrinsics.c b/test/CodeGen/ms-intrinsics.c index fb0f62c61c..c952c00be9 100644 --- a/test/CodeGen/ms-intrinsics.c +++ b/test/CodeGen/ms-intrinsics.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i686--windows -fms-compatibility -Oz -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i686--windows -fms-compatibility -Oz -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK -check-prefix CHECK-I386 // RUN: %clang_cc1 -triple thumbv7--windows -fms-compatibility -Oz -emit-llvm %s -o - | FileCheck %s void *test_InterlockedExchangePointer(void * volatile *Target, void *Value) { @@ -36,3 +36,16 @@ long test_InterlockedExchange(long *Target, long Value) { // CHECK: %[[EXCHANGE:[0-9]+]] = atomicrmw xchg i32* %Target, i32 %Value seq_cst // CHECK: ret i32 %[[EXCHANGE:[0-9]+]] // CHECK: } + +#if defined(__i386__) +long test__readfsdword(unsigned long Offset) { + return __readfsdword(Offset); +} + +// CHECK-I386: define i32 @test__readfsdword(i32 %Offset){{.*}}{ +// CHECK-I386: %0 = inttoptr i32 %Offset to i32 addrspace(257)* +// CHECK-I386: %1 = load volatile i32 addrspace(257)* %0, align 4 +// CHECK-I386: ret i32 %1 +// CHECK-I386: } +#endif + |