brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.5 KiB · 7dd47ac Raw
168 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s3; RUN: llc < %s -mtriple=arm64-eabi -global-isel -global-isel-abort=1 | FileCheck %s4; RUN: llc < %s -mtriple=arm64-eabi -global-isel -global-isel-abort=1 -stop-after=irtranslator | FileCheck %s --check-prefix=GISEL-MIR5 6%struct.A = type { i8 }7%struct.B = type { i32 }8%struct.C = type { %struct.B }9%struct.D = type { %struct.B }10%struct.E = type { %struct.B, %struct.B }11 12declare ptr @A_ctor_base(ptr returned)13declare ptr @B_ctor_base(ptr returned, i32)14declare ptr @B_ctor_complete(ptr returned, i32)15 16declare ptr @A_ctor_base_nothisret(ptr)17declare ptr @B_ctor_base_nothisret(ptr, i32)18declare ptr @B_ctor_complete_nothisret(ptr, i32)19 20define ptr @C_ctor_base(ptr returned %this, i32 %x) {21  ; GISEL-MIR-LABEL: name: C_ctor_base22  ; GISEL-MIR: bb.1.entry:23  ; GISEL-MIR:   liveins: $w1, $x024  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x025  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w126  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp27  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)28  ; GISEL-MIR:   BL @A_ctor_base, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x029  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp30  ; GISEL-MIR:   [[COPY2:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)31  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)32  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)33  ; GISEL-MIR:   TCRETURNdi @B_ctor_base, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $w134entry:35; CHECK-LABEL: C_ctor_base:36; CHECK-NOT: mov {{x[0-9]+}}, x037; CHECK: bl {{_?A_ctor_base}}38; CHECK-NOT: mov x0, {{x[0-9]+}}39; CHECK: b {{_?B_ctor_base}}40  %call = tail call ptr @A_ctor_base(ptr returned %this)41  %call2 = tail call ptr @B_ctor_base(ptr returned %this, i32 %x)42  ret ptr %this43}44 45define ptr @C_ctor_base_nothisret(ptr %this, i32 %x) {46  ; GISEL-MIR-LABEL: name: C_ctor_base_nothisret47  ; GISEL-MIR: bb.1.entry:48  ; GISEL-MIR:   liveins: $w1, $x049  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x050  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w151  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp52  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)53  ; GISEL-MIR:   BL @A_ctor_base_nothisret, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit-def $x054  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp55  ; GISEL-MIR:   [[COPY2:%[0-9]+]]:_(p0) = COPY $x056  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp57  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)58  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)59  ; GISEL-MIR:   BL @B_ctor_base_nothisret, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1, implicit-def $x060  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp61  ; GISEL-MIR:   [[COPY3:%[0-9]+]]:_(p0) = COPY $x062  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)63  ; GISEL-MIR:   RET_ReallyLR implicit $x064entry:65; CHECK-LABEL: C_ctor_base_nothisret:66; CHECK: mov [[SAVETHIS:x[0-9]+]], x067; CHECK: bl {{_?A_ctor_base_nothisret}}68; CHECK: mov x0, [[SAVETHIS]]69; CHECK-NOT: b {{_?B_ctor_base_nothisret}}70  %call = tail call ptr @A_ctor_base_nothisret(ptr %this)71  %call2 = tail call ptr @B_ctor_base_nothisret(ptr %this, i32 %x)72  ret ptr %this73}74 75define ptr @C_ctor_complete(ptr %this, i32 %x) {76  ; GISEL-MIR-LABEL: name: C_ctor_complete77  ; GISEL-MIR: bb.1.entry:78  ; GISEL-MIR:   liveins: $w1, $x079  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x080  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w181  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)82  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)83  ; GISEL-MIR:   TCRETURNdi @C_ctor_base, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $w184entry:85; CHECK-LABEL: C_ctor_complete:86; CHECK: b {{_?C_ctor_base}}87  %call = tail call ptr @C_ctor_base(ptr returned %this, i32 %x)88  ret ptr %this89}90 91define ptr @C_ctor_complete_nothisret(ptr %this, i32 %x) {92  ; GISEL-MIR-LABEL: name: C_ctor_complete_nothisret93  ; GISEL-MIR: bb.1.entry:94  ; GISEL-MIR:   liveins: $w1, $x095  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x096  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w197  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp98  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)99  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)100  ; GISEL-MIR:   BL @C_ctor_base_nothisret, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1, implicit-def $x0101  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp102  ; GISEL-MIR:   [[COPY2:%[0-9]+]]:_(p0) = COPY $x0103  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)104  ; GISEL-MIR:   RET_ReallyLR implicit $x0105entry:106; CHECK-LABEL: C_ctor_complete_nothisret:107; CHECK-NOT: b {{_?C_ctor_base_nothisret}}108  %call = tail call ptr @C_ctor_base_nothisret(ptr %this, i32 %x)109  ret ptr %this110}111 112define ptr @D_ctor_base(ptr %this, i32 %x) {113  ; GISEL-MIR-LABEL: name: D_ctor_base114  ; GISEL-MIR: bb.1.entry:115  ; GISEL-MIR:   liveins: $w1, $x0116  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0117  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w1118  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp119  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)120  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)121  ; GISEL-MIR:   BL @B_ctor_complete, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1122  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp123  ; GISEL-MIR:   [[COPY2:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)124  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)125  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)126  ; GISEL-MIR:   TCRETURNdi @B_ctor_complete, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $w1127entry:128; CHECK-LABEL: D_ctor_base:129; CHECK-NOT: mov {{x[0-9]+}}, x0130; CHECK: bl {{_?B_ctor_complete}}131; CHECK-NOT: mov x0, {{x[0-9]+}}132; CHECK: b {{_?B_ctor_complete}}133  %call = tail call ptr @B_ctor_complete(ptr returned %this, i32 %x)134  %call2 = tail call ptr @B_ctor_complete(ptr returned %this, i32 %x)135  ret ptr %this136}137 138define ptr @E_ctor_base(ptr %this, i32 %x) {139  ; GISEL-MIR-LABEL: name: E_ctor_base140  ; GISEL-MIR: bb.1.entry:141  ; GISEL-MIR:   liveins: $w1, $x0142  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0143  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w1144  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp145  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)146  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)147  ; GISEL-MIR:   BL @B_ctor_complete, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1148  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp149  ; GISEL-MIR:   [[COPY2:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)150  ; GISEL-MIR:   [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4151  ; GISEL-MIR:   [[PTR_ADD:%[0-9]+]]:_(p0) = nuw nusw inbounds G_PTR_ADD [[COPY]], [[C]](s64)152  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp153  ; GISEL-MIR:   $x0 = COPY [[PTR_ADD]](p0)154  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)155  ; GISEL-MIR:   BL @B_ctor_complete, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1156  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp157  ; GISEL-MIR:   [[COPY3:%[0-9]+]]:_(p0) = COPY [[PTR_ADD]](p0)158  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)159  ; GISEL-MIR:   RET_ReallyLR implicit $x0160entry:161; CHECK-LABEL: E_ctor_base:162; CHECK-NOT: b {{_?B_ctor_complete}}163  %call = tail call ptr @B_ctor_complete(ptr returned %this, i32 %x)164  %b2 = getelementptr inbounds %struct.E, ptr %this, i32 0, i32 1165  %call2 = tail call ptr @B_ctor_complete(ptr returned %b2, i32 %x)166  ret ptr %this167}168