xref: /llvm-project/llvm/test/CodeGen/Xtensa/indirectbr.ll (revision cc8fdd60c2f791dba70c9e458173640d7da836e3)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2; RUN: llc -mtriple=xtensa -verify-machineinstrs < %s \
3; RUN: | FileCheck -check-prefix=XTENSA %s
4
5define i32 @indirectbr(i8* %target) nounwind {
6; XTENSA-LABEL: indirectbr:
7; XTENSA:         jx a2
8; XTENSA-NEXT:  .LBB0_1: # %test_label
9; XTENSA-NEXT:    movi a2, 0
10; XTENSA-NEXT:    ret
11  indirectbr i8* %target, [label %test_label]
12test_label:
13  br label %ret
14ret:
15  ret i32 0
16}
17
18define i32 @indirectbr_with_offset(i8* %a) nounwind {
19; XTENSA-LABEL: indirectbr_with_offset:
20; XTENSA:         movi a8, 1380
21; XTENSA-NEXT:    add a8, a2, a8
22; XTENSA-NEXT:    jx a8
23; XTENSA-NEXT:  .LBB1_1: # %test_label
24; XTENSA-NEXT:    movi a2, 0
25; XTENSA-NEXT:    ret
26  %target = getelementptr inbounds i8, i8* %a, i32 1380
27  indirectbr i8* %target, [label %test_label]
28test_label:
29  br label %ret
30ret:
31  ret i32 0
32}
33