brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.1 KiB · 353fe3d Raw
327 lines · plain
1# RUN: llc -mtriple=s390x-linux-gnu -start-before=prologepilog %s -o - -mcpu=z14 \2# RUN:   -verify-machineinstrs 2>&1 | FileCheck %s3#4# Test that redundant frame addressing anchor points are removed by5# MachineLateInstrsCleanup.6 7--- |8  define void @fun1() { ret void }9  define void @fun2() { ret void }10  define void @fun3() { ret void }11  define void @fun4() { ret void }12  define void @fun5() { ret void }13  define void @fun6() { ret void }14  define void @fun7() { ret void }15  define void @fun8() { ret void }16 17  declare i32 @foo()18 19  @ptr = external dso_local local_unnamed_addr global ptr20---21 22# Test elimination of redundant LAYs in successor blocks.23# CHECK-LABEL: fun1:24# CHECK: lay %r1, 4096(%r15)25# CHECK: # %bb.1:26# CHECK-NOT: lay27# CHECK: .LBB0_2:28# CHECK-NOT: lay29---30name:            fun131tracksRegLiveness: true32stack:33  - { id: 0, size: 5000 }34  - { id: 1, size: 2500 }35  - { id: 2, size: 2500 }36 37machineFunctionInfo: {}38body:             |39  bb.0 (%ir-block.0):40    liveins: $f16d41    successors: %bb.2(0x00000001), %bb.1(0x7fffffff)42 43    VST64 renamable $f16d, %stack.0, 0, $noreg44    VST64 renamable $f16d, %stack.0, 0, $noreg45    VST64 renamable $f16d, %stack.0, 0, $noreg46    VST64 renamable $f16d, %stack.0, 0, $noreg47    VST64 renamable $f16d, %stack.0, 0, $noreg48    VST64 renamable $f16d, %stack.1, 0, $noreg49    CHIMux undef $r0l, 3, implicit-def $cc50    BRC 14, 8, %bb.2, implicit killed $cc51    J %bb.152 53  bb.1:54    liveins: $f16d55    VST64 renamable $f16d, %stack.2, 0, $noreg56    J %bb.257 58  bb.2:59    liveins: $f16d60    VST64 renamable $f16d, %stack.1, 0, $noreg61    Return62...63 64# In this function the LAY in bb.1 will have a different offset, so the first65# LAY in bb.2 must remain.66# CHECK-LABEL: fun2:67# CHECK: lay %r1, 4096(%r15)68# CHECK: # %bb.1:69# CHECK: lay %r1, 8192(%r15)70# CHECK: .LBB1_2:71# CHECK: lay %r1, 4096(%r15)72# CHECK-NOT: lay73---74name:            fun275tracksRegLiveness: true76stack:77  - { id: 0, size: 5000 }78  - { id: 1, size: 5000 }79  - { id: 2, size: 2500 }80 81machineFunctionInfo: {}82body:             |83  bb.0 (%ir-block.0):84    liveins: $f16d85    successors: %bb.2(0x00000001), %bb.1(0x7fffffff)86 87    VST64 renamable $f16d, %stack.0, 0, $noreg88    VST64 renamable $f16d, %stack.0, 0, $noreg89    VST64 renamable $f16d, %stack.0, 0, $noreg90    VST64 renamable $f16d, %stack.0, 0, $noreg91    VST64 renamable $f16d, %stack.0, 0, $noreg92    VST64 renamable $f16d, %stack.1, 0, $noreg93    CHIMux undef $r0l, 3, implicit-def $cc94    BRC 14, 8, %bb.2, implicit killed $cc95    J %bb.196 97  bb.1:98    liveins: $f16d99    VST64 renamable $f16d, %stack.2, 0, $noreg100    J %bb.2101 102  bb.2:103    liveins: $f16d104    VST64 renamable $f16d, %stack.1, 0, $noreg105    VST64 renamable $f16d, %stack.1, 0, $noreg106    Return107...108 109# Test case with a loop (with room for improvement: since %r1 is not clobbered110# inside the loop only the first LAY is needed).111# CHECK-LABEL: fun3:112# CHECK: lay %r1, 4096(%r15)113# CHECK: .LBB2_1:114# CHECK: lay %r1, 4096(%r15)115# CHECK: .LBB2_2:116# CHECK-NOT: lay %r1, 4096(%r15)117---118name:            fun3119tracksRegLiveness: true120stack:121  - { id: 0, size: 5000 }122  - { id: 1, size: 2500 }123  - { id: 2, size: 2500 }124 125machineFunctionInfo: {}126body:             |127  bb.0 (%ir-block.0):128    liveins: $f16d129    successors: %bb.2(0x00000001), %bb.1(0x7fffffff)130 131    VST64 renamable $f16d, %stack.0, 0, $noreg132    VST64 renamable $f16d, %stack.0, 0, $noreg133    VST64 renamable $f16d, %stack.0, 0, $noreg134    VST64 renamable $f16d, %stack.0, 0, $noreg135    VST64 renamable $f16d, %stack.0, 0, $noreg136    VST64 renamable $f16d, %stack.1, 0, $noreg137    CHIMux undef $r0l, 3, implicit-def $cc138    BRC 14, 8, %bb.2, implicit killed $cc139    J %bb.1140 141  bb.1:142    liveins: $f16d143    successors: %bb.2(0x00000001), %bb.1(0x7fffffff)144 145    VST64 renamable $f16d, %stack.2, 0, $noreg146    CHIMux undef $r0l, 3, implicit-def $cc147    BRC 14, 8, %bb.1, implicit killed $cc148    J %bb.2149 150  bb.2:151    liveins: $f16d152    VST64 renamable $f16d, %stack.1, 0, $noreg153    Return154...155 156# Test case with a call which clobbers r1: the second LAY after the call is needed.157# CHECK-LABEL: fun4:158# CHECK: lay %r1, 4096(%r15)159# CHECK: brasl160# CHECK: lay %r1, 4096(%r15)161---162name:            fun4163tracksRegLiveness: true164frameInfo:165  adjustsStack:    true166stack:167  - { id: 0, size: 5000 }168  - { id: 1, size: 2500 }169 170machineFunctionInfo: {}171body:             |172  bb.0 (%ir-block.0):173    liveins: $f16d174 175    VST64 renamable $f16d, %stack.0, 0, $noreg176    VST64 renamable $f16d, %stack.0, 0, $noreg177    VST64 renamable $f16d, %stack.0, 0, $noreg178    VST64 renamable $f16d, %stack.0, 0, $noreg179    VST64 renamable $f16d, %stack.0, 0, $noreg180    VST64 renamable $f16d, %stack.1, 0, $noreg181    CallBRASL @foo, csr_systemz_elf, implicit-def dead $r14d, implicit-def dead $cc, implicit $fpc, implicit-def $r2l182    $f17d = IMPLICIT_DEF183    VST64 renamable $f17d, %stack.1, 0, $noreg184    Return185...186 187# Test case where index reg is loaded instead of using an LAY. Only one LGHI is needed.188# CHECK-LABEL: fun5:189# CHECK: lghi %r1, 4096190# CHECK-NOT: lghi191---192name:            fun5193tracksRegLiveness: true194stack:195  - { id: 0, size: 5000 }196  - { id: 1, size: 2500 }197 198machineFunctionInfo: {}199body:             |200  bb.0 (%ir-block.0):201    liveins: $f16d202 203    VST64 renamable $f16d, %stack.0, 0, $noreg204    VST64 renamable $f16d, %stack.0, 0, $noreg205    VST64 renamable $f16d, %stack.0, 0, $noreg206    VST64 renamable $f16d, %stack.0, 0, $noreg207    VST64 renamable $f16d, %stack.0, 0, $noreg208    $f0q = nofpexcept LXEB %stack.1, 0, $noreg, implicit $fpc209    $f1q = nofpexcept LXEB %stack.1, 0, $noreg, implicit $fpc210    Return211...212 213# Test where the constant is a Global. Only one LARL is needed.214# CHECK-LABEL: fun6:215# CHECK: larl %r1, ptr216# CHECK-NOT: larl217---218name:            fun6219alignment:       16220tracksRegLiveness: true221tracksDebugUserValues: true222frameInfo:223  maxAlignment:    1224  maxCallFrameSize: 0225fixedStack:226  - { id: 0, offset: -160, size: 8, alignment: 8 }227machineFunctionInfo: {}228body:             |229  bb.0:230    successors: %bb.2(0x30000000), %bb.1(0x50000000)231 232    renamable $r1d = LARL @ptr233    CGHSI killed renamable $r1d, 0, 0, implicit-def $cc :: (volatile dereferenceable load (s64) from @ptr)234    BRC 14, 8, %bb.2, implicit killed $cc235    J %bb.1236 237  bb.1:238    renamable $r1d = LARL @ptr239    MVGHI killed renamable $r1d, 0, 0240 241  bb.2:242    Return243 244...245 246# Load of an invariant location (GOT). Only one LGRL is needed.247# CHECK-LABEL: fun7:248# CHECK: lgrl %r1, ptr249# CHECK-NOT: lgrl250---251name:            fun7252alignment:       16253tracksRegLiveness: true254tracksDebugUserValues: true255frameInfo:256  maxAlignment:    1257  maxCallFrameSize: 0258fixedStack:259  - { id: 0, offset: -160, size: 8, alignment: 8 }260machineFunctionInfo: {}261body:             |262  bb.0:263    successors: %bb.2(0x30000000), %bb.1(0x50000000)264 265    renamable $r1d = LGRL @ptr :: (load (s64) from got)266    CGHSI killed renamable $r1d, 0, 0, implicit-def $cc :: (volatile dereferenceable load (s64) from @ptr)267    BRC 14, 8, %bb.2, implicit killed $cc268    J %bb.1269 270  bb.1:271    renamable $r1d = LGRL @ptr :: (load (s64) from got)272    MVGHI killed renamable $r1d, 0, 0273 274  bb.2:275    Return276 277...278 279# Load from constant pool. Only one LARL is needed.280# CHECK-LABEL: fun8:281# CHECK: larl %r1, .LCPI7_0282# CHECK-NOT: larl283---284name:            fun8285alignment:       16286tracksRegLiveness: true287tracksDebugUserValues: true288liveins:289  - { reg: '$f0s' }290frameInfo:291  maxAlignment:    1292  maxCallFrameSize: 0293fixedStack:294  - { id: 0, offset: -160, size: 8, alignment: 8 }295constants:296  - id:              0297    value:           float 0x43E0000000000000298    alignment:       4299machineFunctionInfo: {}300body:             |301  bb.0 (%ir-block.0):302    successors: %bb.1, %bb.2303    liveins: $f0s304 305    renamable $r1d = LARL %const.0306    renamable $f1s = LE killed renamable $r1d, 0, $noreg :: (load (s32) from constant-pool)307    nofpexcept CEBR renamable $f0s, renamable $f1s, implicit-def $cc, implicit $fpc308    BRC 15, 11, %bb.2, implicit killed $cc309 310  bb.1:311    liveins: $f0s312 313    J %bb.3314 315  bb.2 (%ir-block.0):316    liveins: $f0s, $f1s317 318    renamable $r1d = LARL %const.0319    renamable $f1s = LE killed renamable $r1d, 0, $noreg :: (load (s32) from constant-pool)320 321  bb.3 (%ir-block.0):322    liveins: $r2d323 324    Return325 326...327