Home | History | Annotate | Download | only in Large
      1 # Test cases where MVC is used for spill slots that end up being out of range.
      2 # RUN: python %s | llc -mtriple=s390x-linux-gnu | FileCheck %s
      3 
      4 # There are 8 usable call-saved GPRs, two of which are needed for the base
      5 # registers.  The first 160 bytes of the frame are needed for the ABI
      6 # call frame, and a further 8 bytes are needed for the emergency spill slot.
      7 # That means we will have at least one out-of-range slot if:
      8 #
      9 #    count == (4096 - 168) / 8 + 6 + 1 == 498
     10 #
     11 # Add in some extra room and check both %r15+4096 (the first out-of-range slot)
     12 # and %r15+4104.
     13 #
     14 # CHECK: f1:
     15 # CHECK: lay [[REG:%r[0-5]]], 4096(%r15)
     16 # CHECK: mvc 0(8,[[REG]]), {{[0-9]+}}({{%r[0-9]+}})
     17 # CHECK: brasl %r14, foo@PLT
     18 # CHECK: lay [[REG:%r[0-5]]], 4096(%r15)
     19 # CHECK: mvc {{[0-9]+}}(8,{{%r[0-9]+}}), 8([[REG]])
     20 # CHECK: br %r14
     21 count = 500
     22 
     23 print 'declare void @foo()'
     24 print ''
     25 print 'define void @f1(i64 *%base0, i64 *%base1) {'
     26 
     27 for i in range(count):
     28     print '  %%ptr%d = getelementptr i64 *%%base%d, i64 %d' % (i, i % 2, i / 2)
     29     print '  %%val%d = load i64 *%%ptr%d' % (i, i)
     30     print ''
     31 
     32 print '  call void @foo()'
     33 print ''
     34 
     35 for i in range(count):
     36     print '  store i64 %%val%d, i64 *%%ptr%d' % (i, i)
     37 
     38 print ''
     39 print '  ret void'
     40 print '}'
     41