File: 32-bit-subreg-peephole-phi-1.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,999,216 kB
  • sloc: cpp: 6,951,711; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,033; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,252; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (34 lines) | stat: -rw-r--r-- 1,044 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
; RUN: llc -O2 -march=bpfel -mcpu=v2 -mattr=+alu32 < %s | FileCheck %s
;
; For the below test case, 'b' in 'ret == b' needs SLL/SLR.
; 'ret' in 'ret == b' does not need SLL/SLR as all 'ret' values
; are assigned through 'w<reg> = <value>' alu32 operations.
;
; extern int helper(int);
; int test(int a, int b, int c, int d) {
;   int ret;
;   if (a < b)
;     ret = (c < d) ? -1 : 0;
;   else
;     ret = (c < a) ? 1 : 2;
;   return helper(ret == b);
; }

define dso_local i32 @test(i32 %a, i32 %b, i32 %c, i32 %d) local_unnamed_addr {
entry:
  %cmp = icmp slt i32 %a, %b
  %cmp1 = icmp slt i32 %c, %d
  %cond = sext i1 %cmp1 to i32
  %cmp2 = icmp slt i32 %c, %a
  %cond3 = select i1 %cmp2, i32 1, i32 2
  %ret.0 = select i1 %cmp, i32 %cond, i32 %cond3
  %cmp4 = icmp eq i32 %ret.0, %b
  %conv = zext i1 %cmp4 to i32
  %call = tail call i32 @helper(i32 %conv)
  ret i32 %call
}
; CHECK: r{{[0-9]+}} = w{{[0-9]+}}
; CHECK-NOT: r{{[0-9]+}} >>= 32
; CHECK: if r{{[0-9]+}} == r{{[0-9]+}} goto

declare dso_local i32 @helper(i32) local_unnamed_addr