| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,264 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
| ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=hawaii -atomic-expand %s | FileCheck -check-prefix=CI %s | ||
| ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -atomic-expand %s | FileCheck -check-prefix=GFX9 %s | ||
|
|
||
| define float @test_atomicrmw_fadd_f32_flat(float* %ptr, float %value) { | ||
| ; CI-LABEL: @test_atomicrmw_fadd_f32_flat( | ||
| ; CI-NEXT: [[TMP1:%.*]] = load float, float* [[PTR:%.*]], align 4 | ||
| ; CI-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CI: atomicrmw.start: | ||
| ; CI-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CI-NEXT: [[NEW:%.*]] = fadd float [[LOADED]], [[VALUE:%.*]] | ||
| ; CI-NEXT: [[TMP2:%.*]] = bitcast float* [[PTR]] to i32* | ||
| ; CI-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; CI-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; CI-NEXT: [[TMP5:%.*]] = cmpxchg i32* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; CI-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; CI-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; CI-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; CI-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CI: atomicrmw.end: | ||
| ; CI-NEXT: ret float [[TMP6]] | ||
| ; | ||
| ; GFX9-LABEL: @test_atomicrmw_fadd_f32_flat( | ||
| ; GFX9-NEXT: [[TMP1:%.*]] = load float, float* [[PTR:%.*]], align 4 | ||
| ; GFX9-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GFX9: atomicrmw.start: | ||
| ; GFX9-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GFX9-NEXT: [[NEW:%.*]] = fadd float [[LOADED]], [[VALUE:%.*]] | ||
| ; GFX9-NEXT: [[TMP2:%.*]] = bitcast float* [[PTR]] to i32* | ||
| ; GFX9-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; GFX9-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; GFX9-NEXT: [[TMP5:%.*]] = cmpxchg i32* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; GFX9-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; GFX9-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; GFX9-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; GFX9-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GFX9: atomicrmw.end: | ||
| ; GFX9-NEXT: ret float [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fadd float* %ptr, float %value seq_cst | ||
| ret float %res | ||
| } | ||
|
|
||
| define float @test_atomicrmw_fadd_f32_global(float addrspace(1)* %ptr, float %value) { | ||
| ; CI-LABEL: @test_atomicrmw_fadd_f32_global( | ||
| ; CI-NEXT: [[TMP1:%.*]] = load float, float addrspace(1)* [[PTR:%.*]], align 4 | ||
| ; CI-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CI: atomicrmw.start: | ||
| ; CI-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CI-NEXT: [[NEW:%.*]] = fadd float [[LOADED]], [[VALUE:%.*]] | ||
| ; CI-NEXT: [[TMP2:%.*]] = bitcast float addrspace(1)* [[PTR]] to i32 addrspace(1)* | ||
| ; CI-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; CI-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; CI-NEXT: [[TMP5:%.*]] = cmpxchg i32 addrspace(1)* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; CI-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; CI-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; CI-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; CI-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CI: atomicrmw.end: | ||
| ; CI-NEXT: ret float [[TMP6]] | ||
| ; | ||
| ; GFX9-LABEL: @test_atomicrmw_fadd_f32_global( | ||
| ; GFX9-NEXT: [[TMP1:%.*]] = load float, float addrspace(1)* [[PTR:%.*]], align 4 | ||
| ; GFX9-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GFX9: atomicrmw.start: | ||
| ; GFX9-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GFX9-NEXT: [[NEW:%.*]] = fadd float [[LOADED]], [[VALUE:%.*]] | ||
| ; GFX9-NEXT: [[TMP2:%.*]] = bitcast float addrspace(1)* [[PTR]] to i32 addrspace(1)* | ||
| ; GFX9-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; GFX9-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; GFX9-NEXT: [[TMP5:%.*]] = cmpxchg i32 addrspace(1)* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; GFX9-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; GFX9-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; GFX9-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; GFX9-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GFX9: atomicrmw.end: | ||
| ; GFX9-NEXT: ret float [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fadd float addrspace(1)* %ptr, float %value seq_cst | ||
| ret float %res | ||
| } | ||
|
|
||
| define float @test_atomicrmw_fadd_f32_local(float addrspace(3)* %ptr, float %value) { | ||
| ; CI-LABEL: @test_atomicrmw_fadd_f32_local( | ||
| ; CI-NEXT: [[TMP1:%.*]] = load float, float addrspace(3)* [[PTR:%.*]], align 4 | ||
| ; CI-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CI: atomicrmw.start: | ||
| ; CI-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CI-NEXT: [[NEW:%.*]] = fadd float [[LOADED]], [[VALUE:%.*]] | ||
| ; CI-NEXT: [[TMP2:%.*]] = bitcast float addrspace(3)* [[PTR]] to i32 addrspace(3)* | ||
| ; CI-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; CI-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; CI-NEXT: [[TMP5:%.*]] = cmpxchg i32 addrspace(3)* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; CI-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; CI-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; CI-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; CI-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CI: atomicrmw.end: | ||
| ; CI-NEXT: ret float [[TMP6]] | ||
| ; | ||
| ; GFX9-LABEL: @test_atomicrmw_fadd_f32_local( | ||
| ; GFX9-NEXT: [[RES:%.*]] = atomicrmw fadd float addrspace(3)* [[PTR:%.*]], float [[VALUE:%.*]] seq_cst | ||
| ; GFX9-NEXT: ret float [[RES]] | ||
| ; | ||
| %res = atomicrmw fadd float addrspace(3)* %ptr, float %value seq_cst | ||
| ret float %res | ||
| } | ||
|
|
||
| define half @test_atomicrmw_fadd_f16_flat(half* %ptr, half %value) { | ||
| ; CI-LABEL: @test_atomicrmw_fadd_f16_flat( | ||
| ; CI-NEXT: [[RES:%.*]] = atomicrmw fadd half* [[PTR:%.*]], half [[VALUE:%.*]] seq_cst | ||
| ; CI-NEXT: ret half [[RES]] | ||
| ; | ||
| ; GFX9-LABEL: @test_atomicrmw_fadd_f16_flat( | ||
| ; GFX9-NEXT: [[RES:%.*]] = atomicrmw fadd half* [[PTR:%.*]], half [[VALUE:%.*]] seq_cst | ||
| ; GFX9-NEXT: ret half [[RES]] | ||
| ; | ||
| %res = atomicrmw fadd half* %ptr, half %value seq_cst | ||
| ret half %res | ||
| } | ||
|
|
||
| define half @test_atomicrmw_fadd_f16_global(half addrspace(1)* %ptr, half %value) { | ||
| ; CI-LABEL: @test_atomicrmw_fadd_f16_global( | ||
| ; CI-NEXT: [[RES:%.*]] = atomicrmw fadd half addrspace(1)* [[PTR:%.*]], half [[VALUE:%.*]] seq_cst | ||
| ; CI-NEXT: ret half [[RES]] | ||
| ; | ||
| ; GFX9-LABEL: @test_atomicrmw_fadd_f16_global( | ||
| ; GFX9-NEXT: [[RES:%.*]] = atomicrmw fadd half addrspace(1)* [[PTR:%.*]], half [[VALUE:%.*]] seq_cst | ||
| ; GFX9-NEXT: ret half [[RES]] | ||
| ; | ||
| %res = atomicrmw fadd half addrspace(1)* %ptr, half %value seq_cst | ||
| ret half %res | ||
| } | ||
|
|
||
| define half @test_atomicrmw_fadd_f16_local(half addrspace(3)* %ptr, half %value) { | ||
| ; CI-LABEL: @test_atomicrmw_fadd_f16_local( | ||
| ; CI-NEXT: [[RES:%.*]] = atomicrmw fadd half addrspace(3)* [[PTR:%.*]], half [[VALUE:%.*]] seq_cst | ||
| ; CI-NEXT: ret half [[RES]] | ||
| ; | ||
| ; GFX9-LABEL: @test_atomicrmw_fadd_f16_local( | ||
| ; GFX9-NEXT: [[RES:%.*]] = atomicrmw fadd half addrspace(3)* [[PTR:%.*]], half [[VALUE:%.*]] seq_cst | ||
| ; GFX9-NEXT: ret half [[RES]] | ||
| ; | ||
| %res = atomicrmw fadd half addrspace(3)* %ptr, half %value seq_cst | ||
| ret half %res | ||
| } | ||
|
|
||
| define double @test_atomicrmw_fadd_f64_flat(double* %ptr, double %value) { | ||
| ; CI-LABEL: @test_atomicrmw_fadd_f64_flat( | ||
| ; CI-NEXT: [[TMP1:%.*]] = load double, double* [[PTR:%.*]], align 8 | ||
| ; CI-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CI: atomicrmw.start: | ||
| ; CI-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CI-NEXT: [[NEW:%.*]] = fadd double [[LOADED]], [[VALUE:%.*]] | ||
| ; CI-NEXT: [[TMP2:%.*]] = bitcast double* [[PTR]] to i64* | ||
| ; CI-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; CI-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; CI-NEXT: [[TMP5:%.*]] = cmpxchg i64* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; CI-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; CI-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; CI-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; CI-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CI: atomicrmw.end: | ||
| ; CI-NEXT: ret double [[TMP6]] | ||
| ; | ||
| ; GFX9-LABEL: @test_atomicrmw_fadd_f64_flat( | ||
| ; GFX9-NEXT: [[TMP1:%.*]] = load double, double* [[PTR:%.*]], align 8 | ||
| ; GFX9-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GFX9: atomicrmw.start: | ||
| ; GFX9-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GFX9-NEXT: [[NEW:%.*]] = fadd double [[LOADED]], [[VALUE:%.*]] | ||
| ; GFX9-NEXT: [[TMP2:%.*]] = bitcast double* [[PTR]] to i64* | ||
| ; GFX9-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; GFX9-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; GFX9-NEXT: [[TMP5:%.*]] = cmpxchg i64* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; GFX9-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; GFX9-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; GFX9-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; GFX9-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GFX9: atomicrmw.end: | ||
| ; GFX9-NEXT: ret double [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fadd double* %ptr, double %value seq_cst | ||
| ret double %res | ||
| } | ||
|
|
||
| define double @test_atomicrmw_fadd_f64_global(double addrspace(1)* %ptr, double %value) { | ||
| ; CI-LABEL: @test_atomicrmw_fadd_f64_global( | ||
| ; CI-NEXT: [[TMP1:%.*]] = load double, double addrspace(1)* [[PTR:%.*]], align 8 | ||
| ; CI-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CI: atomicrmw.start: | ||
| ; CI-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CI-NEXT: [[NEW:%.*]] = fadd double [[LOADED]], [[VALUE:%.*]] | ||
| ; CI-NEXT: [[TMP2:%.*]] = bitcast double addrspace(1)* [[PTR]] to i64 addrspace(1)* | ||
| ; CI-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; CI-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; CI-NEXT: [[TMP5:%.*]] = cmpxchg i64 addrspace(1)* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; CI-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; CI-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; CI-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; CI-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CI: atomicrmw.end: | ||
| ; CI-NEXT: ret double [[TMP6]] | ||
| ; | ||
| ; GFX9-LABEL: @test_atomicrmw_fadd_f64_global( | ||
| ; GFX9-NEXT: [[TMP1:%.*]] = load double, double addrspace(1)* [[PTR:%.*]], align 8 | ||
| ; GFX9-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GFX9: atomicrmw.start: | ||
| ; GFX9-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GFX9-NEXT: [[NEW:%.*]] = fadd double [[LOADED]], [[VALUE:%.*]] | ||
| ; GFX9-NEXT: [[TMP2:%.*]] = bitcast double addrspace(1)* [[PTR]] to i64 addrspace(1)* | ||
| ; GFX9-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; GFX9-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; GFX9-NEXT: [[TMP5:%.*]] = cmpxchg i64 addrspace(1)* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; GFX9-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; GFX9-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; GFX9-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; GFX9-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GFX9: atomicrmw.end: | ||
| ; GFX9-NEXT: ret double [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fadd double addrspace(1)* %ptr, double %value seq_cst | ||
| ret double %res | ||
| } | ||
|
|
||
| define double @test_atomicrmw_fadd_f64_local(double addrspace(3)* %ptr, double %value) { | ||
| ; CI-LABEL: @test_atomicrmw_fadd_f64_local( | ||
| ; CI-NEXT: [[TMP1:%.*]] = load double, double addrspace(3)* [[PTR:%.*]], align 8 | ||
| ; CI-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CI: atomicrmw.start: | ||
| ; CI-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CI-NEXT: [[NEW:%.*]] = fadd double [[LOADED]], [[VALUE:%.*]] | ||
| ; CI-NEXT: [[TMP2:%.*]] = bitcast double addrspace(3)* [[PTR]] to i64 addrspace(3)* | ||
| ; CI-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; CI-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; CI-NEXT: [[TMP5:%.*]] = cmpxchg i64 addrspace(3)* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; CI-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; CI-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; CI-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; CI-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CI: atomicrmw.end: | ||
| ; CI-NEXT: ret double [[TMP6]] | ||
| ; | ||
| ; GFX9-LABEL: @test_atomicrmw_fadd_f64_local( | ||
| ; GFX9-NEXT: [[TMP1:%.*]] = load double, double addrspace(3)* [[PTR:%.*]], align 8 | ||
| ; GFX9-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GFX9: atomicrmw.start: | ||
| ; GFX9-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GFX9-NEXT: [[NEW:%.*]] = fadd double [[LOADED]], [[VALUE:%.*]] | ||
| ; GFX9-NEXT: [[TMP2:%.*]] = bitcast double addrspace(3)* [[PTR]] to i64 addrspace(3)* | ||
| ; GFX9-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; GFX9-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; GFX9-NEXT: [[TMP5:%.*]] = cmpxchg i64 addrspace(3)* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; GFX9-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; GFX9-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; GFX9-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; GFX9-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GFX9: atomicrmw.end: | ||
| ; GFX9-NEXT: ret double [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fadd double addrspace(3)* %ptr, double %value seq_cst | ||
| ret double %res | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,201 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
| ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=hawaii -atomic-expand %s | FileCheck -check-prefix=GCN %s | ||
| ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -atomic-expand %s | FileCheck -check-prefix=GCN %s | ||
|
|
||
| define float @test_atomicrmw_fadd_f32_flat(float* %ptr, float %value) { | ||
| ; GCN-LABEL: @test_atomicrmw_fadd_f32_flat( | ||
| ; GCN-NEXT: [[TMP1:%.*]] = load float, float* [[PTR:%.*]], align 4 | ||
| ; GCN-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GCN: atomicrmw.start: | ||
| ; GCN-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GCN-NEXT: [[NEW:%.*]] = fsub float [[LOADED]], [[VALUE:%.*]] | ||
| ; GCN-NEXT: [[TMP2:%.*]] = bitcast float* [[PTR]] to i32* | ||
| ; GCN-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; GCN-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; GCN-NEXT: [[TMP5:%.*]] = cmpxchg i32* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; GCN-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; GCN-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; GCN-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; GCN-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GCN: atomicrmw.end: | ||
| ; GCN-NEXT: ret float [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub float* %ptr, float %value seq_cst | ||
| ret float %res | ||
| } | ||
|
|
||
| define float @test_atomicrmw_fsub_f32_global(float addrspace(1)* %ptr, float %value) { | ||
| ; GCN-LABEL: @test_atomicrmw_fsub_f32_global( | ||
| ; GCN-NEXT: [[TMP1:%.*]] = load float, float addrspace(1)* [[PTR:%.*]], align 4 | ||
| ; GCN-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GCN: atomicrmw.start: | ||
| ; GCN-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GCN-NEXT: [[NEW:%.*]] = fsub float [[LOADED]], [[VALUE:%.*]] | ||
| ; GCN-NEXT: [[TMP2:%.*]] = bitcast float addrspace(1)* [[PTR]] to i32 addrspace(1)* | ||
| ; GCN-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; GCN-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; GCN-NEXT: [[TMP5:%.*]] = cmpxchg i32 addrspace(1)* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; GCN-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; GCN-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; GCN-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; GCN-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GCN: atomicrmw.end: | ||
| ; GCN-NEXT: ret float [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub float addrspace(1)* %ptr, float %value seq_cst | ||
| ret float %res | ||
| } | ||
|
|
||
| define float @test_atomicrmw_fsub_f32_local(float addrspace(3)* %ptr, float %value) { | ||
| ; GCN-LABEL: @test_atomicrmw_fsub_f32_local( | ||
| ; GCN-NEXT: [[TMP1:%.*]] = load float, float addrspace(3)* [[PTR:%.*]], align 4 | ||
| ; GCN-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GCN: atomicrmw.start: | ||
| ; GCN-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GCN-NEXT: [[NEW:%.*]] = fsub float [[LOADED]], [[VALUE:%.*]] | ||
| ; GCN-NEXT: [[TMP2:%.*]] = bitcast float addrspace(3)* [[PTR]] to i32 addrspace(3)* | ||
| ; GCN-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; GCN-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; GCN-NEXT: [[TMP5:%.*]] = cmpxchg i32 addrspace(3)* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; GCN-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; GCN-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; GCN-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; GCN-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GCN: atomicrmw.end: | ||
| ; GCN-NEXT: ret float [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub float addrspace(3)* %ptr, float %value seq_cst | ||
| ret float %res | ||
| } | ||
|
|
||
| define half @test_atomicrmw_fsub_f16_flat(half* %ptr, half %value) { | ||
| ; GCN-LABEL: @test_atomicrmw_fsub_f16_flat( | ||
| ; GCN-NEXT: [[TMP1:%.*]] = load half, half* [[PTR:%.*]], align 2 | ||
| ; GCN-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GCN: atomicrmw.start: | ||
| ; GCN-NEXT: [[LOADED:%.*]] = phi half [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GCN-NEXT: [[NEW:%.*]] = fsub half [[LOADED]], [[VALUE:%.*]] | ||
| ; GCN-NEXT: [[TMP2:%.*]] = bitcast half* [[PTR]] to i16* | ||
| ; GCN-NEXT: [[TMP3:%.*]] = bitcast half [[NEW]] to i16 | ||
| ; GCN-NEXT: [[TMP4:%.*]] = bitcast half [[LOADED]] to i16 | ||
| ; GCN-NEXT: [[TMP5:%.*]] = cmpxchg i16* [[TMP2]], i16 [[TMP4]], i16 [[TMP3]] seq_cst seq_cst | ||
| ; GCN-NEXT: [[SUCCESS:%.*]] = extractvalue { i16, i1 } [[TMP5]], 1 | ||
| ; GCN-NEXT: [[NEWLOADED:%.*]] = extractvalue { i16, i1 } [[TMP5]], 0 | ||
| ; GCN-NEXT: [[TMP6]] = bitcast i16 [[NEWLOADED]] to half | ||
| ; GCN-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GCN: atomicrmw.end: | ||
| ; GCN-NEXT: ret half [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub half* %ptr, half %value seq_cst | ||
| ret half %res | ||
| } | ||
|
|
||
| define half @test_atomicrmw_fsub_f16_global(half addrspace(1)* %ptr, half %value) { | ||
| ; GCN-LABEL: @test_atomicrmw_fsub_f16_global( | ||
| ; GCN-NEXT: [[TMP1:%.*]] = load half, half addrspace(1)* [[PTR:%.*]], align 2 | ||
| ; GCN-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GCN: atomicrmw.start: | ||
| ; GCN-NEXT: [[LOADED:%.*]] = phi half [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GCN-NEXT: [[NEW:%.*]] = fsub half [[LOADED]], [[VALUE:%.*]] | ||
| ; GCN-NEXT: [[TMP2:%.*]] = bitcast half addrspace(1)* [[PTR]] to i16 addrspace(1)* | ||
| ; GCN-NEXT: [[TMP3:%.*]] = bitcast half [[NEW]] to i16 | ||
| ; GCN-NEXT: [[TMP4:%.*]] = bitcast half [[LOADED]] to i16 | ||
| ; GCN-NEXT: [[TMP5:%.*]] = cmpxchg i16 addrspace(1)* [[TMP2]], i16 [[TMP4]], i16 [[TMP3]] seq_cst seq_cst | ||
| ; GCN-NEXT: [[SUCCESS:%.*]] = extractvalue { i16, i1 } [[TMP5]], 1 | ||
| ; GCN-NEXT: [[NEWLOADED:%.*]] = extractvalue { i16, i1 } [[TMP5]], 0 | ||
| ; GCN-NEXT: [[TMP6]] = bitcast i16 [[NEWLOADED]] to half | ||
| ; GCN-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GCN: atomicrmw.end: | ||
| ; GCN-NEXT: ret half [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub half addrspace(1)* %ptr, half %value seq_cst | ||
| ret half %res | ||
| } | ||
|
|
||
| define half @test_atomicrmw_fsub_f16_local(half addrspace(3)* %ptr, half %value) { | ||
| ; GCN-LABEL: @test_atomicrmw_fsub_f16_local( | ||
| ; GCN-NEXT: [[TMP1:%.*]] = load half, half addrspace(3)* [[PTR:%.*]], align 2 | ||
| ; GCN-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GCN: atomicrmw.start: | ||
| ; GCN-NEXT: [[LOADED:%.*]] = phi half [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GCN-NEXT: [[NEW:%.*]] = fsub half [[LOADED]], [[VALUE:%.*]] | ||
| ; GCN-NEXT: [[TMP2:%.*]] = bitcast half addrspace(3)* [[PTR]] to i16 addrspace(3)* | ||
| ; GCN-NEXT: [[TMP3:%.*]] = bitcast half [[NEW]] to i16 | ||
| ; GCN-NEXT: [[TMP4:%.*]] = bitcast half [[LOADED]] to i16 | ||
| ; GCN-NEXT: [[TMP5:%.*]] = cmpxchg i16 addrspace(3)* [[TMP2]], i16 [[TMP4]], i16 [[TMP3]] seq_cst seq_cst | ||
| ; GCN-NEXT: [[SUCCESS:%.*]] = extractvalue { i16, i1 } [[TMP5]], 1 | ||
| ; GCN-NEXT: [[NEWLOADED:%.*]] = extractvalue { i16, i1 } [[TMP5]], 0 | ||
| ; GCN-NEXT: [[TMP6]] = bitcast i16 [[NEWLOADED]] to half | ||
| ; GCN-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GCN: atomicrmw.end: | ||
| ; GCN-NEXT: ret half [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub half addrspace(3)* %ptr, half %value seq_cst | ||
| ret half %res | ||
| } | ||
|
|
||
| define double @test_atomicrmw_fsub_f64_flat(double* %ptr, double %value) { | ||
| ; GCN-LABEL: @test_atomicrmw_fsub_f64_flat( | ||
| ; GCN-NEXT: [[TMP1:%.*]] = load double, double* [[PTR:%.*]], align 8 | ||
| ; GCN-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GCN: atomicrmw.start: | ||
| ; GCN-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GCN-NEXT: [[NEW:%.*]] = fsub double [[LOADED]], [[VALUE:%.*]] | ||
| ; GCN-NEXT: [[TMP2:%.*]] = bitcast double* [[PTR]] to i64* | ||
| ; GCN-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; GCN-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; GCN-NEXT: [[TMP5:%.*]] = cmpxchg i64* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; GCN-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; GCN-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; GCN-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; GCN-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GCN: atomicrmw.end: | ||
| ; GCN-NEXT: ret double [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub double* %ptr, double %value seq_cst | ||
| ret double %res | ||
| } | ||
|
|
||
| define double @test_atomicrmw_fsub_f64_global(double addrspace(1)* %ptr, double %value) { | ||
| ; GCN-LABEL: @test_atomicrmw_fsub_f64_global( | ||
| ; GCN-NEXT: [[TMP1:%.*]] = load double, double addrspace(1)* [[PTR:%.*]], align 8 | ||
| ; GCN-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GCN: atomicrmw.start: | ||
| ; GCN-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GCN-NEXT: [[NEW:%.*]] = fsub double [[LOADED]], [[VALUE:%.*]] | ||
| ; GCN-NEXT: [[TMP2:%.*]] = bitcast double addrspace(1)* [[PTR]] to i64 addrspace(1)* | ||
| ; GCN-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; GCN-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; GCN-NEXT: [[TMP5:%.*]] = cmpxchg i64 addrspace(1)* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; GCN-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; GCN-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; GCN-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; GCN-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GCN: atomicrmw.end: | ||
| ; GCN-NEXT: ret double [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub double addrspace(1)* %ptr, double %value seq_cst | ||
| ret double %res | ||
| } | ||
|
|
||
| define double @test_atomicrmw_fsub_f64_local(double addrspace(3)* %ptr, double %value) { | ||
| ; GCN-LABEL: @test_atomicrmw_fsub_f64_local( | ||
| ; GCN-NEXT: [[TMP1:%.*]] = load double, double addrspace(3)* [[PTR:%.*]], align 8 | ||
| ; GCN-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; GCN: atomicrmw.start: | ||
| ; GCN-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; GCN-NEXT: [[NEW:%.*]] = fsub double [[LOADED]], [[VALUE:%.*]] | ||
| ; GCN-NEXT: [[TMP2:%.*]] = bitcast double addrspace(3)* [[PTR]] to i64 addrspace(3)* | ||
| ; GCN-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; GCN-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; GCN-NEXT: [[TMP5:%.*]] = cmpxchg i64 addrspace(3)* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; GCN-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; GCN-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; GCN-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; GCN-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; GCN: atomicrmw.end: | ||
| ; GCN-NEXT: ret double [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub double addrspace(3)* %ptr, double %value seq_cst | ||
| ret double %res | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
| ; RUN: opt -S -mtriple=i686-linux-gnu -atomic-expand %s | FileCheck %s | ||
|
|
||
| define float @test_atomicrmw_fadd_f32(float* %ptr, float %value) { | ||
| ; CHECK-LABEL: @test_atomicrmw_fadd_f32( | ||
| ; CHECK-NEXT: [[TMP1:%.*]] = load float, float* [[PTR:%.*]], align 4 | ||
| ; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CHECK: atomicrmw.start: | ||
| ; CHECK-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CHECK-NEXT: [[NEW:%.*]] = fadd float [[LOADED]], [[VALUE:%.*]] | ||
| ; CHECK-NEXT: [[TMP2:%.*]] = bitcast float* [[PTR]] to i32* | ||
| ; CHECK-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; CHECK-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; CHECK-NEXT: [[TMP5:%.*]] = cmpxchg i32* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; CHECK-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; CHECK-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CHECK: atomicrmw.end: | ||
| ; CHECK-NEXT: ret float [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fadd float* %ptr, float %value seq_cst | ||
| ret float %res | ||
| } | ||
|
|
||
| define double @test_atomicrmw_fadd_f64(double* %ptr, double %value) { | ||
| ; CHECK-LABEL: @test_atomicrmw_fadd_f64( | ||
| ; CHECK-NEXT: [[TMP1:%.*]] = load double, double* [[PTR:%.*]], align 8 | ||
| ; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CHECK: atomicrmw.start: | ||
| ; CHECK-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CHECK-NEXT: [[NEW:%.*]] = fadd double [[LOADED]], [[VALUE:%.*]] | ||
| ; CHECK-NEXT: [[TMP2:%.*]] = bitcast double* [[PTR]] to i64* | ||
| ; CHECK-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; CHECK-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; CHECK-NEXT: [[TMP5:%.*]] = cmpxchg i64* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; CHECK-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; CHECK-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CHECK: atomicrmw.end: | ||
| ; CHECK-NEXT: ret double [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fadd double* %ptr, double %value seq_cst | ||
| ret double %res | ||
| } | ||
|
|
||
| define float @test_atomicrmw_fadd_f32_as1(float addrspace(1)* %ptr, float %value) { | ||
| ; CHECK-LABEL: @test_atomicrmw_fadd_f32_as1( | ||
| ; CHECK-NEXT: [[TMP1:%.*]] = load float, float addrspace(1)* [[PTR:%.*]], align 4 | ||
| ; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CHECK: atomicrmw.start: | ||
| ; CHECK-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CHECK-NEXT: [[NEW:%.*]] = fadd float [[LOADED]], [[VALUE:%.*]] | ||
| ; CHECK-NEXT: [[TMP2:%.*]] = bitcast float addrspace(1)* [[PTR]] to i32 addrspace(1)* | ||
| ; CHECK-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; CHECK-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; CHECK-NEXT: [[TMP5:%.*]] = cmpxchg i32 addrspace(1)* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; CHECK-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; CHECK-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CHECK: atomicrmw.end: | ||
| ; CHECK-NEXT: ret float [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fadd float addrspace(1)* %ptr, float %value seq_cst | ||
| ret float %res | ||
| } | ||
|
|
||
| define float @test_atomicrmw_fsub_f32(float* %ptr, float %value) { | ||
| ; CHECK-LABEL: @test_atomicrmw_fsub_f32( | ||
| ; CHECK-NEXT: [[TMP1:%.*]] = load float, float* [[PTR:%.*]], align 4 | ||
| ; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CHECK: atomicrmw.start: | ||
| ; CHECK-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CHECK-NEXT: [[NEW:%.*]] = fsub float [[LOADED]], [[VALUE:%.*]] | ||
| ; CHECK-NEXT: [[TMP2:%.*]] = bitcast float* [[PTR]] to i32* | ||
| ; CHECK-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 | ||
| ; CHECK-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 | ||
| ; CHECK-NEXT: [[TMP5:%.*]] = cmpxchg i32* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] seq_cst seq_cst | ||
| ; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 | ||
| ; CHECK-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 | ||
| ; CHECK-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float | ||
| ; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CHECK: atomicrmw.end: | ||
| ; CHECK-NEXT: ret float [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub float* %ptr, float %value seq_cst | ||
| ret float %res | ||
| } | ||
|
|
||
| define double @test_atomicrmw_fsub_f64(double* %ptr, double %value) { | ||
| ; CHECK-LABEL: @test_atomicrmw_fsub_f64( | ||
| ; CHECK-NEXT: [[TMP1:%.*]] = load double, double* [[PTR:%.*]], align 8 | ||
| ; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]] | ||
| ; CHECK: atomicrmw.start: | ||
| ; CHECK-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] | ||
| ; CHECK-NEXT: [[NEW:%.*]] = fsub double [[LOADED]], [[VALUE:%.*]] | ||
| ; CHECK-NEXT: [[TMP2:%.*]] = bitcast double* [[PTR]] to i64* | ||
| ; CHECK-NEXT: [[TMP3:%.*]] = bitcast double [[NEW]] to i64 | ||
| ; CHECK-NEXT: [[TMP4:%.*]] = bitcast double [[LOADED]] to i64 | ||
| ; CHECK-NEXT: [[TMP5:%.*]] = cmpxchg i64* [[TMP2]], i64 [[TMP4]], i64 [[TMP3]] seq_cst seq_cst | ||
| ; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP5]], 1 | ||
| ; CHECK-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP5]], 0 | ||
| ; CHECK-NEXT: [[TMP6]] = bitcast i64 [[NEWLOADED]] to double | ||
| ; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] | ||
| ; CHECK: atomicrmw.end: | ||
| ; CHECK-NEXT: ret double [[TMP6]] | ||
| ; | ||
| %res = atomicrmw fsub double* %ptr, double %value seq_cst | ||
| ret double %res | ||
| } |