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 = local_unnamed_addr global i64 0, align 8
13 ; Function Attrs: norecurse nounwind readnone
14 define signext i32 @test_ileull(i64 %a, i64 %b) {
15 ; CHECK-LABEL: test_ileull:
16 ; CHECK: # %bb.0: # %entry
17 ; CHECK-NEXT: subfc r4, r3, r4
18 ; CHECK-NEXT: subfe r3, r3, r3
19 ; CHECK-NEXT: addi r3, r3, 1
22 %cmp = icmp ule i64 %a, %b
23 %conv = zext i1 %cmp to i32
27 ; Function Attrs: norecurse nounwind readnone
28 define signext i32 @test_ileull_sext(i64 %a, i64 %b) {
29 ; CHECK-LABEL: test_ileull_sext:
30 ; CHECK: # %bb.0: # %entry
31 ; CHECK-NEXT: subfc r4, r3, r4
32 ; CHECK-NEXT: subfe r3, r3, r3
33 ; CHECK-NEXT: not r3, r3
36 %cmp = icmp ule i64 %a, %b
37 %sub = sext i1 %cmp to i32
41 ; Function Attrs: norecurse nounwind readnone
42 define signext i32 @test_ileull_z(i64 %a) {
43 ; CHECK-LABEL: test_ileull_z:
44 ; CHECK: # %bb.0: # %entry
45 ; CHECK-NEXT: cntlzd r3, r3
46 ; CHECK-NEXT: rldicl r3, r3, 58, 63
49 %cmp = icmp ule i64 %a, 0
50 %conv = zext i1 %cmp to i32
54 ; Function Attrs: norecurse nounwind readnone
55 define signext i32 @test_ileull_sext_z(i64 %a) {
56 ; CHECK-LABEL: test_ileull_sext_z:
57 ; CHECK: # %bb.0: # %entry
58 ; CHECK-NEXT: addic r3, r3, -1
59 ; CHECK-NEXT: subfe r3, r3, r3
62 %cmp = icmp ule i64 %a, 0
63 %sub = sext i1 %cmp to i32
67 ; Function Attrs: norecurse nounwind
68 define void @test_ileull_store(i64 %a, i64 %b) {
69 ; BE-LABEL: test_ileull_store:
70 ; BE: # %bb.0: # %entry
71 ; BE-NEXT: addis r5, r2, .LC0@toc@ha
72 ; BE-NEXT: subfc r4, r3, r4
73 ; BE-NEXT: ld r4, .LC0@toc@l(r5)
74 ; BE-NEXT: subfe r3, r3, r3
75 ; BE-NEXT: addi r3, r3, 1
76 ; BE-NEXT: std r3, 0(r4)
79 ; LE-LABEL: test_ileull_store:
80 ; LE: # %bb.0: # %entry
81 ; LE-NEXT: subfc r4, r3, r4
82 ; LE-NEXT: addis r5, r2, glob@toc@ha
83 ; LE-NEXT: subfe r3, r3, r3
84 ; LE-NEXT: addi r3, r3, 1
85 ; LE-NEXT: std r3, glob@toc@l(r5)
88 %cmp = icmp ule i64 %a, %b
89 %conv1 = zext i1 %cmp to i64
90 store i64 %conv1, i64* @glob
94 ; Function Attrs: norecurse nounwind
95 define void @test_ileull_sext_store(i64 %a, i64 %b) {
96 ; BE-LABEL: test_ileull_sext_store:
97 ; BE: # %bb.0: # %entry
98 ; BE-NEXT: addis r5, r2, .LC0@toc@ha
99 ; BE-NEXT: subfc r4, r3, r4
100 ; BE-NEXT: ld r4, .LC0@toc@l(r5)
101 ; BE-NEXT: subfe r3, r3, r3
102 ; BE-NEXT: not r3, r3
103 ; BE-NEXT: std r3, 0(r4)
106 ; LE-LABEL: test_ileull_sext_store:
107 ; LE: # %bb.0: # %entry
108 ; LE-NEXT: subfc r4, r3, r4
109 ; LE-NEXT: addis r5, r2, glob@toc@ha
110 ; LE-NEXT: subfe r3, r3, r3
111 ; LE-NEXT: not r3, r3
112 ; LE-NEXT: std r3, glob@toc@l(r5)
115 %cmp = icmp ule i64 %a, %b
116 %conv1 = sext i1 %cmp to i64
117 store i64 %conv1, i64* @glob
121 ; Function Attrs: norecurse nounwind
122 define void @test_ileull_z_store(i64 %a) {
123 ; BE-LABEL: test_ileull_z_store:
124 ; BE: # %bb.0: # %entry
125 ; BE-NEXT: addis r4, r2, .LC0@toc@ha
126 ; BE-NEXT: cntlzd r3, r3
127 ; BE-NEXT: ld r4, .LC0@toc@l(r4)
128 ; BE-NEXT: rldicl r3, r3, 58, 63
129 ; BE-NEXT: std r3, 0(r4)
132 ; LE-LABEL: test_ileull_z_store:
133 ; LE: # %bb.0: # %entry
134 ; LE-NEXT: cntlzd r3, r3
135 ; LE-NEXT: addis r4, r2, glob@toc@ha
136 ; LE-NEXT: rldicl r3, r3, 58, 63
137 ; LE-NEXT: std r3, glob@toc@l(r4)
140 %cmp = icmp ule i64 %a, 0
141 %conv1 = zext i1 %cmp to i64
142 store i64 %conv1, i64* @glob
146 ; Function Attrs: norecurse nounwind
147 define void @test_ileull_sext_z_store(i64 %a) {
148 ; BE-LABEL: test_ileull_sext_z_store:
149 ; BE: # %bb.0: # %entry
150 ; BE-NEXT: addis r4, r2, .LC0@toc@ha
151 ; BE-NEXT: addic r3, r3, -1
152 ; BE-NEXT: ld r4, .LC0@toc@l(r4)
153 ; BE-NEXT: subfe r3, r3, r3
154 ; BE-NEXT: std r3, 0(r4)
157 ; LE-LABEL: test_ileull_sext_z_store:
158 ; LE: # %bb.0: # %entry
159 ; LE-NEXT: addic r3, r3, -1
160 ; LE-NEXT: addis r4, r2, glob@toc@ha
161 ; LE-NEXT: subfe r3, r3, r3
162 ; LE-NEXT: std r3, glob@toc@l(r4)
165 %cmp = icmp ule i64 %a, 0
166 %conv1 = sext i1 %cmp to i64
167 store i64 %conv1, i64* @glob