llvm/llvm/test/CodeGen/LoongArch/ir-instruction/indirectbr.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s

define i32 @indirectbr(ptr %target) nounwind {
; CHECK-LABEL: indirectbr:
; CHECK:       # %bb.0:
; CHECK-NEXT:    jr $a0
; CHECK-NEXT:  .LBB0_1: # %test_label
; CHECK-NEXT:    move $a0, $zero
; CHECK-NEXT:    ret
  indirectbr ptr %target, [label %test_label]
test_label:
  br label %ret
ret:
  ret i32 0
}

define i32 @indirectbr_with_offset(ptr %a) nounwind {
; CHECK-LABEL: indirectbr_with_offset:
; CHECK:       # %bb.0:
; CHECK-NEXT:    jirl $zero, $a0, 1380
; CHECK-NEXT:  .LBB1_1: # %test_label
; CHECK-NEXT:    move $a0, $zero
; CHECK-NEXT:    ret
  %target = getelementptr inbounds i8, ptr %a, i32 1380
  indirectbr ptr %target, [label %test_label]
test_label:
  br label %ret
ret:
  ret i32 0
}