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: subc r3, r4, r3
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: subc r3, r4, r3
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 r5, r4, 63
78 ; CHECK-NEXT: rldicl r6, r3, 1, 63
79 ; CHECK-NEXT: subc r3, r4, r3
80 ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
81 ; CHECK-NEXT: adde r3, r6, r5
82 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
83 ; CHECK-NEXT: xori r3, r3, 1
84 ; CHECK-NEXT: std r3, 0(r4)
87 %cmp = icmp sgt i64 %a, %b
88 %conv1 = zext i1 %cmp to i64
89 store i64 %conv1, ptr @glob, align 8
93 ; Function Attrs: norecurse nounwind
94 define void @test_llgtsll_sext_store(i64 %a, i64 %b) {
95 ; CHECK-LABEL: test_llgtsll_sext_store:
96 ; CHECK: # %bb.0: # %entry
97 ; CHECK-NEXT: sradi r5, r4, 63
98 ; CHECK-NEXT: rldicl r6, r3, 1, 63
99 ; CHECK-NEXT: subc r3, r4, r3
100 ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
101 ; CHECK-NEXT: adde r3, r6, r5
102 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
103 ; CHECK-NEXT: xori r3, r3, 1
104 ; CHECK-NEXT: neg r3, r3
105 ; CHECK-NEXT: std r3, 0(r4)
108 %cmp = icmp sgt i64 %a, %b
109 %conv1 = sext i1 %cmp to i64
110 store i64 %conv1, ptr @glob, align 8
115 ; Function Attrs: norecurse nounwind
116 define void @test_llgtsll_z_store(i64 %a) {
117 ; CHECK-LABEL: test_llgtsll_z_store:
118 ; CHECK: # %bb.0: # %entry
119 ; CHECK-NEXT: addi r4, r3, -1
120 ; CHECK-NEXT: nor r3, r4, r3
121 ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
122 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
123 ; CHECK-NEXT: rldicl r3, r3, 1, 63
124 ; CHECK-NEXT: std r3, 0(r4)
127 %cmp = icmp sgt i64 %a, 0
128 %conv1 = zext i1 %cmp to i64
129 store i64 %conv1, ptr @glob, align 8
133 ; Function Attrs: norecurse nounwind
134 define void @test_llgtsll_sext_z_store(i64 %a) {
135 ; CHECK-LABEL: test_llgtsll_sext_z_store:
136 ; CHECK: # %bb.0: # %entry
137 ; CHECK-NEXT: addi r4, r3, -1
138 ; CHECK-NEXT: nor r3, r4, r3
139 ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha
140 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4)
141 ; CHECK-NEXT: sradi r3, r3, 63
142 ; CHECK-NEXT: std r3, 0(r4)
145 %cmp = icmp sgt i64 %a, 0
146 %conv1 = sext i1 %cmp to i64
147 store i64 %conv1, ptr @glob, align 8