1 2 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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
; RUN: llc < %s -mtriple=arm64-eabi -global-isel -global-isel-abort=1 | FileCheck %s
; RUN: llc < %s -mtriple=arm64-eabi -global-isel -global-isel-abort=1 -stop-after=irtranslator | FileCheck %s --check-prefix=GISEL-MIR
%struct.A = type { i8 }
%struct.B = type { i32 }
%struct.C = type { %struct.B }
%struct.D = type { %struct.B }
%struct.E = type { %struct.B, %struct.B }
declare ptr @A_ctor_base(ptr returned)
declare ptr @B_ctor_base(ptr returned, i32)
declare ptr @B_ctor_complete(ptr returned, i32)
declare ptr @A_ctor_base_nothisret(ptr)
declare ptr @B_ctor_base_nothisret(ptr, i32)
declare ptr @B_ctor_complete_nothisret(ptr, i32)
define ptr @C_ctor_base(ptr returned %this, i32 %x) {
; GISEL-MIR-LABEL: name: C_ctor_base
; GISEL-MIR: bb.1.entry:
; GISEL-MIR: liveins: $w1, $x0
; GISEL-MIR: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
; GISEL-MIR: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
; GISEL-MIR: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: BL @A_ctor_base, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0
; GISEL-MIR: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: [[COPY2:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: $w1 = COPY [[COPY1]](s32)
; GISEL-MIR: TCRETURNdi @B_ctor_base, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $w1
entry:
; CHECK-LABEL: C_ctor_base:
; CHECK-NOT: mov {{x[0-9]+}}, x0
; CHECK: bl {{_?A_ctor_base}}
; CHECK-NOT: mov x0, {{x[0-9]+}}
; CHECK: b {{_?B_ctor_base}}
%call = tail call ptr @A_ctor_base(ptr returned %this)
%call2 = tail call ptr @B_ctor_base(ptr returned %this, i32 %x)
ret ptr %this
}
define ptr @C_ctor_base_nothisret(ptr %this, i32 %x) {
; GISEL-MIR-LABEL: name: C_ctor_base_nothisret
; GISEL-MIR: bb.1.entry:
; GISEL-MIR: liveins: $w1, $x0
; GISEL-MIR: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
; GISEL-MIR: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
; GISEL-MIR: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: BL @A_ctor_base_nothisret, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit-def $x0
; GISEL-MIR: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: [[COPY2:%[0-9]+]]:_(p0) = COPY $x0
; GISEL-MIR: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: $w1 = COPY [[COPY1]](s32)
; GISEL-MIR: BL @B_ctor_base_nothisret, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1, implicit-def $x0
; GISEL-MIR: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: [[COPY3:%[0-9]+]]:_(p0) = COPY $x0
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: RET_ReallyLR implicit $x0
entry:
; CHECK-LABEL: C_ctor_base_nothisret:
; CHECK: mov [[SAVETHIS:x[0-9]+]], x0
; CHECK: bl {{_?A_ctor_base_nothisret}}
; CHECK: mov x0, [[SAVETHIS]]
; CHECK-NOT: b {{_?B_ctor_base_nothisret}}
%call = tail call ptr @A_ctor_base_nothisret(ptr %this)
%call2 = tail call ptr @B_ctor_base_nothisret(ptr %this, i32 %x)
ret ptr %this
}
define ptr @C_ctor_complete(ptr %this, i32 %x) {
; GISEL-MIR-LABEL: name: C_ctor_complete
; GISEL-MIR: bb.1.entry:
; GISEL-MIR: liveins: $w1, $x0
; GISEL-MIR: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
; GISEL-MIR: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: $w1 = COPY [[COPY1]](s32)
; GISEL-MIR: TCRETURNdi @C_ctor_base, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $w1
entry:
; CHECK-LABEL: C_ctor_complete:
; CHECK: b {{_?C_ctor_base}}
%call = tail call ptr @C_ctor_base(ptr returned %this, i32 %x)
ret ptr %this
}
define ptr @C_ctor_complete_nothisret(ptr %this, i32 %x) {
; GISEL-MIR-LABEL: name: C_ctor_complete_nothisret
; GISEL-MIR: bb.1.entry:
; GISEL-MIR: liveins: $w1, $x0
; GISEL-MIR: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
; GISEL-MIR: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
; GISEL-MIR: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: $w1 = COPY [[COPY1]](s32)
; GISEL-MIR: BL @C_ctor_base_nothisret, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1, implicit-def $x0
; GISEL-MIR: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: [[COPY2:%[0-9]+]]:_(p0) = COPY $x0
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: RET_ReallyLR implicit $x0
entry:
; CHECK-LABEL: C_ctor_complete_nothisret:
; CHECK-NOT: b {{_?C_ctor_base_nothisret}}
%call = tail call ptr @C_ctor_base_nothisret(ptr %this, i32 %x)
ret ptr %this
}
define ptr @D_ctor_base(ptr %this, i32 %x) {
; GISEL-MIR-LABEL: name: D_ctor_base
; GISEL-MIR: bb.1.entry:
; GISEL-MIR: liveins: $w1, $x0
; GISEL-MIR: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
; GISEL-MIR: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
; GISEL-MIR: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: $w1 = COPY [[COPY1]](s32)
; GISEL-MIR: BL @B_ctor_complete, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1
; GISEL-MIR: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: [[COPY2:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: $w1 = COPY [[COPY1]](s32)
; GISEL-MIR: TCRETURNdi @B_ctor_complete, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $w1
entry:
; CHECK-LABEL: D_ctor_base:
; CHECK-NOT: mov {{x[0-9]+}}, x0
; CHECK: bl {{_?B_ctor_complete}}
; CHECK-NOT: mov x0, {{x[0-9]+}}
; CHECK: b {{_?B_ctor_complete}}
%call = tail call ptr @B_ctor_complete(ptr returned %this, i32 %x)
%call2 = tail call ptr @B_ctor_complete(ptr returned %this, i32 %x)
ret ptr %this
}
define ptr @E_ctor_base(ptr %this, i32 %x) {
; GISEL-MIR-LABEL: name: E_ctor_base
; GISEL-MIR: bb.1.entry:
; GISEL-MIR: liveins: $w1, $x0
; GISEL-MIR: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
; GISEL-MIR: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
; GISEL-MIR: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: $w1 = COPY [[COPY1]](s32)
; GISEL-MIR: BL @B_ctor_complete, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1
; GISEL-MIR: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: [[COPY2:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
; GISEL-MIR: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
; GISEL-MIR: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s64)
; GISEL-MIR: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: $x0 = COPY [[PTR_ADD]](p0)
; GISEL-MIR: $w1 = COPY [[COPY1]](s32)
; GISEL-MIR: BL @B_ctor_complete, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1
; GISEL-MIR: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
; GISEL-MIR: [[COPY3:%[0-9]+]]:_(p0) = COPY [[PTR_ADD]](p0)
; GISEL-MIR: $x0 = COPY [[COPY]](p0)
; GISEL-MIR: RET_ReallyLR implicit $x0
entry:
; CHECK-LABEL: E_ctor_base:
; CHECK-NOT: b {{_?B_ctor_complete}}
%call = tail call ptr @B_ctor_complete(ptr returned %this, i32 %x)
%b2 = getelementptr inbounds %struct.E, ptr %this, i32 0, i32 1
%call2 = tail call ptr @B_ctor_complete(ptr returned %b2, i32 %x)
ret ptr %this
}
|