1 ; RUN: llc -relocation-model=pic -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 -relocation-model=pic -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
8 @glob = common local_unnamed_addr global i8 0, align 1
10 ; Function Attrs: norecurse nounwind readnone
11 define signext i32 @test_igtsc(i8 signext %a, i8 signext %b) {
12 ; CHECK-LABEL: test_igtsc:
13 ; CHECK: # %bb.0: # %entry
14 ; CHECK-NEXT: sub [[REG:r[0-9]+]], r4, r3
15 ; CHECK-NEXT: rldicl r3, [[REG]], 1, 63
18 %cmp = icmp sgt i8 %a, %b
19 %conv2 = zext i1 %cmp to i32
23 ; Function Attrs: norecurse nounwind readnone
24 define signext i32 @test_igtsc_sext(i8 signext %a, i8 signext %b) {
25 ; CHECK-LABEL: test_igtsc_sext:
26 ; CHECK: # %bb.0: # %entry
27 ; CHECK-NEXT: sub [[REG:r[0-9]+]], r4, r3
28 ; CHECK-NEXT: sradi r3, [[REG]], 63
31 %cmp = icmp sgt i8 %a, %b
32 %sub = sext i1 %cmp to i32
37 ; Function Attrs: norecurse nounwind readnone
38 define signext i32 @test_igtsc_z(i8 signext %a) {
39 ; CHECK-LABEL: test_igtsc_z:
40 ; CHECK: # %bb.0: # %entry
41 ; CHECK-NEXT: neg r3, r3
42 ; CHECK-NEXT: rldicl r3, r3, 1, 63
45 %cmp = icmp sgt i8 %a, 0
46 %conv1 = zext i1 %cmp to i32
50 ; Function Attrs: norecurse nounwind readnone
51 define signext i32 @test_igtsc_sext_z(i8 signext %a) {
52 ; CHECK-LABEL: test_igtsc_sext_z:
53 ; CHECK: neg [[REG2:r[0-9]+]], r3
54 ; CHECK-NEXT: sradi r3, [[REG2]], 63
57 %cmp = icmp sgt i8 %a, 0
58 %sub = sext i1 %cmp to i32
62 ; Function Attrs: norecurse nounwind
63 define void @test_igtsc_store(i8 signext %a, i8 signext %b) {
64 ; CHECK-LABEL: test_igtsc_store:
65 ; CHECK: # %bb.0: # %entry
66 ; CHECK: sub [[REG:r[0-9]+]], r4, r3
67 ; CHECK: rldicl {{r[0-9]+}}, [[REG]], 1, 63
69 %cmp = icmp sgt i8 %a, %b
70 %conv3 = zext i1 %cmp to i8
71 store i8 %conv3, i8* @glob, align 1
75 ; Function Attrs: norecurse nounwind
76 define void @test_igtsc_sext_store(i8 signext %a, i8 signext %b) {
77 ; CHECK-LABEL: test_igtsc_sext_store:
78 ; CHECK: # %bb.0: # %entry
79 ; CHECK: sub [[REG:r[0-9]+]], r4, r3
80 ; CHECK: sradi {{r[0-9]+}}, [[REG]], 63
82 %cmp = icmp sgt i8 %a, %b
83 %conv3 = sext i1 %cmp to i8
84 store i8 %conv3, i8* @glob, align 1
89 ; Function Attrs: norecurse nounwind
90 define void @test_igtsc_z_store(i8 signext %a) {
91 ; CHECK-LABEL: test_igtsc_z_store:
92 ; CHECK: # %bb.0: # %entry
93 ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
94 ; CHECK-NEXT: neg r3, r3
95 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
96 ; CHECK-NEXT: rldicl r3, r3, 1, 63
97 ; CHECK-NEXT: stb r3, 0(r4)
100 %cmp = icmp sgt i8 %a, 0
101 %conv2 = zext i1 %cmp to i8
102 store i8 %conv2, i8* @glob, align 1
106 ; Function Attrs: norecurse nounwind
107 define void @test_igtsc_sext_z_store(i8 signext %a) {
108 ; CHECK-LABEL: test_igtsc_sext_z_store:
109 ; CHECK: neg [[REG2:r[0-9]+]], r3
110 ; CHECK: sradi {{r[0-9]+}}, [[REG2]], 63
112 %cmp = icmp sgt i8 %a, 0
113 %conv2 = sext i1 %cmp to i8
114 store i8 %conv2, i8* @glob, align 1