1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple riscv32 -mattr=+experimental-zicfilp < %s | FileCheck %s
3 ; RUN: llc -mtriple riscv64 -mattr=+experimental-zicfilp < %s | FileCheck %s
4 ; RUN: llc -mtriple riscv32 < %s | FileCheck %s --check-prefix=NO-ZICFILP
5 ; RUN: llc -mtriple riscv64 < %s | FileCheck %s --check-prefix=NO-ZICFILP
7 ; Test using t2 to jump table branch.
8 define void @above_threshold(i32 signext %in, ptr %out) nounwind {
9 ; CHECK-LABEL: above_threshold:
10 ; CHECK: # %bb.0: # %entry
11 ; CHECK-NEXT: addi a0, a0, -1
12 ; CHECK-NEXT: li a2, 5
13 ; CHECK-NEXT: bltu a2, a0, .LBB0_9
14 ; CHECK-NEXT: # %bb.1: # %entry
15 ; CHECK-NEXT: slli a0, a0, 2
16 ; CHECK-NEXT: lui a2, %hi(.LJTI0_0)
17 ; CHECK-NEXT: addi a2, a2, %lo(.LJTI0_0)
18 ; CHECK-NEXT: add a0, a0, a2
19 ; CHECK-NEXT: lw t2, 0(a0)
21 ; CHECK-NEXT: .LBB0_2: # %bb1
22 ; CHECK-NEXT: li a0, 4
23 ; CHECK-NEXT: j .LBB0_8
24 ; CHECK-NEXT: .LBB0_3: # %bb5
25 ; CHECK-NEXT: li a0, 100
26 ; CHECK-NEXT: j .LBB0_8
27 ; CHECK-NEXT: .LBB0_4: # %bb3
28 ; CHECK-NEXT: li a0, 2
29 ; CHECK-NEXT: j .LBB0_8
30 ; CHECK-NEXT: .LBB0_5: # %bb4
31 ; CHECK-NEXT: li a0, 1
32 ; CHECK-NEXT: j .LBB0_8
33 ; CHECK-NEXT: .LBB0_6: # %bb2
34 ; CHECK-NEXT: li a0, 3
35 ; CHECK-NEXT: j .LBB0_8
36 ; CHECK-NEXT: .LBB0_7: # %bb6
37 ; CHECK-NEXT: li a0, 200
38 ; CHECK-NEXT: .LBB0_8: # %exit
39 ; CHECK-NEXT: sw a0, 0(a1)
40 ; CHECK-NEXT: .LBB0_9: # %exit
43 ; NO-ZICFILP-LABEL: above_threshold:
44 ; NO-ZICFILP: # %bb.0: # %entry
45 ; NO-ZICFILP-NEXT: addi a0, a0, -1
46 ; NO-ZICFILP-NEXT: li a2, 5
47 ; NO-ZICFILP-NEXT: bltu a2, a0, .LBB0_9
48 ; NO-ZICFILP-NEXT: # %bb.1: # %entry
49 ; NO-ZICFILP-NEXT: slli a0, a0, 2
50 ; NO-ZICFILP-NEXT: lui a2, %hi(.LJTI0_0)
51 ; NO-ZICFILP-NEXT: addi a2, a2, %lo(.LJTI0_0)
52 ; NO-ZICFILP-NEXT: add a0, a0, a2
53 ; NO-ZICFILP-NEXT: lw a0, 0(a0)
54 ; NO-ZICFILP-NEXT: jr a0
55 ; NO-ZICFILP-NEXT: .LBB0_2: # %bb1
56 ; NO-ZICFILP-NEXT: li a0, 4
57 ; NO-ZICFILP-NEXT: j .LBB0_8
58 ; NO-ZICFILP-NEXT: .LBB0_3: # %bb5
59 ; NO-ZICFILP-NEXT: li a0, 100
60 ; NO-ZICFILP-NEXT: j .LBB0_8
61 ; NO-ZICFILP-NEXT: .LBB0_4: # %bb3
62 ; NO-ZICFILP-NEXT: li a0, 2
63 ; NO-ZICFILP-NEXT: j .LBB0_8
64 ; NO-ZICFILP-NEXT: .LBB0_5: # %bb4
65 ; NO-ZICFILP-NEXT: li a0, 1
66 ; NO-ZICFILP-NEXT: j .LBB0_8
67 ; NO-ZICFILP-NEXT: .LBB0_6: # %bb2
68 ; NO-ZICFILP-NEXT: li a0, 3
69 ; NO-ZICFILP-NEXT: j .LBB0_8
70 ; NO-ZICFILP-NEXT: .LBB0_7: # %bb6
71 ; NO-ZICFILP-NEXT: li a0, 200
72 ; NO-ZICFILP-NEXT: .LBB0_8: # %exit
73 ; NO-ZICFILP-NEXT: sw a0, 0(a1)
74 ; NO-ZICFILP-NEXT: .LBB0_9: # %exit
75 ; NO-ZICFILP-NEXT: ret
77 switch i32 %in, label %exit [
98 store i32 100, ptr %out
101 store i32 200, ptr %out