1; RUN: not --crash opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -atomic-expand %s 2>&1 | FileCheck %s 2; The AtomicExpand pass cannot handle missing libcalls (yet) so reports a fatal error. 3; CHECK: LLVM ERROR: expandAtomicOpToLibcall shouldn't fail for Load 4 5define i32 @atomic_load_global_align1(i32 addrspace(1)* %ptr) { 6; GCN-LABEL: @atomic_load_global_align1( 7; GCN-NEXT: [[TMP1:%.*]] = bitcast i32 addrspace(1)* [[PTR:%.*]] to i8 addrspace(1)* 8; GCN-NEXT: [[TMP2:%.*]] = addrspacecast i8 addrspace(1)* [[TMP1]] to i8* 9; GCN-NEXT: [[TMP3:%.*]] = alloca i32, align 4 10; GCN-NEXT: [[TMP4:%.*]] = bitcast i32* [[TMP3]] to i8* 11; GCN-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[TMP4]]) 12; GCN-NEXT: call void @0(i64 4, i8* [[TMP2]], i8* [[TMP4]], i32 5) 13; GCN-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]], align 4 14; GCN-NEXT: call void @llvm.lifetime.end.p0i8(i64 4, i8* [[TMP4]]) 15; GCN-NEXT: ret i32 [[TMP5]] 16; 17 %val = load atomic i32, i32 addrspace(1)* %ptr seq_cst, align 1 18 ret i32 %val 19} 20 21define void @atomic_store_global_align1(i32 addrspace(1)* %ptr, i32 %val) { 22; GCN-LABEL: @atomic_store_global_align1( 23; GCN-NEXT: [[TMP1:%.*]] = bitcast i32 addrspace(1)* [[PTR:%.*]] to i8 addrspace(1)* 24; GCN-NEXT: [[TMP2:%.*]] = addrspacecast i8 addrspace(1)* [[TMP1]] to i8* 25; GCN-NEXT: [[TMP3:%.*]] = alloca i32, align 4 26; GCN-NEXT: [[TMP4:%.*]] = bitcast i32* [[TMP3]] to i8* 27; GCN-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[TMP4]]) 28; GCN-NEXT: store i32 [[VAL:%.*]], i32* [[TMP3]], align 4 29; GCN-NEXT: call void @1(i64 4, i8* [[TMP2]], i8* [[TMP4]], i32 0) 30; GCN-NEXT: call void @llvm.lifetime.end.p0i8(i64 4, i8* [[TMP4]]) 31; GCN-NEXT: ret void 32; 33 store atomic i32 %val, i32 addrspace(1)* %ptr monotonic, align 1 34 ret void 35} 36