Home | History | Annotate | Download | only in cstmaterialization
      1 ; RUN: llc -march=mipsel -mcpu=mips32 < %s | FileCheck %s -check-prefix=CHECK-MIPS32
      2 ; RUN: llc -march=mips64el -mcpu=mips64 < %s | \
      3 ; RUN:      FileCheck %s -check-prefix=CHECK-MIPS64
      4 ; RUN: llc -march=mipsel -mcpu=mips64 -target-abi n32 < %s | \
      5 ; RUN:      FileCheck %s -check-prefix=CHECK-MIPSN32
      6 
      7 ; Test that the expansion of ADJCALLSTACKDOWN and ADJCALLSTACKUP generate
      8 ; (d)subu and (d)addu rather than just (d)addu. The (d)subu sequences are
      9 ; generally shorter as the constant that has to be materialized is smaller.
     10 
     11 define i32 @main() {
     12 entry:
     13   %z = alloca [1048576 x i8], align 1
     14   %arraydecay = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %z, i32 0, i32 0
     15   %call = call i32 @foo(i8* %arraydecay)
     16   ret i32 0
     17 ; CHECK-LABEL: main
     18 
     19 ; CHECK-MIPS32: lui   $[[R0:[0-9]+]], 16
     20 ; CHECK-MIPS32: addiu $[[R0]], $[[R0]], 24
     21 ; CHECK-MIPS32: subu  $sp, $sp, $[[R0]]
     22 
     23 ; CHECK-MIPS32: lui   $[[R1:[0-9]+]], 16
     24 ; CHECK-MIPS32: addiu $[[R1]], $[[R1]], 24
     25 ; CHECK-MIPS32: addu  $sp, $sp, $[[R1]]
     26 
     27 ; CHECK-MIPS64: lui     $[[R0:[0-9]+]], 1
     28 ; CHECK-MIPS64: daddiu  $[[R0]], $[[R0]], 32
     29 ; CHECK-MIPS64: dsubu   $sp, $sp, $[[R0]]
     30 
     31 ; FIXME:
     32 ; These are here to match other lui's used in address computations. We need to
     33 ; investigate why address computations are not CSE'd. Or implement it.
     34 
     35 ; CHECK-MIPS64: lui
     36 ; CHECK-MIPS64: lui
     37 ; CHECK-MIPS64: lui
     38 ; CHECK-MIPS64: lui
     39 
     40 ; CHECK-MIPS64: lui     $[[R1:[0-9]+]], 16
     41 ; CHECK-MIPS64: daddiu  $[[R1]], $[[R1]], 32
     42 ; CHECK-MIPS64: daddu   $sp, $sp, $[[R1]]
     43 
     44 ; CHECK-MIPSN32: lui   $[[R0:[0-9]+]], 16
     45 ; CHECK-MIPSN32: addiu $[[R0]], $[[R0]], 16
     46 ; CHECK-MIPSN32: subu  $sp, $sp, $[[R0]]
     47 
     48 ; CHECK-MIPSN32: lui   $[[R1:[0-9]+]], 16
     49 ; CHECK-MIPSN32: addiu $[[R1]], $[[R1]], 16
     50 ; CHECK-MIPSN32: addu  $sp, $sp, $[[R1]]
     51 
     52 }
     53 
     54 declare i32 @foo(i8*)
     55