summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2019-03-06 19:27:13 +0000
committerPhilip Reames <listmail@philipreames.com>2019-03-06 19:27:13 +0000
commit9549f7560f67c3a4c8319474455116ca68906fb8 (patch)
treee7e39a5491005dea32b758468f838fe91b6c2e8b /llvm/test
parenteacde7d2b021a7f3b11e408b2ed34317a5491330 (diff)
downloadbcm5719-llvm-9549f7560f67c3a4c8319474455116ca68906fb8.tar.gz
bcm5719-llvm-9549f7560f67c3a4c8319474455116ca68906fb8.zip
[AtomicExpand] Allow libcall expansion for non-zero address spaces (try 2)
Restore a reverted commit, with the silly mistake fixed. Sorry for the previous breakage. Be consistent about how we treat atomics in non-zero address spaces. If we get to the backend, we tend to lower them as if in address space 0. Do the same if we need to insert a libcall instead. Differential Revision: https://reviews.llvm.org/D58760 llvm-svn: 355540
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/AtomicExpand/X86/expand-atomic-libcall.ll34
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/test/Transforms/AtomicExpand/X86/expand-atomic-libcall.ll b/llvm/test/Transforms/AtomicExpand/X86/expand-atomic-libcall.ll
new file mode 100644
index 00000000000..0af14c5f43c
--- /dev/null
+++ b/llvm/test/Transforms/AtomicExpand/X86/expand-atomic-libcall.ll
@@ -0,0 +1,34 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -mtriple=i686-linux-gnu -atomic-expand %s | FileCheck %s
+
+
+define i256 @atomic_load256_libcall(i256* %ptr) nounwind {
+; CHECK-LABEL: @atomic_load256_libcall(
+; CHECK-NEXT: [[TMP1:%.*]] = bitcast i256* [[PTR:%.*]] to i8*
+; CHECK-NEXT: [[TMP2:%.*]] = alloca i256, align 8
+; CHECK-NEXT: [[TMP3:%.*]] = bitcast i256* [[TMP2]] to i8*
+; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 32, i8* [[TMP3]])
+; CHECK-NEXT: call void @__atomic_load(i64 32, i8* [[TMP1]], i8* [[TMP3]], i32 0)
+; CHECK-NEXT: [[TMP4:%.*]] = load i256, i256* [[TMP2]], align 8
+; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 32, i8* [[TMP3]])
+; CHECK-NEXT: ret i256 [[TMP4]]
+;
+ %result = load atomic i256, i256* %ptr unordered, align 16
+ ret i256 %result
+}
+
+define i256 @atomic_load256_libcall_as1(i256 addrspace(1)* %ptr) nounwind {
+; CHECK-LABEL: @atomic_load256_libcall_as1(
+; CHECK-NEXT: [[TMP1:%.*]] = bitcast i256 addrspace(1)* [[PTR:%.*]] to i8 addrspace(1)*
+; CHECK-NEXT: [[TMP2:%.*]] = addrspacecast i8 addrspace(1)* [[TMP1]] to i8*
+; CHECK-NEXT: [[TMP3:%.*]] = alloca i256, align 8
+; CHECK-NEXT: [[TMP4:%.*]] = bitcast i256* [[TMP3]] to i8*
+; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 32, i8* [[TMP4]])
+; CHECK-NEXT: call void @__atomic_load(i64 32, i8* [[TMP2]], i8* [[TMP4]], i32 0)
+; CHECK-NEXT: [[TMP5:%.*]] = load i256, i256* [[TMP3]], align 8
+; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 32, i8* [[TMP4]])
+; CHECK-NEXT: ret i256 [[TMP5]]
+;
+ %result = load atomic i256, i256 addrspace(1)* %ptr unordered, align 16
+ ret i256 %result
+}
OpenPOWER on IntegriCloud