• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
10; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
11; RUN:     -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \
12; RUN:     FileCheck %s --check-prefixes=CHECK-P10,CHECK-P10-LE
13; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
14; RUN:     -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \
15; RUN:     FileCheck %s --check-prefixes=CHECK-P10,CHECK-P10-BE
16; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
17; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \
18; RUN:   FileCheck %s --check-prefixes=CHECK-P10-CMP,CHECK-P10-CMP-LE \
19; RUN:   --implicit-check-not cmplw --implicit-check-not cmpld
20; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
21; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \
22; RUN:   FileCheck %s --check-prefixes=CHECK-P10-CMP,CHECK-P10-CMP-BE \
23; RUN:   --implicit-check-not cmplw --implicit-check-not cmpld
24
25%struct.tree_common = type { i8, [3 x i8] }
26declare signext i32 @fn2(...) local_unnamed_addr #1
27
28; Function Attrs: nounwind
29define i32 @testCompare1(%struct.tree_common* nocapture readonly %arg1) nounwind {
30; BE-LABEL: testCompare1:
31; BE:       # %bb.0: # %entry
32; BE-NEXT:    mflr r0
33; BE-NEXT:    std r0, 16(r1)
34; BE-NEXT:    stdu r1, -112(r1)
35; BE-NEXT:    addis r4, r2, .LC0@toc@ha
36; BE-NEXT:    lbz r3, 0(r3)
37; BE-NEXT:    ld r4, .LC0@toc@l(r4)
38; BE-NEXT:    clrlwi r3, r3, 31
39; BE-NEXT:    clrldi r3, r3, 32
40; BE-NEXT:    lbz r4, 0(r4)
41; BE-NEXT:    clrlwi r4, r4, 31
42; BE-NEXT:    clrldi r4, r4, 32
43; BE-NEXT:    sub r3, r3, r4
44; BE-NEXT:    rldicl r3, r3, 1, 63
45; BE-NEXT:    bl fn2
46; BE-NEXT:    nop
47; BE-NEXT:    addi r1, r1, 112
48; BE-NEXT:    ld r0, 16(r1)
49; BE-NEXT:    mtlr r0
50; BE-NEXT:    blr
51;
52; LE-LABEL: testCompare1:
53; LE:       # %bb.0: # %entry
54; LE-NEXT:    mflr r0
55; LE-NEXT:    std r0, 16(r1)
56; LE-NEXT:    stdu r1, -32(r1)
57; LE-NEXT:    addis r4, r2, .LC0@toc@ha
58; LE-NEXT:    lbz r3, 0(r3)
59; LE-NEXT:    ld r4, .LC0@toc@l(r4)
60; LE-NEXT:    clrlwi r3, r3, 31
61; LE-NEXT:    clrldi r3, r3, 32
62; LE-NEXT:    lbz r4, 0(r4)
63; LE-NEXT:    clrlwi r4, r4, 31
64; LE-NEXT:    clrldi r4, r4, 32
65; LE-NEXT:    sub r3, r3, r4
66; LE-NEXT:    rldicl r3, r3, 1, 63
67; LE-NEXT:    bl fn2
68; LE-NEXT:    nop
69; LE-NEXT:    addi r1, r1, 32
70; LE-NEXT:    ld r0, 16(r1)
71; LE-NEXT:    mtlr r0
72; LE-NEXT:    blr
73;
74; CHECK-P10-LE-LABEL: testCompare1:
75; CHECK-P10-LE:         .localentry testCompare1, 1
76; CHECK-P10-LE-NEXT:  # %bb.0: # %entry
77; CHECK-P10-LE-NEXT:    plbz r4, testCompare1@PCREL(0), 1
78; CHECK-P10-LE-NEXT:    lbz r3, 0(r3)
79; CHECK-P10-LE-NEXT:    clrlwi r3, r3, 31
80; CHECK-P10-LE-NEXT:    clrlwi r4, r4, 31
81; CHECK-P10-LE-NEXT:    cmplw r4, r3
82; CHECK-P10-LE-NEXT:    setbc r3, gt
83; CHECK-P10-LE-NEXT:    b fn2@notoc
84; CHECK-P10-LE-NEXT:    #TC_RETURNd8 fn2@notoc 0
85;
86; CHECK-P10-BE-LABEL: testCompare1:
87; CHECK-P10-BE:       # %bb.0: # %entry
88; CHECK-P10-BE-NEXT:    mflr r0
89; CHECK-P10-BE-NEXT:    std r0, 16(r1)
90; CHECK-P10-BE-NEXT:    stdu r1, -112(r1)
91; CHECK-P10-BE-NEXT:    addis r4, r2, .LC0@toc@ha
92; CHECK-P10-BE-NEXT:    lbz r3, 0(r3)
93; CHECK-P10-BE-NEXT:    ld r4, .LC0@toc@l(r4)
94; CHECK-P10-BE-NEXT:    clrlwi r3, r3, 31
95; CHECK-P10-BE-NEXT:    lbz r4, 0(r4)
96; CHECK-P10-BE-NEXT:    clrlwi r4, r4, 31
97; CHECK-P10-BE-NEXT:    cmplw r4, r3
98; CHECK-P10-BE-NEXT:    setbc r3, gt
99; CHECK-P10-BE-NEXT:    bl fn2
100; CHECK-P10-BE-NEXT:    nop
101; CHECK-P10-BE-NEXT:    addi r1, r1, 112
102; CHECK-P10-BE-NEXT:    ld r0, 16(r1)
103; CHECK-P10-BE-NEXT:    mtlr r0
104; CHECK-P10-BE-NEXT:    blr
105;
106; CHECK-P10-CMP-LE-LABEL: testCompare1:
107; CHECK-P10-CMP-LE:       # %bb.0: # %entry
108; CHECK-P10-CMP-LE-NEXT:    mflr r0
109; CHECK-P10-CMP-LE-NEXT:    std r0, 16(r1)
110; CHECK-P10-CMP-LE-NEXT:    stdu r1, -112(r1)
111; CHECK-P10-CMP-LE-NEXT:    addis r4, r2, .LC0@toc@ha
112; CHECK-P10-CMP-LE-NEXT:    lbz r3, 0(r3)
113; CHECK-P10-CMP-LE-NEXT:    ld r4, .LC0@toc@l(r4)
114; CHECK-P10-CMP-LE-NEXT:    clrlwi r3, r3, 31
115; CHECK-P10-CMP-LE-NEXT:    clrldi r3, r3, 32
116; CHECK-P10-CMP-LE-NEXT:    lbz r4, 0(r4)
117; CHECK-P10-CMP-LE-NEXT:    clrlwi r4, r4, 31
118; CHECK-P10-CMP-LE-NEXT:    clrldi r4, r4, 32
119; CHECK-P10-CMP-LE-NEXT:    sub r3, r3, r4
120; CHECK-P10-CMP-LE-NEXT:    rldicl r3, r3, 1, 63
121; CHECK-P10-CMP-LE-NEXT:    bl fn2
122; CHECK-P10-CMP-LE-NEXT:    nop
123; CHECK-P10-CMP-LE-NEXT:    addi r1, r1, 112
124; CHECK-P10-CMP-LE-NEXT:    ld r0, 16(r1)
125; CHECK-P10-CMP-LE-NEXT:    mtlr r0
126; CHECK-P10-CMP-LE-NEXT:    blr
127;
128; CHECK-P10-CMP-BE-LABEL: testCompare1:
129; CHECK-P10-CMP-BE:         .localentry testCompare1, 1
130; CHECK-P10-CMP-BE-NEXT:  # %bb.0: # %entry
131; CHECK-P10-CMP-BE-NEXT:    plbz r4, testCompare1@PCREL(0), 1
132; CHECK-P10-CMP-BE-NEXT:    lbz r3, 0(r3)
133; CHECK-P10-CMP-BE-NEXT:    clrlwi r3, r3, 31
134; CHECK-P10-CMP-BE-NEXT:    clrlwi r4, r4, 31
135; CHECK-P10-CMP-BE-NEXT:    clrldi r3, r3, 32
136; CHECK-P10-CMP-BE-NEXT:    clrldi r4, r4, 32
137; CHECK-P10-CMP-BE-NEXT:    sub r3, r3, r4
138; CHECK-P10-CMP-BE-NEXT:    rldicl r3, r3, 1, 63
139; CHECK-P10-CMP-BE-NEXT:    b fn2@notoc
140; CHECK-P10-CMP-BE-NEXT:    #TC_RETURNd8 fn2@notoc 0
141
142entry:
143  %bf.load = load i8, i8* bitcast (i32 (%struct.tree_common*)* @testCompare1 to i8*), align 4
144  %bf.clear = and i8 %bf.load, 1
145  %0 = getelementptr inbounds %struct.tree_common, %struct.tree_common* %arg1, i64 0, i32 0
146  %bf.load1 = load i8, i8* %0, align 4
147  %bf.clear2 = and i8 %bf.load1, 1
148  %cmp = icmp ugt i8 %bf.clear, %bf.clear2
149  %conv = zext i1 %cmp to i32
150  %call = tail call signext i32 bitcast (i32 (...)* @fn2 to i32 (i32)*)(i32 signext %conv) #2
151  ret i32 undef
152}
153
154; Function Attrs: norecurse nounwind readnone
155define signext i32 @testCompare2(i32 zeroext %a, i32 zeroext %b) {
156; CHECK-LABEL: testCompare2:
157; CHECK:       # %bb.0: # %entry
158; CHECK-NEXT:    clrlwi r3, r3, 31
159; CHECK-NEXT:    clrlwi r4, r4, 31
160; CHECK-NEXT:    clrldi r3, r3, 32
161; CHECK-NEXT:    clrldi r4, r4, 32
162; CHECK-NEXT:    sub r3, r4, r3
163; CHECK-NEXT:    rldicl r3, r3, 1, 63
164; CHECK-NEXT:    blr
165;
166; CHECK-P10-LABEL: testCompare2:
167; CHECK-P10:       # %bb.0: # %entry
168; CHECK-P10-NEXT:    clrlwi r3, r3, 31
169; CHECK-P10-NEXT:    clrlwi r4, r4, 31
170; CHECK-P10-NEXT:    cmplw r3, r4
171; CHECK-P10-NEXT:    setbc r3, gt
172; CHECK-P10-NEXT:    blr
173;
174; CHECK-P10-CMP-LABEL: testCompare2:
175; CHECK-P10-CMP:       # %bb.0: # %entry
176; CHECK-P10-CMP-NEXT:    clrlwi r3, r3, 31
177; CHECK-P10-CMP-NEXT:    clrlwi r4, r4, 31
178; CHECK-P10-CMP-NEXT:    clrldi r3, r3, 32
179; CHECK-P10-CMP-NEXT:    clrldi r4, r4, 32
180; CHECK-P10-CMP-NEXT:    sub r3, r4, r3
181; CHECK-P10-CMP-NEXT:    rldicl r3, r3, 1, 63
182; CHECK-P10-CMP-NEXT:    blr
183
184entry:
185  %and = and i32 %a, 1
186  %and1 = and i32 %b, 1
187  %cmp = icmp ugt i32 %and, %and1
188  %conv = zext i1 %cmp to i32
189  ret i32 %conv
190}
191