1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
3 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
4 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl \
5 ; RUN: --check-prefixes=CHECK,BE
6 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
7 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
8 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl \
9 ; RUN: --check-prefixes=CHECK,LE
11 @glob = common local_unnamed_addr global i32 0, align 4
13 ; Function Attrs: norecurse nounwind readnone
14 define i64 @test_llleui(i32 zeroext %a, i32 zeroext %b) {
15 ; CHECK-LABEL: test_llleui:
16 ; CHECK: # %bb.0: # %entry
17 ; CHECK-NEXT: sub r3, r4, r3
18 ; CHECK-NEXT: not r3, r3
19 ; CHECK-NEXT: rldicl r3, r3, 1, 63
22 %cmp = icmp ule i32 %a, %b
23 %conv1 = zext i1 %cmp to i64
27 ; Function Attrs: norecurse nounwind readnone
28 define i64 @test_llleui_sext(i32 zeroext %a, i32 zeroext %b) {
29 ; CHECK-LABEL: test_llleui_sext:
30 ; CHECK: # %bb.0: # %entry
31 ; CHECK-NEXT: sub r3, r4, r3
32 ; CHECK-NEXT: rldicl r3, r3, 1, 63
33 ; CHECK-NEXT: addi r3, r3, -1
36 %cmp = icmp ule i32 %a, %b
37 %conv1 = sext i1 %cmp to i64
41 ; Function Attrs: norecurse nounwind readnone
42 define i64 @test_llleui_z(i32 zeroext %a) {
43 ; CHECK-LABEL: test_llleui_z:
44 ; CHECK: # %bb.0: # %entry
45 ; CHECK-NEXT: cntlzw r3, r3
46 ; CHECK-NEXT: srwi r3, r3, 5
49 %cmp = icmp ule i32 %a, 0
50 %conv1 = zext i1 %cmp to i64
54 ; Function Attrs: norecurse nounwind readnone
55 define i64 @test_llleui_sext_z(i32 zeroext %a) {
56 ; CHECK-LABEL: test_llleui_sext_z:
57 ; CHECK: # %bb.0: # %entry
58 ; CHECK-NEXT: cntlzw r3, r3
59 ; CHECK-NEXT: srwi r3, r3, 5
60 ; CHECK-NEXT: neg r3, r3
63 %cmp = icmp ule i32 %a, 0
64 %conv1 = sext i1 %cmp to i64
68 ; Function Attrs: norecurse nounwind
69 define void @test_llleui_store(i32 zeroext %a, i32 zeroext %b) {
70 ; BE-LABEL: test_llleui_store:
71 ; BE: # %bb.0: # %entry
72 ; BE-NEXT: addis r5, r2, .LC0@toc@ha
73 ; BE-NEXT: sub r3, r4, r3
74 ; BE-NEXT: ld r4, .LC0@toc@l(r5)
76 ; BE-NEXT: rldicl r3, r3, 1, 63
77 ; BE-NEXT: stw r3, 0(r4)
80 ; LE-LABEL: test_llleui_store:
81 ; LE: # %bb.0: # %entry
82 ; LE-NEXT: sub r3, r4, r3
83 ; LE-NEXT: addis r5, r2, glob@toc@ha
85 ; LE-NEXT: rldicl r3, r3, 1, 63
86 ; LE-NEXT: stw r3, glob@toc@l(r5)
89 %cmp = icmp ule i32 %a, %b
90 %conv = zext i1 %cmp to i32
91 store i32 %conv, i32* @glob
95 ; Function Attrs: norecurse nounwind
96 define void @test_llleui_sext_store(i32 zeroext %a, i32 zeroext %b) {
97 ; BE-LABEL: test_llleui_sext_store:
98 ; BE: # %bb.0: # %entry
99 ; BE-NEXT: addis r5, r2, .LC0@toc@ha
100 ; BE-NEXT: sub r3, r4, r3
101 ; BE-NEXT: ld r4, .LC0@toc@l(r5)
102 ; BE-NEXT: rldicl r3, r3, 1, 63
103 ; BE-NEXT: addi r3, r3, -1
104 ; BE-NEXT: stw r3, 0(r4)
107 ; LE-LABEL: test_llleui_sext_store:
108 ; LE: # %bb.0: # %entry
109 ; LE-NEXT: sub r3, r4, r3
110 ; LE-NEXT: addis r5, r2, glob@toc@ha
111 ; LE-NEXT: rldicl r3, r3, 1, 63
112 ; LE-NEXT: addi r3, r3, -1
113 ; LE-NEXT: stw r3, glob@toc@l(r5)
116 %cmp = icmp ule i32 %a, %b
117 %sub = sext i1 %cmp to i32
118 store i32 %sub, i32* @glob
122 ; Function Attrs: norecurse nounwind
123 define void @test_llleui_z_store(i32 zeroext %a) {
124 ; BE-LABEL: test_llleui_z_store:
125 ; BE: # %bb.0: # %entry
126 ; BE-NEXT: addis r4, r2, .LC0@toc@ha
127 ; BE-NEXT: cntlzw r3, r3
128 ; BE-NEXT: ld r4, .LC0@toc@l(r4)
129 ; BE-NEXT: srwi r3, r3, 5
130 ; BE-NEXT: stw r3, 0(r4)
133 ; LE-LABEL: test_llleui_z_store:
134 ; LE: # %bb.0: # %entry
135 ; LE-NEXT: cntlzw r3, r3
136 ; LE-NEXT: addis r4, r2, glob@toc@ha
137 ; LE-NEXT: srwi r3, r3, 5
138 ; LE-NEXT: stw r3, glob@toc@l(r4)
141 %cmp = icmp ule i32 %a, 0
142 %conv = zext i1 %cmp to i32
143 store i32 %conv, i32* @glob
147 ; Function Attrs: norecurse nounwind
148 define void @test_llleui_sext_z_store(i32 zeroext %a) {
149 ; BE-LABEL: test_llleui_sext_z_store:
150 ; BE: # %bb.0: # %entry
151 ; BE-NEXT: addis r4, r2, .LC0@toc@ha
152 ; BE-NEXT: cntlzw r3, r3
153 ; BE-NEXT: ld r4, .LC0@toc@l(r4)
154 ; BE-NEXT: srwi r3, r3, 5
155 ; BE-NEXT: neg r3, r3
156 ; BE-NEXT: stw r3, 0(r4)
159 ; LE-LABEL: test_llleui_sext_z_store:
160 ; LE: # %bb.0: # %entry
161 ; LE-NEXT: cntlzw r3, r3
162 ; LE-NEXT: addis r4, r2, glob@toc@ha
163 ; LE-NEXT: srwi r3, r3, 5
164 ; LE-NEXT: neg r3, r3
165 ; LE-NEXT: stw r3, glob@toc@l(r4)
168 %cmp = icmp ule i32 %a, 0
169 %sub = sext i1 %cmp to i32
170 store i32 %sub, i32* @glob