17bdf183aSSimon Dardis; RUN: llc -march=mipsel -mcpu=mips32 < %s | FileCheck %s -check-prefix=CHECK-MIPS32 2*ca74dd79SSimon Dardis; RUN: llc -march=mips64el -mcpu=mips64 -relocation-model=pic < %s | \ 37bdf183aSSimon Dardis; RUN: FileCheck %s -check-prefix=CHECK-MIPS64 47bdf183aSSimon Dardis; RUN: llc -march=mipsel -mcpu=mips64 -target-abi n32 < %s | \ 57bdf183aSSimon Dardis; RUN: FileCheck %s -check-prefix=CHECK-MIPSN32 67bdf183aSSimon Dardis 77bdf183aSSimon Dardis; Test that the expansion of ADJCALLSTACKDOWN and ADJCALLSTACKUP generate 87bdf183aSSimon Dardis; (d)subu and (d)addu rather than just (d)addu. The (d)subu sequences are 97bdf183aSSimon Dardis; generally shorter as the constant that has to be materialized is smaller. 107bdf183aSSimon Dardis 117bdf183aSSimon Dardisdefine i32 @main() { 127bdf183aSSimon Dardisentry: 137bdf183aSSimon Dardis %z = alloca [1048576 x i8], align 1 147bdf183aSSimon Dardis %arraydecay = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %z, i32 0, i32 0 157bdf183aSSimon Dardis %call = call i32 @foo(i8* %arraydecay) 167bdf183aSSimon Dardis ret i32 0 177bdf183aSSimon Dardis; CHECK-LABEL: main 187bdf183aSSimon Dardis 197bdf183aSSimon Dardis; CHECK-MIPS32: lui $[[R0:[0-9]+]], 16 207bdf183aSSimon Dardis; CHECK-MIPS32: addiu $[[R0]], $[[R0]], 24 217bdf183aSSimon Dardis; CHECK-MIPS32: subu $sp, $sp, $[[R0]] 227bdf183aSSimon Dardis 237bdf183aSSimon Dardis; CHECK-MIPS32: lui $[[R1:[0-9]+]], 16 247bdf183aSSimon Dardis; CHECK-MIPS32: addiu $[[R1]], $[[R1]], 24 257bdf183aSSimon Dardis; CHECK-MIPS32: addu $sp, $sp, $[[R1]] 267bdf183aSSimon Dardis 277bdf183aSSimon Dardis; CHECK-MIPS64: lui $[[R0:[0-9]+]], 1 287bdf183aSSimon Dardis; CHECK-MIPS64: daddiu $[[R0]], $[[R0]], 32 297bdf183aSSimon Dardis; CHECK-MIPS64: dsubu $sp, $sp, $[[R0]] 307bdf183aSSimon Dardis 317bdf183aSSimon Dardis; FIXME: 327bdf183aSSimon Dardis; These are here to match other lui's used in address computations. We need to 337bdf183aSSimon Dardis; investigate why address computations are not CSE'd. Or implement it. 347bdf183aSSimon Dardis 357bdf183aSSimon Dardis; CHECK-MIPS64: lui 367bdf183aSSimon Dardis; CHECK-MIPS64: lui 377bdf183aSSimon Dardis; CHECK-MIPS64: lui 387bdf183aSSimon Dardis; CHECK-MIPS64: lui 397bdf183aSSimon Dardis 407bdf183aSSimon Dardis; CHECK-MIPS64: lui $[[R1:[0-9]+]], 16 417bdf183aSSimon Dardis; CHECK-MIPS64: daddiu $[[R1]], $[[R1]], 32 427bdf183aSSimon Dardis; CHECK-MIPS64: daddu $sp, $sp, $[[R1]] 437bdf183aSSimon Dardis 447bdf183aSSimon Dardis; CHECK-MIPSN32: lui $[[R0:[0-9]+]], 16 457bdf183aSSimon Dardis; CHECK-MIPSN32: addiu $[[R0]], $[[R0]], 16 467bdf183aSSimon Dardis; CHECK-MIPSN32: subu $sp, $sp, $[[R0]] 477bdf183aSSimon Dardis 487bdf183aSSimon Dardis; CHECK-MIPSN32: lui $[[R1:[0-9]+]], 16 497bdf183aSSimon Dardis; CHECK-MIPSN32: addiu $[[R1]], $[[R1]], 16 507bdf183aSSimon Dardis; CHECK-MIPSN32: addu $sp, $sp, $[[R1]] 517bdf183aSSimon Dardis 527bdf183aSSimon Dardis} 537bdf183aSSimon Dardis 547bdf183aSSimon Dardisdeclare i32 @foo(i8*) 55