1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -mtriple=i686-linux-gnu -atomic-expand %s | FileCheck %s
3
4
5define i256 @atomic_load256_libcall(i256* %ptr) nounwind {
6; CHECK-LABEL: @atomic_load256_libcall(
7; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i256* [[PTR:%.*]] to i8*
8; CHECK-NEXT:    [[TMP2:%.*]] = alloca i256, align 8
9; CHECK-NEXT:    [[TMP3:%.*]] = bitcast i256* [[TMP2]] to i8*
10; CHECK-NEXT:    call void @llvm.lifetime.start.p0i8(i64 32, i8* [[TMP3]])
11; CHECK-NEXT:    call void @__atomic_load(i64 32, i8* [[TMP1]], i8* [[TMP3]], i32 0)
12; CHECK-NEXT:    [[TMP4:%.*]] = load i256, i256* [[TMP2]], align 8
13; CHECK-NEXT:    call void @llvm.lifetime.end.p0i8(i64 32, i8* [[TMP3]])
14; CHECK-NEXT:    ret i256 [[TMP4]]
15;
16  %result = load atomic i256, i256* %ptr unordered, align 16
17  ret i256 %result
18}
19
20define i256 @atomic_load256_libcall_as1(i256 addrspace(1)* %ptr) nounwind {
21; CHECK-LABEL: @atomic_load256_libcall_as1(
22; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i256 addrspace(1)* [[PTR:%.*]] to i8 addrspace(1)*
23; CHECK-NEXT:    [[TMP2:%.*]] = addrspacecast i8 addrspace(1)* [[TMP1]] to i8*
24; CHECK-NEXT:    [[TMP3:%.*]] = alloca i256, align 8
25; CHECK-NEXT:    [[TMP4:%.*]] = bitcast i256* [[TMP3]] to i8*
26; CHECK-NEXT:    call void @llvm.lifetime.start.p0i8(i64 32, i8* [[TMP4]])
27; CHECK-NEXT:    call void @__atomic_load(i64 32, i8* [[TMP2]], i8* [[TMP4]], i32 0)
28; CHECK-NEXT:    [[TMP5:%.*]] = load i256, i256* [[TMP3]], align 8
29; CHECK-NEXT:    call void @llvm.lifetime.end.p0i8(i64 32, i8* [[TMP4]])
30; CHECK-NEXT:    ret i256 [[TMP5]]
31;
32  %result = load atomic i256, i256 addrspace(1)* %ptr unordered, align 16
33  ret i256 %result
34}
35