• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3; RUN:   | FileCheck %s -check-prefix=RV32I
4
5define i32 @indirectbr(i8* %target) nounwind {
6; RV32I-LABEL: indirectbr:
7; RV32I:       # %bb.0:
8; RV32I-NEXT:    addi sp, sp, -16
9; RV32I-NEXT:    sw ra, 12(sp)
10; RV32I-NEXT:    jr a0
11; RV32I-NEXT:  .LBB0_1:
12; RV32I-NEXT:    mv a0, zero
13; RV32I-NEXT:    lw ra, 12(sp)
14; RV32I-NEXT:    addi sp, sp, 16
15; RV32I-NEXT:    ret
16  indirectbr i8* %target, [label %test_label]
17test_label:
18  br label %ret
19ret:
20  ret i32 0
21}
22
23define i32 @indirectbr_with_offset(i8* %a) nounwind {
24; RV32I-LABEL: indirectbr_with_offset:
25; RV32I:       # %bb.0:
26; RV32I-NEXT:    addi sp, sp, -16
27; RV32I-NEXT:    sw ra, 12(sp)
28; RV32I-NEXT:    jalr zero, a0, 1380
29; RV32I-NEXT:  .LBB1_1:
30; RV32I-NEXT:    mv a0, zero
31; RV32I-NEXT:    lw ra, 12(sp)
32; RV32I-NEXT:    addi sp, sp, 16
33; RV32I-NEXT:    ret
34  %target = getelementptr inbounds i8, i8* %a, i32 1380
35  indirectbr i8* %target, [label %test_label]
36test_label:
37  br label %ret
38ret:
39  ret i32 0
40}
41