File: jumptable-swguarded.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (105 lines) | stat: -rw-r--r-- 3,109 bytes parent folder | download | duplicates (3)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple riscv32 -mattr=+experimental-zicfilp < %s | FileCheck %s
; RUN: llc -mtriple riscv64 -mattr=+experimental-zicfilp < %s | FileCheck %s
; RUN: llc -mtriple riscv32 < %s | FileCheck %s --check-prefix=NO-ZICFILP
; RUN: llc -mtriple riscv64 < %s | FileCheck %s --check-prefix=NO-ZICFILP

; Test using t2 to jump table branch.
define void @above_threshold(i32 signext %in, ptr %out) nounwind {
; CHECK-LABEL: above_threshold:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    addi a0, a0, -1
; CHECK-NEXT:    li a2, 5
; CHECK-NEXT:    bltu a2, a0, .LBB0_9
; CHECK-NEXT:  # %bb.1: # %entry
; CHECK-NEXT:    slli a0, a0, 2
; CHECK-NEXT:    lui a2, %hi(.LJTI0_0)
; CHECK-NEXT:    addi a2, a2, %lo(.LJTI0_0)
; CHECK-NEXT:    add a0, a0, a2
; CHECK-NEXT:    lw t2, 0(a0)
; CHECK-NEXT:    jr t2
; CHECK-NEXT:  .LBB0_2: # %bb1
; CHECK-NEXT:    li a0, 4
; CHECK-NEXT:    j .LBB0_8
; CHECK-NEXT:  .LBB0_3: # %bb5
; CHECK-NEXT:    li a0, 100
; CHECK-NEXT:    j .LBB0_8
; CHECK-NEXT:  .LBB0_4: # %bb3
; CHECK-NEXT:    li a0, 2
; CHECK-NEXT:    j .LBB0_8
; CHECK-NEXT:  .LBB0_5: # %bb4
; CHECK-NEXT:    li a0, 1
; CHECK-NEXT:    j .LBB0_8
; CHECK-NEXT:  .LBB0_6: # %bb2
; CHECK-NEXT:    li a0, 3
; CHECK-NEXT:    j .LBB0_8
; CHECK-NEXT:  .LBB0_7: # %bb6
; CHECK-NEXT:    li a0, 200
; CHECK-NEXT:  .LBB0_8: # %exit
; CHECK-NEXT:    sw a0, 0(a1)
; CHECK-NEXT:  .LBB0_9: # %exit
; CHECK-NEXT:    ret
;
; NO-ZICFILP-LABEL: above_threshold:
; NO-ZICFILP:       # %bb.0: # %entry
; NO-ZICFILP-NEXT:    addi a0, a0, -1
; NO-ZICFILP-NEXT:    li a2, 5
; NO-ZICFILP-NEXT:    bltu a2, a0, .LBB0_9
; NO-ZICFILP-NEXT:  # %bb.1: # %entry
; NO-ZICFILP-NEXT:    slli a0, a0, 2
; NO-ZICFILP-NEXT:    lui a2, %hi(.LJTI0_0)
; NO-ZICFILP-NEXT:    addi a2, a2, %lo(.LJTI0_0)
; NO-ZICFILP-NEXT:    add a0, a0, a2
; NO-ZICFILP-NEXT:    lw a0, 0(a0)
; NO-ZICFILP-NEXT:    jr a0
; NO-ZICFILP-NEXT:  .LBB0_2: # %bb1
; NO-ZICFILP-NEXT:    li a0, 4
; NO-ZICFILP-NEXT:    j .LBB0_8
; NO-ZICFILP-NEXT:  .LBB0_3: # %bb5
; NO-ZICFILP-NEXT:    li a0, 100
; NO-ZICFILP-NEXT:    j .LBB0_8
; NO-ZICFILP-NEXT:  .LBB0_4: # %bb3
; NO-ZICFILP-NEXT:    li a0, 2
; NO-ZICFILP-NEXT:    j .LBB0_8
; NO-ZICFILP-NEXT:  .LBB0_5: # %bb4
; NO-ZICFILP-NEXT:    li a0, 1
; NO-ZICFILP-NEXT:    j .LBB0_8
; NO-ZICFILP-NEXT:  .LBB0_6: # %bb2
; NO-ZICFILP-NEXT:    li a0, 3
; NO-ZICFILP-NEXT:    j .LBB0_8
; NO-ZICFILP-NEXT:  .LBB0_7: # %bb6
; NO-ZICFILP-NEXT:    li a0, 200
; NO-ZICFILP-NEXT:  .LBB0_8: # %exit
; NO-ZICFILP-NEXT:    sw a0, 0(a1)
; NO-ZICFILP-NEXT:  .LBB0_9: # %exit
; NO-ZICFILP-NEXT:    ret
entry:
  switch i32 %in, label %exit [
    i32 1, label %bb1
    i32 2, label %bb2
    i32 3, label %bb3
    i32 4, label %bb4
    i32 5, label %bb5
    i32 6, label %bb6
  ]
bb1:
  store i32 4, ptr %out
  br label %exit
bb2:
  store i32 3, ptr %out
  br label %exit
bb3:
  store i32 2, ptr %out
  br label %exit
bb4:
  store i32 1, ptr %out
  br label %exit
bb5:
  store i32 100, ptr %out
  br label %exit
bb6:
  store i32 200, ptr %out
  br label %exit
exit:
  ret void
}