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