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: --check-prefixes=CHECK,BE
6 ; RUN: llc -relocation-model=pic -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 %struct.tree_common = type { i8, [3 x i8] }
12 declare signext i32 @fn2(...) local_unnamed_addr #1
14 ; Function Attrs: nounwind
15 define i32 @testCompare1(%struct.tree_common* nocapture readonly %arg1) nounwind {
16 ; BE-LABEL: testCompare1:
17 ; BE: # %bb.0: # %entry
19 ; BE-NEXT: std r0, 16(r1)
20 ; BE-NEXT: stdu r1, -112(r1)
21 ; BE-NEXT: addis r4, r2, .LC0@toc@ha
22 ; BE-NEXT: lbz r3, 0(r3)
23 ; BE-NEXT: ld r4, .LC0@toc@l(r4)
24 ; BE-NEXT: clrlwi r3, r3, 31
25 ; BE-NEXT: clrldi r3, r3, 32
26 ; BE-NEXT: lbz r4, 0(r4)
27 ; BE-NEXT: clrlwi r4, r4, 31
28 ; BE-NEXT: clrldi r4, r4, 32
29 ; BE-NEXT: sub r3, r4, r3
30 ; BE-NEXT: rldicl r3, r3, 1, 63
33 ; BE-NEXT: addi r1, r1, 112
34 ; BE-NEXT: ld r0, 16(r1)
38 ; LE-LABEL: testCompare1:
39 ; LE: # %bb.0: # %entry
41 ; LE-NEXT: std r0, 16(r1)
42 ; LE-NEXT: stdu r1, -32(r1)
43 ; LE-NEXT: addis r4, r2, .LC0@toc@ha
44 ; LE-NEXT: lbz r3, 0(r3)
45 ; LE-NEXT: ld r4, .LC0@toc@l(r4)
46 ; LE-NEXT: clrlwi r3, r3, 31
47 ; LE-NEXT: clrldi r3, r3, 32
48 ; LE-NEXT: lbz r4, 0(r4)
49 ; LE-NEXT: clrlwi r4, r4, 31
50 ; LE-NEXT: clrldi r4, r4, 32
51 ; LE-NEXT: sub r3, r4, r3
52 ; LE-NEXT: rldicl r3, r3, 1, 63
55 ; LE-NEXT: addi r1, r1, 32
56 ; LE-NEXT: ld r0, 16(r1)
60 %bf.load = load i8, i8* bitcast (i32 (%struct.tree_common*)* @testCompare1 to i8*), align 4
61 %bf.clear = and i8 %bf.load, 1
62 %0 = getelementptr inbounds %struct.tree_common, %struct.tree_common* %arg1, i64 0, i32 0
63 %bf.load1 = load i8, i8* %0, align 4
64 %bf.clear2 = and i8 %bf.load1, 1
65 %cmp = icmp ult i8 %bf.clear, %bf.clear2
66 %conv = zext i1 %cmp to i32
67 %call = tail call signext i32 bitcast (i32 (...)* @fn2 to i32 (i32)*)(i32 signext %conv) #2
71 ; Function Attrs: norecurse nounwind readnone
72 define signext i32 @testCompare2(i32 zeroext %a, i32 zeroext %b) {
73 ; CHECK-LABEL: testCompare2:
74 ; CHECK: # %bb.0: # %entry
75 ; CHECK-NEXT: rlwinm r3, r3, 0, 31, 31
76 ; CHECK-NEXT: rlwinm r4, r4, 0, 31, 31
77 ; CHECK-NEXT: clrldi r3, r3, 32
78 ; CHECK-NEXT: clrldi r4, r4, 32
79 ; CHECK-NEXT: sub r3, r3, r4
80 ; CHECK-NEXT: rldicl r3, r3, 1, 63
85 %cmp = icmp ult i32 %and, %and1
86 %conv = zext i1 %cmp to i32