blob: 0a51e3d0b2efe34710eaa1655306f0dead112990 [file] [log] [blame]
Alex Bradburyffc435e2017-11-21 08:11:03 +00001; 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: sw ra, 0(s0)
9; RV32I-NEXT: jalr zero, a0, 0
10; RV32I-NEXT: .LBB0_1: # %ret
11; RV32I-NEXT: addi a0, zero, 0
12; RV32I-NEXT: lw ra, 0(s0)
13; RV32I-NEXT: jalr zero, ra, 0
14 indirectbr i8* %target, [label %test_label]
15test_label:
16 br label %ret
17ret:
18 ret i32 0
19}
20
21define i32 @indirectbr_with_offset(i8* %a) nounwind {
22; RV32I-LABEL: indirectbr_with_offset:
23; RV32I: # BB#0:
24; RV32I-NEXT: sw ra, 0(s0)
25; RV32I-NEXT: jalr zero, a0, 1380
26; RV32I-NEXT: .LBB1_1: # %ret
27; RV32I-NEXT: addi a0, zero, 0
28; RV32I-NEXT: lw ra, 0(s0)
29; RV32I-NEXT: jalr zero, ra, 0
30 %target = getelementptr inbounds i8, i8* %a, i32 1380
31 indirectbr i8* %target, [label %test_label]
32test_label:
33 br label %ret
34ret:
35 ret i32 0
36}