| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 
 | ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
; RUN: llc -mtriple arm-unknown -mattr=-v4t -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=NOV4T
; RUN: llc -mtriple arm-unknown -mattr=+v4t -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=V4T
; RUN: llc -mtriple arm-unknown -mattr=+v5t -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=V5T
; RUN: llc -mtriple thumb-unknown -mattr=+v6t2 -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=THUMB
define arm_aapcscc void @test_indirect_call(ptr %fptr) {
  ; NOV4T-LABEL: name: test_indirect_call
  ; NOV4T: bb.1.entry:
  ; NOV4T:   liveins: $r0
  ; NOV4T:   [[COPY:%[0-9]+]]:tgpr(p0) = COPY $r0
  ; NOV4T:   ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; NOV4T:   BMOVPCRX_CALL [[COPY]](p0), csr_aapcs, implicit-def $lr, implicit $sp
  ; NOV4T:   ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; NOV4T:   MOVPCLR 14 /* CC::al */, $noreg
  ; V4T-LABEL: name: test_indirect_call
  ; V4T: bb.1.entry:
  ; V4T:   liveins: $r0
  ; V4T:   [[COPY:%[0-9]+]]:tgpr(p0) = COPY $r0
  ; V4T:   ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; V4T:   BX_CALL [[COPY]](p0), csr_aapcs, implicit-def $lr, implicit $sp
  ; V4T:   ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; V4T:   BX_RET 14 /* CC::al */, $noreg
  ; V5T-LABEL: name: test_indirect_call
  ; V5T: bb.1.entry:
  ; V5T:   liveins: $r0
  ; V5T:   [[COPY:%[0-9]+]]:gpr(p0) = COPY $r0
  ; V5T:   ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; V5T:   BLX [[COPY]](p0), csr_aapcs, implicit-def $lr, implicit $sp
  ; V5T:   ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; V5T:   BX_RET 14 /* CC::al */, $noreg
  ; THUMB-LABEL: name: test_indirect_call
  ; THUMB: bb.1.entry:
  ; THUMB:   liveins: $r0
  ; THUMB:   [[COPY:%[0-9]+]]:gpr(p0) = COPY $r0
  ; THUMB:   ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; THUMB:   tBLXr 14 /* CC::al */, $noreg, [[COPY]](p0), csr_aapcs, implicit-def $lr, implicit $sp
  ; THUMB:   ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; THUMB:   tBX_RET 14 /* CC::al */, $noreg
entry:
  notail call arm_aapcscc void %fptr()
  ret void
}
declare arm_aapcscc void @call_target()
define arm_aapcscc void @test_direct_call() {
  ; NOV4T-LABEL: name: test_direct_call
  ; NOV4T: bb.1.entry:
  ; NOV4T:   ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; NOV4T:   BL @call_target, csr_aapcs, implicit-def $lr, implicit $sp
  ; NOV4T:   ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; NOV4T:   MOVPCLR 14 /* CC::al */, $noreg
  ; V4T-LABEL: name: test_direct_call
  ; V4T: bb.1.entry:
  ; V4T:   ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; V4T:   BL @call_target, csr_aapcs, implicit-def $lr, implicit $sp
  ; V4T:   ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; V4T:   BX_RET 14 /* CC::al */, $noreg
  ; V5T-LABEL: name: test_direct_call
  ; V5T: bb.1.entry:
  ; V5T:   ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; V5T:   BL @call_target, csr_aapcs, implicit-def $lr, implicit $sp
  ; V5T:   ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; V5T:   BX_RET 14 /* CC::al */, $noreg
  ; THUMB-LABEL: name: test_direct_call
  ; THUMB: bb.1.entry:
  ; THUMB:   ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; THUMB:   tBL 14 /* CC::al */, $noreg, @call_target, csr_aapcs, implicit-def $lr, implicit $sp
  ; THUMB:   ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def $sp, implicit $sp
  ; THUMB:   tBX_RET 14 /* CC::al */, $noreg
entry:
  notail call arm_aapcscc void @call_target()
  ret void
}
 |