1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -mtriple=mips64-mti-linux-gnu -atomic-expand %s | FileCheck %s 3 4define float @test_atomicrmw_fadd_f32(float* %ptr, float %value) { 5; CHECK-LABEL: @test_atomicrmw_fadd_f32( 6; CHECK-NEXT: fence seq_cst 7; CHECK-NEXT: [[TMP1:%.*]] = load float, float* [[PTR:%.*]], align 4 8; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]] 9; CHECK: atomicrmw.start: 10; CHECK-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] 11; CHECK-NEXT: [[NEW:%.*]] = fadd float [[LOADED]], [[VALUE:%.*]] 12; CHECK-NEXT: [[TMP2:%.*]] = bitcast float* [[PTR]] to i32* 13; CHECK-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 14; CHECK-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 15; CHECK-NEXT: [[TMP5:%.*]] = cmpxchg i32* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] monotonic monotonic 16; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 17; CHECK-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 18; CHECK-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float 19; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] 20; CHECK: atomicrmw.end: 21; CHECK-NEXT: fence seq_cst 22; CHECK-NEXT: ret float [[TMP6]] 23; 24 %res = atomicrmw fadd float* %ptr, float %value seq_cst 25 ret float %res 26} 27 28define float @test_atomicrmw_fsub_f32(float* %ptr, float %value) { 29; CHECK-LABEL: @test_atomicrmw_fsub_f32( 30; CHECK-NEXT: fence seq_cst 31; CHECK-NEXT: [[TMP1:%.*]] = load float, float* [[PTR:%.*]], align 4 32; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]] 33; CHECK: atomicrmw.start: 34; CHECK-NEXT: [[LOADED:%.*]] = phi float [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP6:%.*]], [[ATOMICRMW_START]] ] 35; CHECK-NEXT: [[NEW:%.*]] = fsub float [[LOADED]], [[VALUE:%.*]] 36; CHECK-NEXT: [[TMP2:%.*]] = bitcast float* [[PTR]] to i32* 37; CHECK-NEXT: [[TMP3:%.*]] = bitcast float [[NEW]] to i32 38; CHECK-NEXT: [[TMP4:%.*]] = bitcast float [[LOADED]] to i32 39; CHECK-NEXT: [[TMP5:%.*]] = cmpxchg i32* [[TMP2]], i32 [[TMP4]], i32 [[TMP3]] monotonic monotonic 40; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i32, i1 } [[TMP5]], 1 41; CHECK-NEXT: [[NEWLOADED:%.*]] = extractvalue { i32, i1 } [[TMP5]], 0 42; CHECK-NEXT: [[TMP6]] = bitcast i32 [[NEWLOADED]] to float 43; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] 44; CHECK: atomicrmw.end: 45; CHECK-NEXT: fence seq_cst 46; CHECK-NEXT: ret float [[TMP6]] 47; 48 %res = atomicrmw fsub float* %ptr, float %value seq_cst 49 ret float %res 50} 51 52