1; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
2; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
3; RUN:  --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
4; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
5; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
6; RUN:  --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
7
8@glob = common local_unnamed_addr global i16 0, align 2
9
10; Function Attrs: norecurse nounwind readnone
11define i64 @test_llltus(i16 zeroext %a, i16 zeroext %b) {
12; CHECK-LABEL: test_llltus:
13; CHECK:       # %bb.0: # %entry
14; CHECK-NEXT:    sub [[REG:r[0-9]+]], r3, r4
15; CHECK-NEXT:    rldicl r3, [[REG]], 1, 63
16; CHECK-NEXT:    blr
17entry:
18  %cmp = icmp ult i16 %a, %b
19  %conv3 = zext i1 %cmp to i64
20  ret i64 %conv3
21}
22
23; Function Attrs: norecurse nounwind readnone
24define i64 @test_llltus_sext(i16 zeroext %a, i16 zeroext %b) {
25; CHECK-LABEL: test_llltus_sext:
26; CHECK:       # %bb.0: # %entry
27; CHECK-NEXT:    sub [[REG:r[0-9]+]], r3, r4
28; CHECK-NEXT:    sradi r3, [[REG]], 63
29; CHECK-NEXT:    blr
30entry:
31  %cmp = icmp ult i16 %a, %b
32  %conv3 = sext i1 %cmp to i64
33  ret i64 %conv3
34}
35
36; Function Attrs: norecurse nounwind
37define void @test_llltus_store(i16 zeroext %a, i16 zeroext %b) {
38; CHECK-LABEL: test_llltus_store:
39; CHECK:         sub [[REG:r[2-9]+]], r3, r4
40; CHECK:         rldicl {{r[0-9]+}}, [[REG]], 1, 63
41entry:
42  %cmp = icmp ult i16 %a, %b
43  %conv3 = zext i1 %cmp to i16
44  store i16 %conv3, i16* @glob, align 2
45  ret void
46}
47
48; Function Attrs: norecurse nounwind
49define void @test_llltus_sext_store(i16 zeroext %a, i16 zeroext %b) {
50; CHECK-LABEL: test_llltus_sext_store:
51; CHECK:       # %bb.0: # %entry
52; CHECK:         sub [[REG:r[0-9]+]], r3, r4
53; CHECK:         sradi {{r[0-9]+}}, [[REG]], 63
54entry:
55  %cmp = icmp ult i16 %a, %b
56  %conv3 = sext i1 %cmp to i16
57  store i16 %conv3, i16* @glob, align 2
58  ret void
59}
60