1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -mtriple=i686-linux-gnu -passes=atomic-expand %s | FileCheck %s
4 define double @atomic_xchg_f64(ptr %ptr) nounwind {
5 ; CHECK-LABEL: @atomic_xchg_f64(
6 ; CHECK-NEXT: [[TMP2:%.*]] = load i64, ptr [[PTR:%.*]], align 8
7 ; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]]
8 ; CHECK: atomicrmw.start:
9 ; CHECK-NEXT: [[LOADED:%.*]] = phi i64 [ [[TMP2]], [[TMP0:%.*]] ], [ [[NEWLOADED:%.*]], [[ATOMICRMW_START]] ]
10 ; CHECK-NEXT: [[TMP3:%.*]] = cmpxchg ptr [[PTR]], i64 [[LOADED]], i64 4616189618054758400 seq_cst seq_cst, align 8
11 ; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP3]], 1
12 ; CHECK-NEXT: [[NEWLOADED]] = extractvalue { i64, i1 } [[TMP3]], 0
13 ; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]]
14 ; CHECK: atomicrmw.end:
15 ; CHECK-NEXT: [[TMP4:%.*]] = bitcast i64 [[NEWLOADED]] to double
16 ; CHECK-NEXT: ret double [[TMP4]]
18 %result = atomicrmw xchg ptr %ptr, double 4.0 seq_cst
22 define double @atomic_xchg_f64_as1(ptr addrspace(1) %ptr) nounwind {
23 ; CHECK-LABEL: @atomic_xchg_f64_as1(
24 ; CHECK-NEXT: [[TMP2:%.*]] = load i64, ptr addrspace(1) [[PTR:%.*]], align 8
25 ; CHECK-NEXT: br label [[ATOMICRMW_START:%.*]]
26 ; CHECK: atomicrmw.start:
27 ; CHECK-NEXT: [[LOADED:%.*]] = phi i64 [ [[TMP2]], [[TMP0:%.*]] ], [ [[NEWLOADED:%.*]], [[ATOMICRMW_START]] ]
28 ; CHECK-NEXT: [[TMP3:%.*]] = cmpxchg ptr addrspace(1) [[PTR]], i64 [[LOADED]], i64 4616189618054758400 seq_cst seq_cst, align 8
29 ; CHECK-NEXT: [[SUCCESS:%.*]] = extractvalue { i64, i1 } [[TMP3]], 1
30 ; CHECK-NEXT: [[NEWLOADED]] = extractvalue { i64, i1 } [[TMP3]], 0
31 ; CHECK-NEXT: br i1 [[SUCCESS]], label [[ATOMICRMW_END:%.*]], label [[ATOMICRMW_START]]
32 ; CHECK: atomicrmw.end:
33 ; CHECK-NEXT: [[TMP4:%.*]] = bitcast i64 [[NEWLOADED]] to double
34 ; CHECK-NEXT: ret double [[TMP4]]
36 %result = atomicrmw xchg ptr addrspace(1) %ptr, double 4.0 seq_cst