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