[PATCH] D51805: [X86] Custom emit __builtin_rdtscp so we can emit an explicit store for the out parameter
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 7 12:17:50 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341699: [X86] Custom emit __builtin_rdtscp so we can emit an explicit store for the out… (authored by ctopper, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D51805?vs=164467&id=164490#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51805
Files:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/rd-builtins.c
Index: cfe/trunk/test/CodeGen/rd-builtins.c
===================================================================
--- cfe/trunk/test/CodeGen/rd-builtins.c
+++ cfe/trunk/test/CodeGen/rd-builtins.c
@@ -14,3 +14,12 @@
// CHECK: @test_rdtsc
// CHECK: call i64 @llvm.x86.rdtsc
}
+
+unsigned long long test_rdtscp(unsigned int *a) {
+// CHECK: @test_rdtscp
+// CHECK: [[RDTSCP:%.*]] = call { i64, i32 } @llvm.x86.rdtscp
+// CHECK: [[TSC_AUX:%.*]] = extractvalue { i64, i32 } [[RDTSCP]], 1
+// CHECK: store i32 [[TSC_AUX]], i32* %{{.*}}
+// CHECK: [[TSC:%.*]] = extractvalue { i64, i32 } [[RDTSCP]], 0
+ return __rdtscp(a);
+}
Index: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp
@@ -9158,6 +9158,12 @@
case X86::BI__rdtsc: {
return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_rdtsc));
}
+ case X86::BI__builtin_ia32_rdtscp: {
+ Value *Call = Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_rdtscp));
+ Builder.CreateDefaultAlignedStore(Builder.CreateExtractValue(Call, 1),
+ Ops[0]);
+ return Builder.CreateExtractValue(Call, 0);
+ }
case X86::BI__builtin_ia32_undef128:
case X86::BI__builtin_ia32_undef256:
case X86::BI__builtin_ia32_undef512:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51805.164490.patch
Type: text/x-patch
Size: 1357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180907/90b923fa/attachment.bin>
More information about the llvm-commits
mailing list