[PATCH] D11535: [AArch64] Implement __builtin_thread_pointer
Adhemerval Zanella
adhemerval.zanella at linaro.org
Mon Jul 27 12:48:31 PDT 2015
zatrazz created this revision.
zatrazz added reviewers: t.p.northover, rengolin, jmolloy.
zatrazz added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.
This path add the aarch64 __builtin_thread_pointer support. It will be
lowered to llvm.aarch64.thread.pointer.
http://reviews.llvm.org/D11535
Files:
include/clang/Basic/BuiltinsAArch64.def
lib/CodeGen/CGBuiltin.cpp
test/CodeGen/builtins-arm64.c
Index: test/CodeGen/builtins-arm64.c
===================================================================
--- test/CodeGen/builtins-arm64.c
+++ test/CodeGen/builtins-arm64.c
@@ -5,6 +5,11 @@
// CHECK: call {{.*}} @__clear_cache
}
+void *tp (void) {
+ return __builtin_thread_pointer ();
+// CHECK: call {{.*}} @llvm.aarch64.thread.pointer()
+}
+
// CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a)
unsigned rbit(unsigned a) {
return __builtin_arm_rbit(a);
Index: lib/CodeGen/CGBuiltin.cpp
===================================================================
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -4342,6 +4342,11 @@
return Builder.CreateCall(F);
}
+ if (BuiltinID == AArch64::BI__builtin_thread_pointer) {
+ Function *F = CGM.getIntrinsic(Intrinsic::aarch64_thread_pointer);
+ return Builder.CreateCall(F);
+ }
+
// CRC32
Intrinsic::ID CRCIntrinsicID = Intrinsic::not_intrinsic;
switch (BuiltinID) {
Index: include/clang/Basic/BuiltinsAArch64.def
===================================================================
--- include/clang/Basic/BuiltinsAArch64.def
+++ include/clang/Basic/BuiltinsAArch64.def
@@ -60,5 +60,6 @@
BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc")
BUILTIN(__builtin_arm_wsr64, "vcC*LUi", "nc")
BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc")
+BUILTIN(__builtin_thread_pointer, "v*", "")
#undef BUILTIN
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11535.30723.patch
Type: text/x-patch
Size: 1382 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150727/c0637a82/attachment.bin>
More information about the cfe-commits
mailing list