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 call void @llvm.lifetime.start.p0(i64 2, ptr %0)
6 store i8 -1, ptr %0, align 2
7 %1 = atomicrmw min ptr %0, i8 0 acq_rel
8 %2 = load atomic i8, ptr %0 acquire, align 8
9 call void @llvm.lifetime.end.p0(i64 2, ptr %0)
11 ; CHECK-LABEL: atomic_min_i8
12 ; CHECK: lbarx [[DST:[0-9]+]],
13 ; CHECK-NEXT: extsb [[EXT:[0-9]+]], [[DST]]
14 ; CHECK-NEXT: cmpw [[EXT]], {{[0-9]+}}
17 define i16 @atomic_min_i16() {
19 %0 = alloca i16, align 2
20 call void @llvm.lifetime.start.p0(i64 2, ptr %0)
21 store i16 -1, ptr %0, align 2
22 %1 = atomicrmw min ptr %0, i16 0 acq_rel
23 %2 = load atomic i16, ptr %0 acquire, align 8
24 call void @llvm.lifetime.end.p0(i64 2, ptr %0)
26 ; CHECK-LABEL: atomic_min_i16
27 ; CHECK: lharx [[DST:[0-9]+]],
28 ; CHECK-NEXT: extsh [[EXT:[0-9]+]], [[DST]]
29 ; CHECK-NEXT: cmpw [[EXT]], {{[0-9]+}}
33 define i8 @atomic_max_i8() {
35 %0 = alloca i8, align 2
36 call void @llvm.lifetime.start.p0(i64 2, ptr %0)
37 store i8 -1, ptr %0, align 2
38 %1 = atomicrmw max ptr %0, i8 0 acq_rel
39 %2 = load atomic i8, ptr %0 acquire, align 8
40 call void @llvm.lifetime.end.p0(i64 2, ptr %0)
42 ; CHECK-LABEL: atomic_max_i8
43 ; CHECK: lbarx [[DST:[0-9]+]],
44 ; CHECK-NEXT: extsb [[EXT:[0-9]+]], [[DST]]
45 ; CHECK-NEXT: cmpw [[EXT]], {{[0-9]+}}
48 define i16 @atomic_max_i16() {
50 %0 = alloca i16, align 2
51 call void @llvm.lifetime.start.p0(i64 2, ptr %0)
52 store i16 -1, ptr %0, align 2
53 %1 = atomicrmw max ptr %0, i16 0 acq_rel
54 %2 = load atomic i16, ptr %0 acquire, align 8
55 call void @llvm.lifetime.end.p0(i64 2, ptr %0)
57 ; CHECK-LABEL: atomic_max_i16
58 ; CHECK: lharx [[DST:[0-9]+]],
59 ; CHECK-NEXT: extsh [[EXT:[0-9]+]], [[DST]]
60 ; CHECK-NEXT: cmpw [[EXT]], {{[0-9]+}}
64 declare void @llvm.lifetime.start.p0(i64, ptr)
65 declare void @llvm.lifetime.end.p0(i64, ptr)