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 i32 0, align 4
10 ; Function Attrs: norecurse nounwind readnone
11 define signext i32 @test_igtsi(i32 signext %a, i32 signext %b) {
12 ; CHECK-LABEL: test_igtsi:
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 i32 %a, %b
19 %conv = zext i1 %cmp to i32
23 ; Function Attrs: norecurse nounwind readnone
24 define signext i32 @test_igtsi_sext(i32 signext %a, i32 signext %b) {
25 ; CHECK-LABEL: test_igtsi_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 i32 %a, %b
32 %sub = sext i1 %cmp to i32
37 ; Function Attrs: norecurse nounwind readnone
38 define signext i32 @test_igtsi_z(i32 signext %a) {
39 ; CHECK-LABEL: test_igtsi_z:
40 ; CHECK: # %bb.0: # %entry
41 ; CHECK-NEXT: neg r3, r3
42 ; CHECK-NEXT: rldicl r3, r3, 1, 63
45 %cmp = icmp sgt i32 %a, 0
46 %conv = zext i1 %cmp to i32
50 ; Function Attrs: norecurse nounwind readnone
51 define signext i32 @test_igtsi_sext_z(i32 signext %a) {
52 ; CHECK-LABEL: test_igtsi_sext_z:
53 ; CHECK: neg [[REG2:r[0-9]+]], r3
54 ; CHECK-NEXT: sradi r3, [[REG2]], 63
57 %cmp = icmp sgt i32 %a, 0
58 %sub = sext i1 %cmp to i32
62 ; Function Attrs: norecurse nounwind
63 define void @test_igtsi_store(i32 signext %a, i32 signext %b) {
64 ; CHECK-LABEL: test_igtsi_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 i32 %a, %b
70 %conv = zext i1 %cmp to i32
71 store i32 %conv, i32* @glob, align 4
75 ; Function Attrs: norecurse nounwind
76 define void @test_igtsi_sext_store(i32 signext %a, i32 signext %b) {
77 ; CHECK-LABEL: test_igtsi_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 i32 %a, %b
83 %sub = sext i1 %cmp to i32
84 store i32 %sub, i32* @glob, align 4
89 ; Function Attrs: norecurse nounwind
90 define void @test_igtsi_z_store(i32 signext %a) {
91 ; CHECK-LABEL: test_igtsi_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: stw r3, 0(r4)
100 %cmp = icmp sgt i32 %a, 0
101 %conv = zext i1 %cmp to i32
102 store i32 %conv, i32* @glob, align 4
106 ; Function Attrs: norecurse nounwind
107 define void @test_igtsi_sext_z_store(i32 signext %a) {
108 ; CHECK-LABEL: test_igtsi_sext_z_store:
109 ; CHECK: neg [[REG:r[0-9]+]], r3
110 ; CHECK: sradi {{r[0-9]+}}, [[REG]], 63
112 %cmp = icmp sgt i32 %a, 0
113 %sub = sext i1 %cmp to i32
114 store i32 %sub, i32* @glob, align 4