llvm/llvm/test/CodeGen/Xtensa/indirectbr.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
; RUN: llc -mtriple=xtensa -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=XTENSA %s

define i32 @indirectbr(i8* %target) nounwind {
; XTENSA-LABEL: indirectbr:
; XTENSA:         jx a2
; XTENSA-NEXT:  .LBB0_1: # %test_label
; XTENSA-NEXT:    movi a2, 0
; XTENSA-NEXT:    ret
  indirectbr i8* %target, [label %test_label]
test_label:
  br label %ret
ret:
  ret i32 0
}

define i32 @indirectbr_with_offset(i8* %a) nounwind {
; XTENSA-LABEL: indirectbr_with_offset:
; XTENSA:         movi a8, 1380
; XTENSA-NEXT:    add a8, a2, a8
; XTENSA-NEXT:    jx a8
; XTENSA-NEXT:  .LBB1_1: # %test_label
; XTENSA-NEXT:    movi a2, 0
; XTENSA-NEXT:    ret
  %target = getelementptr inbounds i8, i8* %a, i32 1380
  indirectbr i8* %target, [label %test_label]
test_label:
  br label %ret
ret:
  ret i32 0
}