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
7 define arm_aapcscc void @test_indirect_call(ptr %fptr) {
8 ; NOV4T-LABEL: name: test_indirect_call
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
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
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
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
41 notail call arm_aapcscc void %fptr()
45 declare arm_aapcscc void @call_target()
47 define arm_aapcscc void @test_direct_call() {
48 ; NOV4T-LABEL: name: test_direct_call
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
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
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
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
73 notail call arm_aapcscc void @call_target()