2 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
3 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
4 ; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
5 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
6 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
7 ; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
8 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
10 ; Function Attrs: nounwind
11 define signext i32 @logic_ne_32(i32 signext %a, i32 signext %b, i32 signext %c) {
12 ; CHECK-LABEL: logic_ne_32:
13 ; CHECK: xor r7, r3, r4
14 ; CHECK-NEXT: li r6, 55
15 ; CHECK-NEXT: xor r5, r5, r6
16 ; CHECK-NEXT: or r7, r7, r4
17 ; CHECK-NEXT: cntlzw r5, r5
18 ; CHECK-NEXT: cntlzw r6, r7
19 ; CHECK-NEXT: srwi r6, r6, 5
20 ; CHECK-NEXT: srwi r5, r5, 5
21 ; CHECK-NEXT: or. r5, r6, r5
22 ; CHECK-NEXT: bc 4, gt
24 %tobool = icmp eq i32 %a, %b
25 %tobool1 = icmp eq i32 %b, 0
26 %or.cond = and i1 %tobool, %tobool1
27 %tobool3 = icmp eq i32 %c, 55
28 %or.cond5 = or i1 %or.cond, %tobool3
29 br i1 %or.cond5, label %if.end, label %if.then
31 if.then: ; preds = %entry
32 %call = tail call signext i32 @foo(i32 signext %a) #2
35 if.end: ; preds = %entry
36 %call4 = tail call signext i32 @bar(i32 signext %b) #2
39 return: ; preds = %if.end, %if.then
40 %retval.0 = phi i32 [ %call4, %if.end ], [ %call, %if.then ]
44 define void @neg_truncate_i32_eq(i32 *%ptr) {
45 ; CHECK-LABEL: neg_truncate_i32_eq:
46 ; CHECK: # %bb.0: # %entry
47 ; CHECK-NEXT: lwz r3, 0(r3)
48 ; CHECK-NEXT: rldicl. r3, r3, 0, 63
49 ; CHECK-NEXT: bclr 12, eq, 0
50 ; CHECK-NEXT: # %bb.1: # %if.end29.thread136
52 %0 = load i32, i32* %ptr, align 4
53 %rem17127 = and i32 %0, 1
54 %cmp18 = icmp eq i32 %rem17127, 0
57 if.else: ; preds = %entry
58 br i1 %cmp18, label %if.end29, label %if.end29.thread136
60 if.end29.thread136: ; preds = %if.else
63 if.end29: ; preds = %if.else
68 ; Function Attrs: nounwind
69 define i64 @logic_eq_64(i64 %a, i64 %b, i64 %c) {
70 ; CHECK-LABEL: logic_eq_64:
71 ; CHECK: xor r7, r3, r4
72 ; CHECK-NEXT: li r6, 55
73 ; CHECK-NEXT: xor r5, r5, r6
74 ; CHECK-NEXT: or r7, r7, r4
75 ; CHECK-NEXT: cntlzd r6, r7
76 ; CHECK-NEXT: cntlzd r5, r5
77 ; CHECK-NEXT: rldicl r6, r6, 58, 63
78 ; CHECK-NEXT: rldicl r5, r5, 58, 63
79 ; CHECK-NEXT: or. r5, r6, r5
80 ; CHECK-NEXT: bc 4, gt
82 %tobool = icmp eq i64 %a, %b
83 %tobool1 = icmp eq i64 %b, 0
84 %or.cond = and i1 %tobool, %tobool1
85 %tobool3 = icmp eq i64 %c, 55
86 %or.cond5 = or i1 %or.cond, %tobool3
87 br i1 %or.cond5, label %if.end, label %if.then
89 if.then: ; preds = %entry
90 %call = tail call i64 @foo64(i64 %a) #2
93 if.end: ; preds = %entry
94 %call4 = tail call i64 @bar64(i64 %b) #2
97 return: ; preds = %if.end, %if.then
98 %retval.0 = phi i64 [ %call4, %if.end ], [ %call, %if.then ]
102 define void @neg_truncate_i64_eq(i64 *%ptr) {
103 ; CHECK-LABEL: neg_truncate_i64_eq:
104 ; CHECK: # %bb.0: # %entry
105 ; CHECK-NEXT: ld r3, 0(r3)
106 ; CHECK-NEXT: rldicl. r3, r3, 0, 63
107 ; CHECK-NEXT: bclr 12, eq, 0
108 ; CHECK-NEXT: # %bb.1: # %if.end29.thread136
110 %0 = load i64, i64* %ptr, align 4
111 %rem17127 = and i64 %0, 1
112 %cmp18 = icmp eq i64 %rem17127, 0
115 if.else: ; preds = %entry
116 br i1 %cmp18, label %if.end29, label %if.end29.thread136
118 if.end29.thread136: ; preds = %if.else
121 if.end29: ; preds = %if.else
126 ; Function Attrs: nounwind
127 define i64 @logic_ne_64(i64 %a, i64 %b, i64 %c) {
128 ; CHECK-LABEL: logic_ne_64:
129 ; CHECK: xor r7, r3, r4
130 ; CHECK-NEXT: li r6, 55
131 ; CHECK-NEXT: addic r8, r7, -1
132 ; CHECK-NEXT: xor r5, r5, r6
133 ; CHECK-NEXT: subfe r7, r8, r7
134 ; CHECK-NEXT: cntlzd r5, r5
135 ; CHECK-NEXT: addic r12, r4, -1
136 ; CHECK-NEXT: rldicl r5, r5, 58, 63
137 ; CHECK-NEXT: subfe r6, r12, r4
138 ; CHECK-NEXT: and r6, r7, r6
139 ; CHECK-NEXT: or. r5, r6, r5
140 ; CHECK-NEXT: bc 4, gt
142 %tobool = icmp ne i64 %a, %b
143 %tobool1 = icmp ne i64 %b, 0
144 %or.cond = and i1 %tobool, %tobool1
145 %tobool3 = icmp eq i64 %c, 55
146 %or.cond5 = or i1 %or.cond, %tobool3
147 br i1 %or.cond5, label %if.end, label %if.then
149 if.then: ; preds = %entry
150 %call = tail call i64 @foo64(i64 %a) #2
153 if.end: ; preds = %entry
154 %call4 = tail call i64 @bar64(i64 %b) #2
157 return: ; preds = %if.end, %if.then
158 %retval.0 = phi i64 [ %call4, %if.end ], [ %call, %if.then ]
162 define void @neg_truncate_i64_ne(i64 *%ptr) {
163 ; CHECK-LABEL: neg_truncate_i64_ne:
164 ; CHECK: # %bb.0: # %entry
165 ; CHECK-NEXT: ld r3, 0(r3)
166 ; CHECK-NEXT: andi. r3, r3, 1
167 ; CHECK-NEXT: bclr 12, gt, 0
168 ; CHECK-NEXT: # %bb.1: # %if.end29.thread136
170 %0 = load i64, i64* %ptr, align 4
171 %rem17127 = and i64 %0, 1
172 %cmp18 = icmp ne i64 %rem17127, 0
175 if.else: ; preds = %entry
176 br i1 %cmp18, label %if.end29, label %if.end29.thread136
178 if.end29.thread136: ; preds = %if.else
181 if.end29: ; preds = %if.else
186 declare signext i32 @foo(i32 signext)
187 declare signext i32 @bar(i32 signext)
188 declare i64 @foo64(i64)
189 declare i64 @bar64(i64)