Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 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 | |
| 5 | define 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] |
| 15 | test_label: |
| 16 | br label %ret |
| 17 | ret: |
| 18 | ret i32 0 |
| 19 | } |
| 20 | |
| 21 | define 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] |
| 32 | test_label: |
| 33 | br label %ret |
| 34 | ret: |
| 35 | ret i32 0 |
| 36 | } |