1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -relocation-model=pic -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: llc -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
6 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
7 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
9 @glob = local_unnamed_addr global i64 0, align 8
11 ; Function Attrs: norecurse nounwind readnone
12 define i64 @test_llgtsll(i64 %a, i64 %b) {
13 ; CHECK-LABEL: test_llgtsll:
14 ; CHECK: # %bb.0: # %entry
15 ; CHECK-NEXT: sradi r5, r4, 63
16 ; CHECK-NEXT: rldicl r6, r3, 1, 63
17 ; CHECK-NEXT: subfc r3, r3, r4
18 ; CHECK-NEXT: adde r3, r6, r5
19 ; CHECK-NEXT: xori r3, r3, 1
22 %cmp = icmp sgt i64 %a, %b
23 %conv1 = zext i1 %cmp to i64
27 ; Function Attrs: norecurse nounwind readnone
28 define i64 @test_llgtsll_sext(i64 %a, i64 %b) {
29 ; CHECK-LABEL: test_llgtsll_sext:
30 ; CHECK: # %bb.0: # %entry
31 ; CHECK-NEXT: sradi r5, r4, 63
32 ; CHECK-NEXT: rldicl r6, r3, 1, 63
33 ; CHECK-NEXT: subfc r3, r3, r4
34 ; CHECK-NEXT: adde r3, r6, r5
35 ; CHECK-NEXT: xori r3, r3, 1
36 ; CHECK-NEXT: neg r3, r3
39 %cmp = icmp sgt i64 %a, %b
40 %conv1 = sext i1 %cmp to i64
45 ; Function Attrs: norecurse nounwind readnone
46 define i64 @test_llgtsll_z(i64 %a) {
47 ; CHECK-LABEL: test_llgtsll_z:
48 ; CHECK: # %bb.0: # %entry
49 ; CHECK-NEXT: addi r4, r3, -1
50 ; CHECK-NEXT: nor r3, r4, r3
51 ; CHECK-NEXT: rldicl r3, r3, 1, 63
54 %cmp = icmp sgt i64 %a, 0
55 %conv1 = zext i1 %cmp to i64
59 ; Function Attrs: norecurse nounwind readnone
60 define i64 @test_llgtsll_sext_z(i64 %a) {
61 ; CHECK-LABEL: test_llgtsll_sext_z:
62 ; CHECK: # %bb.0: # %entry
63 ; CHECK-NEXT: addi r4, r3, -1
64 ; CHECK-NEXT: nor r3, r4, r3
65 ; CHECK-NEXT: sradi r3, r3, 63
68 %cmp = icmp sgt i64 %a, 0
69 %conv1 = sext i1 %cmp to i64
73 ; Function Attrs: norecurse nounwind
74 define void @test_llgtsll_store(i64 %a, i64 %b) {
75 ; CHECK-LABEL: test_llgtsll_store:
76 ; CHECK: # %bb.0: # %entry
77 ; CHECK-NEXT: sradi r6, r4, 63
78 ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha
79 ; CHECK-NEXT: subfc r4, r3, r4
80 ; CHECK-NEXT: rldicl r3, r3, 1, 63
81 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5)
82 ; CHECK-NEXT: adde r3, r3, r6
83 ; CHECK-NEXT: xori r3, r3, 1
84 ; CHECK-NEXT: std r3, 0(r4)
86 ; CHECK-DIAG: subfc [[REG3:r[0-9]+]], r3, r4
88 %cmp = icmp sgt i64 %a, %b
89 %conv1 = zext i1 %cmp to i64
90 store i64 %conv1, i64* @glob, align 8
94 ; Function Attrs: norecurse nounwind
95 define void @test_llgtsll_sext_store(i64 %a, i64 %b) {
96 ; CHECK-LABEL: test_llgtsll_sext_store:
97 ; CHECK: # %bb.0: # %entry
98 ; CHECK-NEXT: sradi r6, r4, 63
99 ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha
100 ; CHECK-NEXT: subfc r4, r3, r4
101 ; CHECK-NEXT: rldicl r3, r3, 1, 63
102 ; CHECK-NEXT: adde r3, r3, r6
103 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5)
104 ; CHECK-NEXT: xori r3, r3, 1
105 ; CHECK-NEXT: neg r3, r3
106 ; CHECK-NEXT: std r3, 0(r4)
108 ; CHECK-DIAG: subfc [[REG3:r[0-9]+]], r3, r4
110 %cmp = icmp sgt i64 %a, %b
111 %conv1 = sext i1 %cmp to i64
112 store i64 %conv1, i64* @glob, align 8
117 ; Function Attrs: norecurse nounwind
118 define void @test_llgtsll_z_store(i64 %a) {
119 ; CHECK-LABEL: test_llgtsll_z_store:
120 ; CHECK: # %bb.0: # %entry
121 ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
122 ; CHECK-NEXT: addi r5, r3, -1
123 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
124 ; CHECK-NEXT: nor r3, r5, r3
125 ; CHECK-NEXT: rldicl r3, r3, 1, 63
126 ; CHECK-NEXT: std r3, 0(r4)
129 %cmp = icmp sgt i64 %a, 0
130 %conv1 = zext i1 %cmp to i64
131 store i64 %conv1, i64* @glob, align 8
135 ; Function Attrs: norecurse nounwind
136 define void @test_llgtsll_sext_z_store(i64 %a) {
137 ; CHECK-LABEL: test_llgtsll_sext_z_store:
138 ; CHECK: # %bb.0: # %entry
139 ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
140 ; CHECK-NEXT: addi r5, r3, -1
141 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
142 ; CHECK-NEXT: nor r3, r5, r3
143 ; CHECK-NEXT: sradi r3, r3, 63
144 ; CHECK-NEXT: std r3, 0(r4)
147 %cmp = icmp sgt i64 %a, 0
148 %conv1 = sext i1 %cmp to i64
149 store i64 %conv1, i64* @glob, align 8