1 ; RUN: llc < %s -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown | FileCheck %s
2 define i8 @atomic_min_i8() {
4 %0 = alloca i8, align 2
5 %1 = bitcast i8* %0 to i8*
6 call void @llvm.lifetime.start.p0i8(i64 2, i8* %1)
7 store i8 -1, i8* %0, align 2
8 %2 = atomicrmw min i8* %0, i8 0 acq_rel
9 %3 = load atomic i8, i8* %0 acquire, align 8
10 call void @llvm.lifetime.end.p0i8(i64 2, i8* %1)
12 ; CHECK-LABEL: atomic_min_i8
13 ; CHECK: lbarx [[DST:[0-9]+]],
14 ; CHECK-NEXT: extsb [[EXT:[0-9]+]], [[DST]]
15 ; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]]
18 define i16 @atomic_min_i16() {
20 %0 = alloca i16, align 2
21 %1 = bitcast i16* %0 to i8*
22 call void @llvm.lifetime.start.p0i8(i64 2, i8* %1)
23 store i16 -1, i16* %0, align 2
24 %2 = atomicrmw min i16* %0, i16 0 acq_rel
25 %3 = load atomic i16, i16* %0 acquire, align 8
26 call void @llvm.lifetime.end.p0i8(i64 2, i8* %1)
28 ; CHECK-LABEL: atomic_min_i16
29 ; CHECK: lharx [[DST:[0-9]+]],
30 ; CHECK-NEXT: extsh [[EXT:[0-9]+]], [[DST]]
31 ; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]]
35 define i8 @atomic_max_i8() {
37 %0 = alloca i8, align 2
38 %1 = bitcast i8* %0 to i8*
39 call void @llvm.lifetime.start.p0i8(i64 2, i8* %1)
40 store i8 -1, i8* %0, align 2
41 %2 = atomicrmw max i8* %0, i8 0 acq_rel
42 %3 = load atomic i8, i8* %0 acquire, align 8
43 call void @llvm.lifetime.end.p0i8(i64 2, i8* %1)
45 ; CHECK-LABEL: atomic_max_i8
46 ; CHECK: lbarx [[DST:[0-9]+]],
47 ; CHECK-NEXT: extsb [[EXT:[0-9]+]], [[DST]]
48 ; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]]
51 define i16 @atomic_max_i16() {
53 %0 = alloca i16, align 2
54 %1 = bitcast i16* %0 to i8*
55 call void @llvm.lifetime.start.p0i8(i64 2, i8* %1)
56 store i16 -1, i16* %0, align 2
57 %2 = atomicrmw max i16* %0, i16 0 acq_rel
58 %3 = load atomic i16, i16* %0 acquire, align 8
59 call void @llvm.lifetime.end.p0i8(i64 2, i8* %1)
61 ; CHECK-LABEL: atomic_max_i16
62 ; CHECK: lharx [[DST:[0-9]+]],
63 ; CHECK-NEXT: extsh [[EXT:[0-9]+]], [[DST]]
64 ; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]]
68 declare void @llvm.lifetime.start.p0i8(i64, i8*)
69 declare void @llvm.lifetime.end.p0i8(i64, i8*)