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 4define double @atomic_xchg_f64(double* %ptr) nounwind { 5; CHECK-LABEL: @atomic_xchg_f64( 6; CHECK-NEXT: [[TMP1:%.*]] = load double, double* [[PTR:%.*]], align 8 7; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]] 8; CHECK: atomicrmw.start: 9; CHECK-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP5:%.*]], [[ATOMICRMW_START]] ] 10; CHECK-NEXT: [[TMP2:%.*]] = bitcast double* [[PTR]] to i64* 11; CHECK-NEXT: [[TMP3:%.*]] = bitcast double [[LOADED]] to i64 12; CHECK-NEXT: [[TMP4:%.*]] = cmpxchg i64* [[TMP2]], i64 [[TMP3]], i64 4616189618054758400 seq_cst seq_cst 13; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP4]], 1 14; CHECK-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP4]], 0 15; CHECK-NEXT: [[TMP5]] = bitcast i64 [[NEWLOADED]] to double 16; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] 17; CHECK: atomicrmw.end: 18; CHECK-NEXT: ret double [[TMP5]] 19; 20 %result = atomicrmw xchg double* %ptr, double 4.0 seq_cst 21 ret double %result 22} 23 24define double @atomic_xchg_f64_as1(double addrspace(1)* %ptr) nounwind { 25; CHECK-LABEL: @atomic_xchg_f64_as1( 26; CHECK-NEXT: [[TMP1:%.*]] = load double, double addrspace(1)* [[PTR:%.*]], align 8 27; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]] 28; CHECK: atomicrmw.start: 29; CHECK-NEXT: [[LOADED:%.*]] = phi double [ [[TMP1]], [[TMP0:%.*]] ], [ [[TMP5:%.*]], [[ATOMICRMW_START]] ] 30; CHECK-NEXT: [[TMP2:%.*]] = bitcast double addrspace(1)* [[PTR]] to i64 addrspace(1)* 31; CHECK-NEXT: [[TMP3:%.*]] = bitcast double [[LOADED]] to i64 32; CHECK-NEXT: [[TMP4:%.*]] = cmpxchg i64 addrspace(1)* [[TMP2]], i64 [[TMP3]], i64 4616189618054758400 seq_cst seq_cst 33; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP4]], 1 34; CHECK-NEXT: [[NEWLOADED:%.*]] = extractvalue { i64, i1 } [[TMP4]], 0 35; CHECK-NEXT: [[TMP5]] = bitcast i64 [[NEWLOADED]] to double 36; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]] 37; CHECK: atomicrmw.end: 38; CHECK-NEXT: ret double [[TMP5]] 39; 40 %result = atomicrmw xchg double addrspace(1)* %ptr, double 4.0 seq_cst 41 ret double %result 42} 43