1 # RUN: llc -mtriple=riscv32 -x mir -run-pass=machine-outliner -simplify-mir -verify-machineinstrs < %s \
2 # RUN: | FileCheck -check-prefixes=CHECK,RV32I-MO %s
3 # RUN: llc -mtriple=riscv64 -x mir -run-pass=machine-outliner -simplify-mir -verify-machineinstrs < %s \
4 # RUN: | FileCheck -check-prefixes=CHECK,RV64I-MO %s
7 define i32 @outline_0(i32 %a, i32 %b) { ret i32 0 }
9 define i32 @outline_1(i32 %a, i32 %b) { ret i32 0 }
11 define i32 @outline_2(i32 %a, i32 %b) { ret i32 0 }
13 ; Should not outline linkonce_odr functions which could be deduplicated by the
15 define linkonce_odr i32 @dont_outline_0(i32 %a, i32 %b) { ret i32 0 }
17 ; Should not outline functions with named linker sections
18 define i32 @dont_outline_1(i32 %a, i32 %b) section "named" { ret i32 0 }
20 ; Cannot outline if the X5 (t0) register is not free
21 define i32 @dont_outline_2(i32 %a, i32 %b) { ret i32 0 }
26 tracksRegLiveness: true
31 ; RV32I-MO-LABEL: name: outline_0
32 ; RV32I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
34 ; RV64I-MO-LABEL: name: outline_0
35 ; RV64I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
40 PseudoRET implicit $x10
45 tracksRegLiveness: true
50 ; RV32I-MO-LABEL: name: outline_1
51 ; RV32I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
53 ; RV64I-MO-LABEL: name: outline_1
54 ; RV64I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
59 PseudoRET implicit $x10
64 tracksRegLiveness: true
69 ; RV32I-MO-LABEL: name: outline_2
70 ; RV32I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
72 ; RV64I-MO-LABEL: name: outline_2
73 ; RV64I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
78 PseudoRET implicit $x10
83 tracksRegLiveness: true
88 ; RV32I-MO-LABEL: name: dont_outline_0
89 ; RV32I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
91 ; RV64I-MO-LABEL: name: dont_outline_0
92 ; RV64I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
97 PseudoRET implicit $x10
102 tracksRegLiveness: true
107 ; RV32I-MO-LABEL: name: dont_outline_1
108 ; RV32I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
110 ; RV64I-MO-LABEL: name: dont_outline_1
111 ; RV64I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
112 $x11 = ORI $x11, 1023
114 $x11 = AND $x12, $x11
115 $x10 = SUB $x10, $x11
116 PseudoRET implicit $x10
121 tracksRegLiveness: true
125 liveins: $x10, $x11, $x5
126 ; RV32I-MO-LABEL: name: dont_outline_2
127 ; RV32I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
129 ; RV64I-MO-LABEL: name: dont_outline_2
130 ; RV64I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
131 $x11 = ORI $x11, 1023
133 $x11 = AND $x12, $x11
134 $x10 = SUB $x10, $x11
136 PseudoRET implicit $x10
140 # CHECK-LABEL: name: OUTLINED_FUNCTION_0
141 # CHECK: isOutlined: true