Commit 7ad028ea by Stefan Maksimovic Committed by Jim Stichnoth

This patch enables running a couple more of lit tests for MIPS32

R=stichnot@chromium.org Review URL: https://codereview.chromium.org/2448193008 . Patch from Stefan Maksimovic <makdstefan@gmail.com>.
parent 73ae4fdc
......@@ -120,6 +120,27 @@ entry:
; ARM32: bl {{.*}} ignore64BitArgNoInline
; MIPS32-LABEL: pass64BitArg
; MIPS32-O2: sw a3,{{.*}}(sp)
; MIPS32-O2: sw a2,{{.*}}(sp)
; MIPS32-O2: li a2,123
; MIPS32-O2: jal {{.*}} ignore64BitArgNoInline
; MIPS32-O2: nop
; MIPS32-O2: move s0,v0
; MIPS32-O2: sw s3,{{.*}}(sp)
; MIPS32-O2: sw s2,{{.*}}(sp)
; MIPS32-O2: lw a0,{{.*}}(sp)
; MIPS32-O2: move a1,s1
; MIPS32-O2: li a2,123
; MIPS32-O2: jal {{.*}} ignore64BitArgNoInline
; MIPS32-O2: nop
; MIPS32-O2: move s1,v0
; MIPS32-O2: sw s7,{{.*}}(sp)
; MIPS32-O2: sw s6,{{.*}}(sp)
; MIPS32-O2: move a0,s4
; MIPS32-O2: move a1,s5
; MIPS32-O2: li a2,123
; MIPS32-O2: jal {{.*}} ignore64BitArgNoInline
; MIPS32-O2: nop
declare i32 @ignore64BitArgNoInline(i64, i32, i64)
......@@ -164,6 +185,18 @@ entry:
; ARM32: mov r2, #123
; ARM32: bl {{.*}} ignore64BitArgNoInline
; MIPS32-LABEL: pass64BitConstArg
; MIPS32-O2: lui [[REG:.*]],0xdead
; MIPS32-O2: ori [[REG1:.*]],[[REG]],0xbeef
; MIPS32-O2: lui [[REG:.*]],0x1234
; MIPS32-O2: ori [[REG2:.*]],[[REG]],0x5678
; MIPS32-O2: sw [[REG1]],{{.*}}(sp)
; MIPS32-O2: sw [[REG2]],{{.*}}(sp)
; MIPS32-O2: move a0,a2
; MIPS32-O2: move a1,a3
; MIPS32-O2: li a2,123
; MIPS32-O2: jal {{.*}} ignore64BitArgNoInline
define internal i32 @pass64BitUndefArg() {
entry:
%call = call i32 @ignore64BitArgNoInline(i64 0, i32 123, i64 undef)
......@@ -566,6 +599,11 @@ entry:
; ARM32-LABEL: shl64BitSignedTrunc
; ARM32: lsl r
; MIPS32-LABEL: shl64BitSignedTrunc
; MIPS32-O2: sllv
; MIPS32-O2: andi {{.*}},0x20
; MIPS32-O2: movn
define internal i64 @shl64BitUnsigned(i64 %a, i64 %b) {
entry:
%shl = shl i64 %a, %b
......@@ -675,6 +713,16 @@ entry:
; ARM32: cmp
; ARM32: asrge
; MIPS32-LABEL: shr64BitSignedTrunc
; MIPS32-O2: srlv
; MIPS32-O2: nor
; MIPS32-O2: sll
; MIPS32-O2: sllv
; MIPS32-O2: or
; MIPS32-O2: srav
; MIPS32-O2: andi {{.*}},0x20
; MIPS32-O2: movn
define internal i64 @shr64BitUnsigned(i64 %a, i64 %b) {
entry:
%shr = lshr i64 %a, %b
......@@ -739,6 +787,16 @@ entry:
; ARM32: cmp
; ARM32: lsrge
; MIPS32-LABEL: shr64BitUnsignedTrunc
; MIPS32-O2: srlv
; MIPS32-O2: nor
; MIPS32-O2: sll
; MIPS32-O2: sllv
; MIPS32-O2: or
; MIPS32-O2: srlv
; MIPS32-O2: andi
; MIPS32-O2: movn
define internal i64 @and64BitSigned(i64 %a, i64 %b) {
entry:
%and = and i64 %b, %a
......@@ -2173,6 +2231,10 @@ entry:
; ARM32: ldr r{{.*}}, [r[[REG:.*]]]
; ARM32: ldr r{{.*}}, [r[[REG]], #4]
; MIPS32-LABEL: load64
; MIPS32-O2: lw {{.*}},0([[REG:.*]])
; MIPS32-O2: lw [[REG]],4([[REG]])
define internal void @store64(i32 %a, i64 %value) {
entry:
%__2 = inttoptr i32 %a to i64*
......@@ -2192,6 +2254,10 @@ entry:
; ARM32: str r{{.*}}, [r[[REG:.*]], #4]
; ARM32: str r{{.*}}, [r[[REG]]]
; MIPS32-LABEL: store64
; MIPS32-O2: sw {{.*}},4([[REG:.*]])
; MIPS32-O2: sw {{.*}},0([[REG]])
define internal void @store64Const(i32 %a) {
entry:
%__1 = inttoptr i32 %a to i64*
......@@ -2215,6 +2281,14 @@ entry:
; ARM32: str [[REG1]], [r[[REG:.*]], #4]
; ARM32: str [[REG2]], [r[[REG]]]
; MIPS32-LABEL: store64Const
; MIPS32-O2: lui [[REG1:.*]],0xdead
; MIPS32-O2: ori [[REG1:.*]],[[REG1]],0xbeef
; MIPS32-O2: lui [[REG2:.*]],0x1234
; MIPS32-O2: ori [[REG2:.*]],[[REG2]],0x5678
; MIPS32-O2: sw [[REG1]],4([[REG:.*]])
; MIPS32-O2: sw [[REG2]],0([[REG]])
define internal i64 @select64VarVar(i64 %a, i64 %b) {
entry:
%cmp = icmp ult i64 %a, %b
......
......@@ -14,6 +14,12 @@
; RUN: -reg-exclude=al,bl,cl,dl -reg-reserve \
; RUN: -allow-externally-defined-symbols | FileCheck %s --check-prefix=REM
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
declare void @useInt(i32 %x)
define internal i32 @add8Bit(i32 %a, i32 %b) {
......@@ -26,6 +32,12 @@ entry:
}
; CHECK-LABEL: add8Bit
; CHECK: add {{[abcd]l}}
; MIPS32-LABEL: add8Bit
; MIPS32: addu
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @add8BitConst(i32 %a) {
entry:
......@@ -36,6 +48,13 @@ entry:
}
; CHECK-LABEL: add8BitConst
; CHECK: add {{[abcd]l}}
; MIPS32-LABEL: add8BitConst
; MIPS32: li
; MIPS32: addu
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @sub8Bit(i32 %a, i32 %b) {
entry:
......@@ -47,6 +66,12 @@ entry:
}
; CHECK-LABEL: sub8Bit
; CHECK: sub {{[abcd]l}}
; MIPS32-LABEL: sub8Bit
; MIPS32: subu
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @sub8BitConst(i32 %a) {
entry:
......@@ -57,6 +82,13 @@ entry:
}
; CHECK-LABEL: sub8BitConst
; CHECK: sub {{[abcd]l}}
; MIPS32-LABEL: sub8BitConst
; MIPS32: li
; MIPS32: subu
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @mul8Bit(i32 %a, i32 %b) {
entry:
......@@ -68,6 +100,12 @@ entry:
}
; CHECK-LABEL: mul8Bit
; CHECK: mul {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: mul8Bit
; MIPS32: mul
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @mul8BitConst(i32 %a) {
entry:
......@@ -80,6 +118,13 @@ entry:
; 8-bit imul only accepts r/m, not imm
; CHECK: mov {{.*}},0x38
; CHECK: mul {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: mul8BitConst
; MIPS32: li
; MIPS32: mul
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @udiv8Bit(i32 %a, i32 %b) {
entry:
......@@ -91,6 +136,13 @@ entry:
}
; CHECK-LABEL: udiv8Bit
; CHECK: div {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: udiv8Bit
; MIPS32: divu
; MIPS32: teq
; MIPS32: mflo
; MIPS32: andi {{.*}},0xff
; MIPS32: jr
; MIPS32: nop
define internal i32 @udiv8BitConst(i32 %a) {
entry:
......@@ -101,6 +153,14 @@ entry:
}
; CHECK-LABEL: udiv8BitConst
; CHECK: div {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: udiv8BitConst
; MIPS32: li
; MIPS32: divu
; MIPS32: teq
; MIPS32: mflo
; MIPS32: andi {{.*}},0xff
; MIPS32: jr
; MIPS32: nop
define internal i32 @urem8Bit(i32 %a, i32 %b) {
entry:
......@@ -115,6 +175,13 @@ entry:
; REM-LABEL: urem8Bit
; REM: div
; REM-NEXT: mov {{[abcd]}}l,ah
; MIPS32-LABEL: urem8Bit
; MIPS32: divu
; MIPS32: teq
; MIPS32: mfhi
; MIPS32: andi {{.*}},0xff
; MIPS32: jr
; MIPS32: nop
define internal i32 @urem8BitConst(i32 %a) {
entry:
......@@ -126,6 +193,14 @@ entry:
; CHECK-LABEL: urem8BitConst
; CHECK: div {{[abcd]l|BYTE PTR}}
; REM-LABEL: urem8BitConst
; MIPS32-LABEL: urem8BitConst
; MIPS32: li
; MIPS32: divu
; MIPS32: teq
; MIPS32: mfhi
; MIPS32: andi {{.*}},0xff
; MIPS32: jr
; MIPS32: nop
define internal i32 @sdiv8Bit(i32 %a, i32 %b) {
......@@ -138,6 +213,13 @@ entry:
}
; CHECK-LABEL: sdiv8Bit
; CHECK: idiv {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: sdiv8Bit
; MIPS32: div
; MIPS32: teq
; MIPS32: mflo
; MIPS32: andi {{.*}},0xff
; MIPS32: jr
; MIPS32: nop
define internal i32 @sdiv8BitConst(i32 %a) {
entry:
......@@ -148,6 +230,14 @@ entry:
}
; CHECK-LABEL: sdiv8BitConst
; CHECK: idiv {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: sdiv8BitConst
; MIPS32: li
; MIPS32: div
; MIPS32: teq
; MIPS32: mflo
; MIPS32: andi {{.*}},0xff
; MIPS32: jr
; MIPS32: nop
define internal i32 @srem8Bit(i32 %a, i32 %b) {
entry:
......@@ -162,6 +252,13 @@ entry:
; REM-LABEL: srem8Bit
; REM: idiv
; REM-NEXT: mov {{[abcd]}}l,ah
; MIPS32-LABEL: srem8Bit
; MIPS32: div
; MIPS32: teq
; MIPS32: mfhi
; MIPS32: andi {{.*}},0xff
; MIPS32: jr
; MIPS32: nop
define internal i32 @srem8BitConst(i32 %a) {
entry:
......@@ -173,6 +270,14 @@ entry:
; CHECK-LABEL: srem8BitConst
; CHECK: idiv {{[abcd]l|BYTE PTR}}
; REM-LABEL: srem8BitConst
; MIPS32-LABEL: srem8BitConst
; MIPS32: li
; MIPS32: div
; MIPS32: teq
; MIPS32: mfhi
; MIPS32: andi {{.*}},0xff
; MIPS32: jr
; MIPS32: nop
define internal i32 @shl8Bit(i32 %a, i32 %b) {
entry:
......@@ -184,6 +289,12 @@ entry:
}
; CHECK-LABEL: shl8Bit
; CHECK: shl {{[abd]l|BYTE PTR}},cl
; MIPS32-LABEL: shl8Bit
; MIPS32: sllv
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @shl8BitConst(i32 %a, i32 %b) {
entry:
......@@ -194,6 +305,13 @@ entry:
}
; CHECK-LABEL: shl8BitConst
; CHECK: shl {{[abcd]l|BYTE PTR}},0x6
; MIPS32-LABEL: shl8BitConst
; MIPS32: li
; MIPS32: sllv
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @lshr8Bit(i32 %a, i32 %b) {
entry:
......@@ -205,6 +323,12 @@ entry:
}
; CHECK-LABEL: lshr8Bit
; CHECK: shr {{[abd]l|BYTE PTR}},cl
; MIPS32-LABEL: lshr8Bit
; MIPS32: srlv
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @lshr8BitConst(i32 %a, i32 %b) {
entry:
......@@ -215,6 +339,13 @@ entry:
}
; CHECK-LABEL: lshr8BitConst
; CHECK: shr {{[abcd]l|BYTE PTR}},0x6
; MIPS32-LABEL: lshr8BitConst
; MIPS32: li
; MIPS32: srlv
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @ashr8Bit(i32 %a, i32 %b) {
entry:
......@@ -226,6 +357,12 @@ entry:
}
; CHECK-LABEL: ashr8Bit
; CHECK: sar {{[abd]l|BYTE PTR}},cl
; MIPS32-LABEL: ashr8Bit
; MIPS32: sra
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @ashr8BitConst(i32 %a, i32 %b) {
entry:
......@@ -236,6 +373,13 @@ entry:
}
; CHECK-LABEL: ashr8BitConst
; CHECK: sar {{[abcd]l|BYTE PTR}},0x6
; MIPS32-LABEL: ashr8BitConst
; MIPS32: li
; MIPS32: srav
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @icmp8Bit(i32 %a, i32 %b) {
entry:
......@@ -247,6 +391,15 @@ entry:
}
; CHECK-LABEL: icmp8Bit
; CHECK: cmp {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: icmp8Bit
; MIPS32: sll {{.*}},0x18
; MIPS32: sll {{.*}},0x18
; MIPS32: xor
; MIPS32: sltu
; MIPS32: andi {{.*}},0x1
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @icmp8BitConst(i32 %a) {
entry:
......@@ -257,6 +410,16 @@ entry:
}
; CHECK-LABEL: icmp8BitConst
; CHECK: cmp {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: icmp8BitConst
; MIPS32: li
; MIPS32: sll {{.*}},0x18
; MIPS32: sll {{.*}},0x18
; MIPS32: xor
; MIPS32: sltu
; MIPS32: andi {{.*}},0x1
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @icmp8BitConstSwapped(i32 %a) {
entry:
......@@ -267,6 +430,15 @@ entry:
}
; CHECK-LABEL: icmp8BitConstSwapped
; CHECK: cmp {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: icmp8BitConstSwapped
; MIPS32: li
; MIPS32: sll {{.*}},0x18
; MIPS32: sll {{.*}},0x18
; MIPS32: xor v0,v0,a0
; MIPS32: sltu
; MIPS32: andi {{.*}},0x1
; MIPS32: jr
; MIPS32: nop
define internal i32 @icmp8BitMem(i32 %a, i32 %b_iptr) {
entry:
......@@ -279,6 +451,16 @@ entry:
}
; CHECK-LABEL: icmp8BitMem
; CHECK: cmp {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: icmp8BitMem
; MIPS32: lb
; MIPS32: sll {{.*}},0x18
; MIPS32: sll {{.*}},0x18
; MIPS32: xor
; MIPS32: sltu
; MIPS32: andi {{.*}},0x1
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @icmp8BitMemSwapped(i32 %a, i32 %b_iptr) {
entry:
......@@ -291,6 +473,16 @@ entry:
}
; CHECK-LABEL: icmp8BitMemSwapped
; CHECK: cmp {{[abcd]l|BYTE PTR}}
; MIPS32-LABEL: icmp8BitMemSwapped
; MIPS32: lb
; MIPS32: sll {{.*}},0x18
; MIPS32: sll {{.*}},0x18
; MIPS32: xor
; MIPS32: sltu
; MIPS32: andi {{.*}},0x1
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define internal i32 @selectI8Var(i32 %a, i32 %b) {
entry:
......@@ -308,6 +500,29 @@ entry:
; CHECK: cmp
; CHECK: setl
; CHECK: mov {{[a-d]l}}
; MIPS32-LABEL: selectI8Var
; MIPS32: addiu
; MIPS32: sw
; MIPS32: sw
; MIPS32: move
; MIPS32: move
; MIPS32: sll {{.*}},0x18
; MIPS32: sll {{.*}},0x18
; MIPS32: slt
; MIPS32: move
; MIPS32: movn
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: andi {{.*}},0x1
; MIPS32: move
; MIPS32: jal
; MIPS32: nop
; MIPS32: move
; MIPS32: lw
; MIPS32: lw
; MIPS32: addiu
; MIPS32: jr
; MIPS32: nop
define internal i32 @testPhi8(i32 %arg, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %arg7, i32 %arg8, i32 %arg9, i32 %arg10) {
entry:
......@@ -360,6 +575,14 @@ entry:
}
; CHECK-LABEL: load_i8
; CHECK: mov {{[a-d]l}},BYTE PTR
; MIPS32-LABEL: load_i8
; MIPS32: lb
; MIPS32: li
; MIPS32: subu
; MIPS32: andi {{.*}},0xff
; MIPS32: move
; MIPS32: jr
; MIPS32: nop
define i32 @load_i8_global(i32 %addr_arg) {
entry:
......@@ -371,6 +594,15 @@ entry:
}
; CHECK-LABEL: load_i8_global
; CHECK: mov {{[a-d]l}},{{(BYTE PTR)?}}
; MIPS32-LABEL: load_i8_global
; MIPS32: lui
; MIPS32: addiu
; MIPS32: lb
; MIPS32: li
; MIPS32: subu
; MIPS32: andi {{.*}},0xff
; MIPS32: jr
; MIPS32: nop
define void @store_i8(i32 %addr_arg, i32 %val) {
entry:
......@@ -381,6 +613,10 @@ entry:
}
; CHECK-LABEL: store_i8
; CHECK: mov BYTE PTR {{.*}},{{[a-d]l}}
; MIPS32-LABEL: store_i8
; MIPS32: sb
; MIPS32: jr
; MIPS32: nop
define void @store_i8_const(i32 %addr_arg) {
entry:
......@@ -390,3 +626,8 @@ entry:
}
; CHECK-LABEL: store_i8_const
; CHECK: mov BYTE PTR {{.*}},0x7b
; MIPS32-LABEL: store_i8_const
; MIPS32: li
; MIPS32: sb
; MIPS32: jr
; MIPS32: nop
......@@ -6,6 +6,12 @@
; RUN: %p2i -i %s --target=x8664 --filetype=obj --disassemble --args -O2 \
; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X8664
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
; Dense but non-continuous ranges should be converted into a jump table.
define internal i32 @testJumpTable(i32 %a) {
entry:
......@@ -43,6 +49,32 @@ sw.epilog:
; "mov eax, [...]; jmp rax", so we assume the all characters except the first
; one in the register name will match.
; MIPS32-LABEL: testJumpTable
; MIPS32: move [[REG1:.*]],{{.*}}
; MIPS32: li [[REG2:.*]],91
; MIPS32: beq [[REG1]],[[REG2]],6c <.LtestJumpTable$sw.default>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],92
; MIPS32: beq [[REG1]],[[REG2]],7c <.LtestJumpTable$sw.bb1>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],93
; MIPS32: beq [[REG1]],[[REG2]],6c <.LtestJumpTable$sw.default>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],99
; MIPS32: beq [[REG1]],[[REG2]],7c <.LtestJumpTable$sw.bb1>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],98
; MIPS32: beq [[REG1]],[[REG2]],6c <.LtestJumpTable$sw.default>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],96
; MIPS32: beq [[REG1]],[[REG2]],7c <.LtestJumpTable$sw.bb1>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],97
; MIPS32: beq [[REG1]],[[REG2]],60 <.LtestJumpTable$split_entry_sw.epilog_0>
; MIPS32: nop
; MIPS32: b 6c <.LtestJumpTable$sw.default>
; MIPS32: nop
; Continuous ranges which map to the same target should be grouped and
; efficiently tested.
define internal i32 @testRangeTest() {
......@@ -76,6 +108,35 @@ sw.epilog:
; CHECK-NEXT: jbe
; CHECK-NEXT: jmp
; MIPS32-LABEL: testRangeTest
; MIPS32: li [[REG1:.*]],10
; MIPS32: li [[REG2:.*]],0
; MIPS32: beq [[REG1]],[[REG2]],114 <.LtestRangeTest$split_entry_sw.epilog_0>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],1
; MIPS32: beq [[REG1]],[[REG2]],114 <.LtestRangeTest$split_entry_sw.epilog_0>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],2
; MIPS32: beq [[REG1]],[[REG2]],114 <.LtestRangeTest$split_entry_sw.epilog_0>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],3
; MIPS32: beq [[REG1]],[[REG2]],114 <.LtestRangeTest$split_entry_sw.epilog_0>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],10
; MIPS32: beq [[REG1]],[[REG2]],fc <.LtestRangeTest$split_sw.bb1_sw.epilog_2>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],11
; MIPS32: beq [[REG1]],[[REG2]],fc <.LtestRangeTest$split_sw.bb1_sw.epilog_2>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],12
; MIPS32: beq [[REG1]],[[REG2]],fc <.LtestRangeTest$split_sw.bb1_sw.epilog_2>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],13
; MIPS32: beq [[REG1]],[[REG2]],fc <.LtestRangeTest$split_sw.bb1_sw.epilog_2>
; MIPS32: nop
; MIPS32: b 108 <.LtestRangeTest$split_sw.default_sw.epilog_1>
; MIPS32: nop
; Sparse cases should be searched with a binary search.
define internal i32 @testBinarySearch() {
entry:
......@@ -109,6 +170,23 @@ sw.epilog:
; CHECK-NEXT: je
; CHECK-NEXT: jmp
; MIPS32-LABEL: testBinarySearch
; MIPS32: li [[REG1:.*]],10
; MIPS32: li [[REG2:.*]],0
; MIPS32: beq [[REG1]],[[REG2]],174 <.LtestBinarySearch$split_entry_sw.epilog_0>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],10
; MIPS32: beq [[REG1]],[[REG2]],174 <.LtestBinarySearch$split_entry_sw.epilog_0>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],20
; MIPS32: beq [[REG1]],[[REG2]],15c <.LtestBinarySearch$split_sw.bb1_sw.epilog_2>
; MIPS32: nop
; MIPS32: li [[REG2:.*]],30
; MIPS32: beq [[REG1]],[[REG2]],15c <.LtestBinarySearch$split_sw.bb1_sw.epilog_2>
; MIPS32: nop
; MIPS32: b 168 <.LtestBinarySearch$split_sw.default_sw.epilog_1>
; MIPS32: nop
; 64-bit switches where the cases are all 32-bit values should be reduced to a
; 32-bit switch after checking the top byte is 0.
define internal i32 @testSwitchSmall64(i64 %a) {
......@@ -150,6 +228,14 @@ return:
; X8632-NEXT: cmp {{.*}},0xea
; X8632-NEXT: je
; MIPS32-LABEL: testSwitchSmall64
; MIPS32: li [[REG:.*]],0
; MIPS32: bne {{.*}},[[REG]],198 <.LtestSwitchSmall64$local$__0>
; MIPS32: nop
; MIPS32: li [[REG:.*]],123
; MIPS32: beq {{.*}},[[REG]],210 <.LtestSwitchSmall64$split_entry_return_0>
; MIPS32: nop
; Test for correct 64-bit lowering.
; TODO(ascull): this should generate better code like the 32-bit version
define internal i32 @testSwitch64(i64 %a) {
......@@ -195,6 +281,14 @@ return:
; X8632-NEXT: cmp {{.*}},0x12
; X8632-NEXT: je
; MIPS32-LABEL: testSwitch64
; MIPS32: li [[REG:.*]],0
; MIPS32: bne {{.*}},[[REG]],238 <.LtestSwitch64$local$__0>
; MIPS32: nop
; MIPS32: li [[REG:.*]],123
; MIPS32: beq {{.*}},[[REG]],2b4 <.LtestSwitch64$split_entry_return_0>
; MIPS32: nop
; Test for correct 64-bit jump table with UINT64_MAX as one of the values.
define internal i32 @testJumpTable64(i64 %a) {
entry:
......
......@@ -35,6 +35,12 @@
; RUN: | %if --need=target_ARM32_dump \
; RUN: --command FileCheck --check-prefix ARM32 %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
@__init_array_start = internal constant [0 x i8] zeroinitializer, align 4
@__fini_array_start = internal constant [0 x i8] zeroinitializer, align 4
@__tls_template_start = internal constant [0 x i8] zeroinitializer, align 8
......@@ -98,6 +104,11 @@ entry:
; ARM32: blx [[REGISTER]]
; ARM32: blx [[REGISTER]]
; MIPS32-LABEL: CallIndirect
; MIPS32: jalr [[REGISTER:.*]]
; MIPS32: jalr [[REGISTER]]
; MIPS32: jalr [[REGISTER]]
; MIPS32: jalr [[REGISTER]]
@fp_v = internal global [4 x i8] zeroinitializer, align 4
......@@ -150,6 +161,12 @@ entry:
; ARM32: blx [[REGISTER]]
; ARM32: blx [[REGISTER]]
; MIPS32-LABEL: CallIndirectGlobal
; MIPS32: jalr [[REGISTER:.*]]
; MIPS32: jalr [[REGISTER]]
; MIPS32: jalr [[REGISTER]]
; MIPS32: jalr [[REGISTER]]
; Calling an absolute address is used for non-IRT PNaCl pexes to directly
; access syscall trampolines. This is not really an indirect call, but
; there is a cast from int to pointer first.
......
......@@ -6,6 +6,12 @@
; RUN: --target x8632 -i %s --args -O2 \
; RUN: | %if --need=target_X8632 --command FileCheck %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
define internal i32 @integerAddLeft(i32 %a, i32 %b) {
entry:
%tmp = add i32 %a, %b
......@@ -17,6 +23,10 @@ entry:
; CHECK-NEXT: mov {{e..}},DWORD PTR
; CHECK-NEXT: add {{e..}},{{e..}}
; CHECK-NEXT: add {{e..}},{{e..}}
; MIPS32-LABEL: integerAddLeft
; MIPS32: move v0,a0
; MIPS32: addu v0,v0,a1
; MIPS32: addu a0,a0,v0
define internal i32 @integerAddRight(i32 %a, i32 %b) {
entry:
......@@ -29,6 +39,10 @@ entry:
; CHECK-NEXT: mov {{e..}},DWORD PTR
; CHECK-NEXT: add {{e..}},{{e..}}
; CHECK-NEXT: add {{e..}},{{e..}}
; MIPS32-LABEL: integerAddRight
; MIPS32: move v0,a1
; MIPS32: addu a0,a0,v0
; MIPS32: addu a1,a1,a0
define internal i32 @integerMultiplyLeft(i32 %a, i32 %b) {
entry:
......@@ -41,6 +55,10 @@ entry:
; CHECK-NEXT: mov {{e..}},DWORD PTR
; CHECK-NEXT: imul {{e..}},{{e..}}
; CHECK-NEXT: imul {{e..}},{{e..}}
; MIPS32-LABEL: integerMultiplyLeft
; MIPS32: move v0,a0
; MIPS32: mul v0,v0,a1
; MIPS32: mul a0,a0,v0
define internal i32 @integerMultiplyRight(i32 %a, i32 %b) {
entry:
......@@ -53,6 +71,10 @@ entry:
; CHECK-NEXT: mov {{e..}},DWORD PTR
; CHECK-NEXT: imul {{e..}},{{e..}}
; CHECK-NEXT: imul {{e..}},{{e..}}
; MIPS32-LABEL: integerMultiplyRight
; MIPS32: move v0,a1
; MIPS32: mul a0,a0,v0
; MIPS32: mul a1,a1,a0
define internal float @floatAddLeft(float %a, float %b) {
entry:
......@@ -66,6 +88,10 @@ entry:
; CHECK-NEXT: movss xmm1,DWORD PTR
; CHECK-NEXT: addss xmm1,xmm0
; CHECK-NEXT: addss xmm0,xmm1
; MIPS32-LABEL: floatAddLeft
; MIPS32: mov.s $f0,$f12
; MIPS32: add.s $f0,$f0,$f14
; MIPS32: add.s $f12,$f12,$f0
define internal float @floatAddRight(float %a, float %b) {
entry:
......@@ -79,6 +105,10 @@ entry:
; CHECK-NEXT: movss xmm1,DWORD PTR
; CHECK-NEXT: addss xmm0,xmm1
; CHECK-NEXT: addss xmm1,xmm0
; MIPS32-LABEL: floatAddRight
; MIPS32: mov.s $f0,$f14
; MIPS32: add.s $f12,$f12,$f0
; MIPS32: add.s $f14,$f14,$f12
define internal float @floatMultiplyLeft(float %a, float %b) {
entry:
......@@ -92,6 +122,10 @@ entry:
; CHECK-NEXT: movss xmm1,DWORD PTR
; CHECK-NEXT: mulss xmm1,xmm0
; CHECK-NEXT: mulss xmm0,xmm1
; MIPS32-LABEL: floatMultiplyLeft
; MIPS32: mov.s $f0,$f12
; MIPS32: mul.s $f0,$f0,$f14
; MIPS32: mul.s $f12,$f12,$f0
define internal float @floatMultiplyRight(float %a, float %b) {
entry:
......@@ -105,3 +139,7 @@ entry:
; CHECK-NEXT: movss xmm1,DWORD PTR
; CHECK-NEXT: mulss xmm0,xmm1
; CHECK-NEXT: mulss xmm1,xmm0
; MIPS32-LABEL: floatMultiplyRight
; MIPS32: mov.s $f0,$f14
; MIPS32: mul.s $f12,$f12,$f0
; MIPS32: mul.s $f14,$f14,$f12
......@@ -20,6 +20,12 @@
; RUN: | %if --need=target_ARM32 \
; RUN: --command FileCheck --check-prefix ARM32 %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
@i8v = internal global [1 x i8] zeroinitializer, align 1
@i16v = internal global [2 x i8] zeroinitializer, align 2
@i32v = internal global [4 x i8] zeroinitializer, align 4
......@@ -70,6 +76,28 @@ entry:
; ARM32-DAG: str r{{.*}}, [r{{[0-9]+}}]
; ARM32-DAG: str r{{.*}}, [{{.*}}, #4]
; MIPS32-LABEL: from_int8
; MIPS32: lui {{.*}} i8v
; MIPS32: addiu {{.*}} i8v
; MIPS32: lb
; MIPS32: move
; MIPS32: sll {{.*}},0x18
; MIPS32: sra {{.*}},0x18
; MIPS32: lui {{.*}} i16v
; MIPS32: addiu {{.*}} i16v
; MIPS32: sh
; MIPS32: move
; MIPS32: sll {{.*}},0x18
; MIPS32: sra {{.*}},0x18
; MIPS32: lui {{.*}} i32v
; MIPS32: addiu {{.*}} i32v
; MIPS32: sw
; MIPS32: sll {{.*}},0x18
; MIPS32: sra {{.*}},0x18
; MIPS32: sra {{.*}},0x1f
; MIPS32: lui {{.*}} i64v
; MIPS32: addiu {{.*}} i64v
define internal void @from_int16() {
entry:
%__0 = bitcast [2 x i8]* @i16v to i16*
......@@ -107,6 +135,26 @@ entry:
; ARM32: movw {{.*}}i64v
; ARM32: str r
; MIPS32-LABEL: from_int16
; MIPS32: lui {{.*}} i16v
; MIPS32: addiu {{.*}} i16v
; MIPS32: lh
; MIPS32: move
; MIPS32: lui {{.*}} i8v
; MIPS32: addiu {{.*}} i8v
; MIPS32: sb
; MIPS32: move
; MIPS32: sll {{.*}},0x10
; MIPS32: sra {{.*}},0x10
; MIPS32: lui {{.*}} i32v
; MIPS32: addiu {{.*}} i32v
; MIPS32: sw
; MIPS32: sll {{.*}},0x10
; MIPS32: sra {{.*}},0x10
; MIPS32: sra {{.*}},0x1f
; MIPS32: lui {{.*}} i64v
; MIPS32: addiu {{.*}} i64v
define internal void @from_int32() {
entry:
%__0 = bitcast [4 x i8]* @i32v to i32*
......@@ -140,6 +188,22 @@ entry:
; ARM32: movw {{.*}}i64v
; ARM32: str r
; MIPS32-LABEL: from_int32
; MIPS32: lui {{.*}} i32v
; MIPS32: addiu {{.*}} i32v
; MIPS32: lw
; MIPS32: move
; MIPS32: lui {{.*}} i8v
; MIPS32: addiu {{.*}} i8v
; MIPS32: sb
; MIPS32: move
; MIPS32: lui {{.*}} i16v
; MIPS32: addiu {{.*}} i16v
; MIPS32: sh
; MIPS32: sra {{.*}},0x1f
; MIPS32: lui {{.*}} i64v
; MIPS32: addiu {{.*}} i64v
define internal void @from_int64() {
entry:
%__0 = bitcast [8 x i8]* @i64v to i64*
......@@ -171,6 +235,21 @@ entry:
; ARM32: movw {{.*}}i32v
; ARM32: str r
; MIPS32-LABEL: from_int64
; MIPS32: lui {{.*}} i64v
; MIPS32: addiu {{.*}} i64v
; MIPS32: lw
; MIPS32: move
; MIPS32: lui {{.*}} i8v
; MIPS32: addiu {{.*}} i8v
; MIPS32: sb
; MIPS32: move
; MIPS32: lui {{.*}} i16v
; MIPS32: addiu {{.*}} i16v
; MIPS32: sh
; MIPS32: lui {{.*}} i32v
; MIPS32: addiu {{.*}} i32v
define internal void @from_uint8() {
entry:
%__0 = bitcast [1 x i8]* @u8v to i8*
......@@ -210,6 +289,25 @@ entry:
; ARM32: movw {{.*}}i64v
; ARM32: str r
; MIPS32-LABEL: from_uint8
; MIPS32: lui {{.*}} u8v
; MIPS32: addiu {{.*}} u8v
; MIPS32: lb
; MIPS32: move
; MIPS32: andi {{.*}},0xff
; MIPS32: lui {{.*}} i16v
; MIPS32: addiu {{.*}} i16v
; MIPS32: sh
; MIPS32: move
; MIPS32: andi {{.*}},0xff
; MIPS32: lui {{.*}} i32v
; MIPS32: addiu {{.*}} i32v
; MIPS32: sw
; MIPS32: andi {{.*}},0xff
; MIPS32: li {{.*}},0
; MIPS32: lui {{.*}} i64v
; MIPS32: addiu {{.*}} i64v
define internal void @from_uint16() {
entry:
%__0 = bitcast [2 x i8]* @u16v to i16*
......@@ -247,6 +345,24 @@ entry:
; ARM32: movw {{.*}}i64v
; ARM32: str r
; MIPS32-LABEL: from_uint16
; MIPS32: lui {{.*}} u16v
; MIPS32: addiu {{.*}} u16v
; MIPS32: lh
; MIPS32: move
; MIPS32: lui {{.*}} i8v
; MIPS32: addiu {{.*}} i8v
; MIPS32: sb
; MIPS32: move
; MIPS32: andi {{.*}},0xffff
; MIPS32: lui {{.*}} i32v
; MIPS32: addiu {{.*}} i32v
; MIPS32: sw
; MIPS32: andi {{.*}},0xffff
; MIPS32: li {{.*}},0
; MIPS32: lui {{.*}} i64v
; MIPS32: addiu {{.*}} i64v
define internal void @from_uint32() {
entry:
%__0 = bitcast [4 x i8]* @u32v to i32*
......@@ -280,6 +396,22 @@ entry:
; ARM32: movw {{.*}}i64v
; ARM32: str r
; MIPS32-LABEL: from_uint32
; MIPS32: lui {{.*}} u32v
; MIPS32: addiu {{.*}} u32v
; MIPS32: lw
; MIPS32: move
; MIPS32: lui {{.*}} i8v
; MIPS32: addiu {{.*}} i8v
; MIPS32: sb
; MIPS32: move
; MIPS32: lui {{.*}} i16v
; MIPS32: addiu {{.*}} i16v
; MIPS32: sh
; MIPS32: li {{.*}},0
; MIPS32: lui {{.*}} i64v
; MIPS32: addiu {{.*}} i64v
define internal void @from_uint64() {
entry:
%__0 = bitcast [8 x i8]* @u64v to i64*
......@@ -310,3 +442,18 @@ entry:
; ARM32: strh
; ARM32: movw {{.*}}i32v
; ARM32: str r
; MIPS32-LABEL: from_uint64
; MIPS32: lui {{.*}} u64v
; MIPS32: addiu {{.*}} u64v
; MIPS32: lw
; MIPS32: move
; MIPS32: lui {{.*}} i8v
; MIPS32: addiu {{.*}} i8v
; MIPS32: sb
; MIPS32: move
; MIPS32: lui {{.*}} i16v
; MIPS32: addiu {{.*}} i16v
; MIPS32: sh
; MIPS32: lui {{.*}} i32v
; MIPS32: addiu {{.*}} i32v
......@@ -10,6 +10,12 @@
; RUN: --target x8632 -i %s --args -Om1 -allow-externally-defined-symbols \
; RUN: | %if --need=target_X8632 --command FileCheck %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
; Can't test on ARM yet. Need to use several vpush {contiguous FP regs},
; instead of push {any GPR list}.
......@@ -21,6 +27,9 @@ entry:
; CHECK: mov eax,DWORD PTR [esp+0xc]
; CHECK-NEXT: ret
; ARM32-LABEL: doubleArgs
; MIPS32-LABEL: doubleArgs
; MIPS32: move v0,a2
; MIPS32: jr ra
define internal i32 @floatArgs(float %a, i32 %b, float %c) {
entry:
......@@ -29,6 +38,9 @@ entry:
; CHECK-LABEL: floatArgs
; CHECK: mov eax,DWORD PTR [esp+0x8]
; CHECK-NEXT: ret
; MIPS32-LABEL: floatArgs
; MIPS32: move v0,a1
; MIPS32: jr ra
define internal i32 @passFpArgs(float %a, double %b, float %c, double %d, float %e, double %f) {
entry:
......@@ -46,6 +58,19 @@ entry:
; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline
; CHECK: mov DWORD PTR [esp+0x4],0x7b
; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline
; MIPS32-LABEL: passFpArgs
; MIPS32: mfc1 a2,$f15
; MIPS32: mfc1 a3,$f14
; MIPS32: li a1,123
; MIPS32: jal {{.*}} ignoreFpArgsNoInline
; MIPS32: mfc1 a2,$f23
; MIPS32: mfc1 a3,$f22
; MIPS32: li a1,123
; MIPS32: jal {{.*}} ignoreFpArgsNoInline
; MIPS32: mfc1 a2,$f25
; MIPS32: mfc1 a3,$f24
; MIPS32: li a1,123
; MIPS32: jal {{.*}} ignoreFpArgsNoInline
declare i32 @ignoreFpArgsNoInline(float %x, i32 %y, double %z)
......@@ -57,6 +82,11 @@ entry:
; CHECK-LABEL: passFpConstArg
; CHECK: mov DWORD PTR [esp+0x4],0x7b
; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline
; MIPS32-LABEL: passFpConstArg
; MIPS32: mfc1 a2,$f1
; MIPS32: mfc1 a3,$f0
; MIPS32: li a1,123
; MIPS32: jal {{.*}} ignoreFpArgsNoInline
define internal i32 @passFp32ConstArg(float %a) {
entry:
......@@ -67,6 +97,10 @@ entry:
; CHECK: mov DWORD PTR [esp+0x4],0x7b
; CHECK: movss DWORD PTR [esp+0x8]
; CHECK: call {{.*}} R_{{.*}} ignoreFp32ArgsNoInline
; MIPS32-LABEL: passFp32ConstArg
; MIPS32: mfc1 a2,$f0
; MIPS32: li a1,123
; MIPS32: jal {{.*}} ignoreFp32ArgsNoInline
declare i32 @ignoreFp32ArgsNoInline(float %x, i32 %y, float %z)
......@@ -76,6 +110,9 @@ entry:
}
; CHECK-LABEL: returnFloatArg
; CHECK: fld DWORD PTR [esp
; MIPS32-LABEL: returnFloatArg
; MIPS32: mov.s $f0,$f12
; MIPS32: jr ra
define internal double @returnDoubleArg(double %a) {
entry:
......@@ -83,6 +120,9 @@ entry:
}
; CHECK-LABEL: returnDoubleArg
; CHECK: fld QWORD PTR [esp
; MIPS32-LABEL: returnDoubleArg
; MIPS32: mov.d $f0,$f12
; MIPS32: jr ra
define internal float @returnFloatConst() {
entry:
......@@ -90,6 +130,10 @@ entry:
}
; CHECK-LABEL: returnFloatConst
; CHECK: fld
; MIPS32-LABEL: returnFloatConst
; MIPS32: lui v0,0x0 160: R_MIPS_HI16 .L$float$3f9d70a4
; MIPS32: lwc1 $f0,0(v0) 164: R_MIPS_LO16 .L$float$3f9d70a4
; MIPS32: jr ra
define internal double @returnDoubleConst() {
entry:
......@@ -97,3 +141,7 @@ entry:
}
; CHECK-LABEL: returnDoubleConst
; CHECK: fld
; MIPS32-LABEL: returnDoubleConst
; MIPS32: lui v0,0x0 170: R_MIPS_HI16 .L$double$3ff3ae147ae147ae
; MIPS32: ldc1 $f0,0(v0) 174: R_MIPS_LO16 .L$double$3ff3ae147ae147ae
; MIPS32: jr ra
......@@ -4,6 +4,12 @@
; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_X8632 --command FileCheck %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
declare void @copy(i32 %arg1, i8* %arr1, i8* %arr2, i8* %arr3, i8* %arr4);
; Test that alloca base addresses get passed correctly to functions.
......@@ -32,6 +38,21 @@ entry:
; CHECK-NEXT: call
; CHECK-NEXT: add esp,0x4c
; CHECK-NEXT: ret
; MIPS32-LABEL: caller1
; MIPS32: addiu sp,sp,{{.*}}
; MIPS32: sw ra,{{.*}}(sp)
; MIPS32: move v0,a0
; MIPS32: sw v0,{{.*}}(sp)
; MIPS32: addiu v0,sp,16
; MIPS32: sw v0,{{.*}}(sp)
; MIPS32: addiu a1,sp,16
; MIPS32: addiu a2,sp,16
; MIPS32: addiu a3,sp,16
; MIPS32: jal
; MIPS32: nop
; MIPS32: lw ra,{{.*}}(sp)
; MIPS32: addiu sp,sp,{{.*}}
; MIPS32: jr ra
; Test that alloca base addresses get passed correctly to functions.
define internal void @caller2(i32 %arg) {
......@@ -63,3 +84,20 @@ entry:
; CHECK-NEXT: call
; CHECK-NEXT: add esp,0x6c
; CHECK-NEXT: ret
; MIPS32-LABEL: caller2
; MIPS32: addiu sp,sp,{{.*}}
; MIPS32: sw ra,{{.*}}(sp)
; MIPS32: move v0,a0
; MIPS32: sw v0,{{.*}}(sp)
; MIPS32: move v0,a0
; MIPS32: sw v0,{{.*}}(sp)
; MIPS32: addiu v0,sp,48
; MIPS32: sw v0,{{.*}}(sp)
; MIPS32: addiu a1,sp,16
; MIPS32: addiu a2,sp,48
; MIPS32: addiu a3,sp,16
; MIPS32: jal
; MIPS32: nop
; MIPS32: lw ra,{{.*}}(sp)
; MIPS32: addiu sp,sp,{{.*}}
; MIPS32: jr ra
......@@ -4,6 +4,12 @@
; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_X8632 --command FileCheck %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
; Test that a sequence of allocas with less than stack alignment get fused.
define internal void @fused_small_align(i32 %arg) {
entry:
......@@ -25,6 +31,14 @@ entry:
; CHECK-NEXT: mov DWORD PTR [esp+0x18],eax
; CHECK-NEXT: mov DWORD PTR [esp],eax
; CHECK-NEXT: add esp,0x30
; MIPS32-LABEL: fused_small_align
; MIPS32: addiu sp,sp,{{.*}}
; MIPS32: move v0,a0
; MIPS32: sw v0,{{.*}}(sp)
; MIPS32: move v0,a0
; MIPS32: sw v0,{{.*}}(sp)
; MIPS32: sw a0,{{.*}}(sp)
; MIPS32: addiu sp,sp,{{.*}}
; Test that a sequence of allocas with greater than stack alignment get fused.
define internal void @fused_large_align(i32 %arg) {
......@@ -51,6 +65,18 @@ entry:
; CHECK-NEXT: mov DWORD PTR [esp+0x60],eax
; CHECK-NEXT: mov esp,ebp
; CHECK-NEXT: pop ebp
; MIPS32-LABEL: fused_large_align
; MIPS32: addiu sp,sp,{{.*}}
; MIPS32: sw s8,{{.*}}(sp)
; MIPS32: move s8,sp
; MIPS32: move v0,a0
; MIPS32: sw v0,{{.*}}(sp)
; MIPS32: move v0,a0
; MIPS32: sw v0,{{.*}}(sp)
; MIPS32: sw a0,{{.*}}(sp)
; MIPS32: move sp,s8
; MIPS32: lw s8,{{.*}}(sp)
; MIPS32: addiu sp,sp,{{.*}}
; Test that an interior pointer into a rematerializable variable is also
; rematerializable, and test that it is detected even when the use appears
......@@ -84,6 +110,14 @@ block2:
; CHECK-NEXT: lea eax,[esp+0x81]
; CHECK-NEXT: add esp,0x180
; CHECK-NEXT: ret
; MIPS32-LABEL: fused_derived
; MIPS32: addiu sp,sp,{{.*}}
; MIPS32: b
; MIPS32: move v0,a0
; MIPS32: sw v0,{{.*}}(sp)
; MIPS32: sw a0,{{.*}}(sp)
; MIPS32: addiu v0,sp,129
; MIPS32: addiu sp,sp,{{.*}}
; Test that a fixed alloca gets referenced by the frame pointer.
define internal void @fused_small_align_with_dynamic(i32 %arg) {
......@@ -115,6 +149,20 @@ next:
; CHECK-NEXT: mov DWORD PTR [edx],eax
; CHECK-NEXT: mov esp,ebp
; CHECK-NEXT: pop ebp
; MIPS32-LABEL: fused_small_align_with_dynamic
; MIPS32: addiu sp,sp,{{.*}}
; MIPS32: sw s8,{{.*}}(sp)
; MIPS32: move s8,sp
; MIPS32: addiu v0,sp,0
; MIPS32: addiu v1,sp,16
; MIPS32: move a1,a0
; MIPS32: sw a1,16(s8)
; MIPS32: move a1,a0
; MIPS32: sw a1,0(v0)
; MIPS32: sw a0,0(v1)
; MIPS32: move sp,s8
; MIPS32: lw s8,{{.*}}(sp)
; MIPS32: addiu sp,sp,{{.*}}
; Test that a sequence with greater than stack alignment and dynamic size
; get folded and referenced correctly;
......@@ -161,3 +209,22 @@ next:
; CHECK-NEXT: mov DWORD PTR [ebx],eax
; CHECK-NEXT: mov esp,ebp
; CHECK-NEXT: pop ebp
; MIPS32-LABEL: fused_large_align_with_dynamic
; MIPS32: addiu sp,sp,{{.*}}
; MIPS32: sw s8,{{.*}}(sp)
; MIPS32: move s8,sp
; MIPS32: addiu v0,sp,0
; MIPS32: addiu v1,sp,64
; MIPS32: move a1,v0
; MIPS32: move a2,a0
; MIPS32: sw a2,0(a1)
; MIPS32: move a1,a0
; MIPS32: sw a1,32(v0)
; MIPS32: move v0,a0
; MIPS32: sw v0,64(s8)
; MIPS32: move v0,a0
; MIPS32: sw v0,48(s8)
; MIPS32: sw a0,0(v1)
; MIPS32: move sp,s8
; MIPS32: lw s8,{{.*}}(sp)
; MIPS32: addiu sp,sp,{{.*}}
......@@ -44,6 +44,19 @@
; RUN: -allow-externally-defined-symbols \
; RUN: | %if --need=target_ARM32 --command FileCheck --check-prefix=SYMTAB %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix=IASMIPS32 %s
; RUN: %if --need=target_MIPS32 --need=allow_dump --command %p2i \
; RUN: --filetype=asm --assemble --disassemble --dis-flags=-t \
; RUN: --target mips32 -i %s --args --verbose none \
; RUN: -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix=SYMTAB %s
define internal i32 @main(i32 %argc, i32 %argv) {
entry:
%expanded1 = ptrtoint [4 x i8]* @PrimitiveInit to i32
......@@ -84,6 +97,9 @@ entry:
; IASARM32: movw {{.*}} PrimitiveInit
; IASARM32: movt {{.*}} PrimitiveInit
; IASARM32: bl
; IASMIPS32: lui {{.*}} PrimitiveInit
; IASMIPS32: addiu {{.*}} PrimitiveInit
; IASMIPS32: jal
; SYMTAB-DAG: 00000000 {{.*}} .rodata {{.*}} PrimitiveInitConst
; IAS: mov {{.*}},0x0 {{.*}} .rodata
......@@ -91,6 +107,9 @@ entry:
; IASARM32: movw {{.*}} PrimitiveInitConst
; IASARM32: movt {{.*}} PrimitiveInitConst
; IASARM32: bl
; IASMIPS32: lui {{.*}} PrimitiveInitConst
; IASMIPS32: addiu {{.*}} PrimitiveInitConst
; IASMIPS32: jal
; SYMTAB-DAG: 00000000 {{.*}} .bss {{.*}} PrimitiveInitStatic
; IAS: mov {{.*}},0x0 {{.*}} .bss
......@@ -98,6 +117,9 @@ entry:
; IASARM32: movw {{.*}} PrimitiveInitStatic
; IASARM32: movt {{.*}} PrimitiveInitStatic
; IASARM32: bl
; IASMIPS32: lui {{.*}} PrimitiveInitStatic
; IASMIPS32: addiu {{.*}} PrimitiveInitStatic
; IASMIPS32: jal
; SYMTAB-DAG: 00000004 {{.*}} .bss {{.*}} PrimitiveUninit
; IAS: mov {{.*}},0x4 {{.*}} .bss
......@@ -105,6 +127,9 @@ entry:
; IASARM32: movw {{.*}} PrimitiveUninit
; IASARM32: movt {{.*}} PrimitiveUninit
; IASARM32: bl
; IASMIPS32: lui {{.*}} PrimitiveUninit
; IASMIPS32: addiu {{.*}} PrimitiveUninit
; IASMIPS32: jal
; SYMTAB-DAG: 00000004{{.*}}.data{{.*}}ArrayInit
; IAS: mov {{.*}},0x4 {{.*}} .data
......@@ -112,6 +137,9 @@ entry:
; IASARM32: movw {{.*}} ArrayInit
; IASARM32: movt {{.*}} ArrayInit
; IASARM32: bl
; IASMIPS32: lui {{.*}} ArrayInit
; IASMIPS32: addiu {{.*}} ArrayInit
; IASMIPS32: jal
; SYMTAB-DAG: 00000018 {{.*}} .data {{.*}} ArrayInitPartial
; IAS: mov {{.*}},0x18 {{.*}} .data
......@@ -119,6 +147,9 @@ entry:
; IASARM32: movw {{.*}} ArrayInitPartial
; IASARM32: movt {{.*}} ArrayInitPartial
; IASARM32: bl
; IASMIPS32: lui {{.*}} ArrayInitPartial
; IASMIPS32: addiu {{.*}} ArrayInitPartial
; IASMIPS32: jal
; SYMTAB-DAG: 00000008 {{.*}} .bss {{.*}} ArrayUninit
; IAS: mov {{.*}},0x8 {{.*}} .bss
......@@ -126,6 +157,9 @@ entry:
; IASARM32: movw {{.*}} ArrayUninit
; IASARM32: movt {{.*}} ArrayUninit
; IASARM32: bl
; IASMIPS32: lui {{.*}} ArrayUninit
; IASMIPS32: addiu {{.*}} ArrayUninit
; IASMIPS32: jal
declare void @use(i32)
......
......@@ -34,6 +34,11 @@
; RUN: -Om1 \
; RUN: | %if --need=target_ARM32 --command FileCheck %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --dis-flags=-rD --args -O2 -sz-seed=1 \
; RUN: -reorder-global-variables \
; RUN: | %if --need=target_MIPS32 --need=allow_dump --command FileCheck %s
@PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4
......
......@@ -4,6 +4,12 @@
; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 | FileCheck %s
; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 | FileCheck %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
define internal i32 @sdiv_i8(i32 %a.i32, i32 %b.i32) {
entry:
%a = trunc i32 %a.i32 to i8
......@@ -14,6 +20,11 @@ entry:
; CHECK-LABEL: sdiv_i8
; CHECK: cbw
; CHECK: idiv
; MIPS32-LABEL: sdiv_i8
; MIPS32: div
; MIPS32: teq
; MIPS32: mflo
; MIPS32: andi {{.*}},0xff
}
define internal i32 @sdiv_i16(i32 %a.i32, i32 %b.i32) {
......@@ -26,6 +37,11 @@ entry:
; CHECK-LABEL: sdiv_i16
; CHECK: cwd
; CHECK: idiv
; MIPS32-LABEL: sdiv_i16
; MIPS32: div
; MIPS32: teq
; MIPS32: mflo
; MIPS32: andi {{.*}},0xffff
}
define internal i32 @sdiv_i32(i32 %a, i32 %b) {
......@@ -35,6 +51,10 @@ entry:
; CHECK-LABEL: sdiv_i32
; CHECK: cdq
; CHECK: idiv
; MIPS32-LABEL: sdiv_i32
; MIPS32: div
; MIPS32: teq
; MIPS32: mflo
}
define internal i32 @srem_i8(i32 %a.i32, i32 %b.i32) {
......@@ -47,6 +67,11 @@ entry:
; CHECK-LABEL: srem_i8
; CHECK: cbw
; CHECK: idiv
; MIPS32-LABEL: srem_i8
; MIPS32: div
; MIPS32: teq
; MIPS32: mfhi
; MIPS32: andi {{.*}},0xff
}
define internal i32 @srem_i16(i32 %a.i32, i32 %b.i32) {
......@@ -59,6 +84,11 @@ entry:
; CHECK-LABEL: srem_i16
; CHECK: cwd
; CHECK: idiv
; MIPS32-LABEL: srem_i16
; MIPS32: div
; MIPS32: teq
; MIPS32: mfhi
; MIPS32: andi {{.*}},0xffff
}
define internal i32 @srem_i32(i32 %a, i32 %b) {
......@@ -68,4 +98,8 @@ entry:
; CHECK-LABEL: srem_i32
; CHECK: cdq
; CHECK: idiv
; MIPS32-LABEL: srem_i32
; MIPS32: div
; MIPS32: teq
; MIPS32: mfhi
}
......@@ -9,6 +9,12 @@
; RUN: --target x8632 -i %s --args -Om1 -mattr=sse4.1 \
; RUN: | %if --need=target_X8632 --command FileCheck %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
define internal float @Square_float(float %a) {
entry:
%result = fmul float %a, %a
......@@ -16,6 +22,9 @@ entry:
}
; CHECK-LABEL: Square_float
; CHECK: mulss [[REG:xmm.]],[[REG]]
; MIPS32-LABEL: Square_float
; MIPS32: mov.s
; MIPS32: mul.s
define internal double @Square_double(double %a) {
entry:
......@@ -24,6 +33,9 @@ entry:
}
; CHECK-LABEL: Square_double
; CHECK: mulsd [[REG:xmm.]],[[REG]]
; MIPS32-LABEL: Square_double
; MIPS32: mov.d
; MIPS32: mul.d
define internal i32 @Square_i32(i32 %a) {
entry:
......@@ -32,6 +44,9 @@ entry:
}
; CHECK-LABEL: Square_i32
; CHECK: imul [[REG:e..]],[[REG]]
; MIPS32-LABEL: Square_i32
; MIPS32: move
; MIPS32: mul
define internal i32 @Square_i16(i32 %a) {
entry:
......@@ -42,6 +57,11 @@ entry:
}
; CHECK-LABEL: Square_i16
; CHECK: imul [[REG:..]],[[REG]]
; MIPS32-LABEL: Square_i16
; MIPS32: move
; MIPS32: mul
; MIPS32: sll
; MIPS32: sra
define internal i32 @Square_i8(i32 %a) {
entry:
......@@ -52,6 +72,11 @@ entry:
}
; CHECK-LABEL: Square_i8
; CHECK: imul al
; MIPS32-LABEL: Square_i8
; MIPS32: move
; MIPS32: mul
; MIPS32: sll
; MIPS32: sra
define internal <4 x float> @Square_v4f32(<4 x float> %a) {
entry:
......
......@@ -15,6 +15,12 @@
; RUN: | %if --need=target_ARM32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix ARM32 %s
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
; Test that and with true uses immediate 1, not -1.
define internal i32 @testAndTrue(i32 %arg) {
entry:
......@@ -27,6 +33,9 @@ entry:
; CHECK: and {{.*}},0x1
; ARM32-LABEL: testAndTrue
; ARM32: and {{.*}}, #1
; MIPS32-LABEL: testAndTrue
; MIPS32: li [[REG:.*]],1
; MIPS32: and {{.*}},[[REG]]
; Test that or with true uses immediate 1, not -1.
define internal i32 @testOrTrue(i32 %arg) {
......@@ -40,6 +49,9 @@ entry:
; CHECK: or {{.*}},0x1
; ARM32-LABEL: testOrTrue
; ARM32: orr {{.*}}, #1
; MIPS32-LABEL: testOrTrue
; MIPS32: li [[REG:.*]],1
; MIPS32: or {{.*}},[[REG]]
; Test that xor with true uses immediate 1, not -1.
define internal i32 @testXorTrue(i32 %arg) {
......@@ -53,6 +65,9 @@ entry:
; CHECK: xor {{.*}},0x1
; ARM32-LABEL: testXorTrue
; ARM32: eor {{.*}}, #1
; MIPS32-LABEL: testXorTrue
; MIPS32: li [[REG:.*]],1
; MIPS32: xor {{.*}},[[REG]]
; Test that trunc to i1 masks correctly.
define internal i32 @testTrunc(i32 %arg) {
......@@ -65,6 +80,8 @@ entry:
; CHECK: and {{.*}},0x1
; ARM32-LABEL: testTrunc
; ARM32: and {{.*}}, #1
; MIPS32-LABEL: testTrunc
; MIPS32: andi {{.*}},0x1
; Test zext to i8.
define internal i32 @testZextI8(i32 %arg) {
......@@ -82,6 +99,9 @@ entry:
; ARM32-LABEL: testZextI8
; ARM32: {{.*}}, #1
; ARM32: uxtb
; MIPS32-LABEL: testZextI8
; MIPS32: andi {{.*}},0x1
; MIPS32: andi {{.*}},0xff
; Test zext to i16.
define internal i32 @testZextI16(i32 %arg) {
......@@ -102,6 +122,10 @@ entry:
; ARM32: and {{.*}}, #1
; ARM32: uxth
; MIPS32-LABEL: testZextI16
; MIPS32: andi {{.*}},0x1
; MIPS32: andi {{.*}},0xffff
; Test zext to i32.
define internal i32 @testZextI32(i32 %arg) {
entry:
......@@ -117,6 +141,8 @@ entry:
; CHECK-NOT: and {{.*}},0x1
; ARM32-LABEL: testZextI32
; ARM32: and {{.*}}, #1
; MIPS32-LABEL: testZextI32
; MIPS32: andi {{.*}},0x1
; Test zext to i64.
define internal i64 @testZextI64(i32 %arg) {
......@@ -134,6 +160,11 @@ entry:
; ARM32-LABEL: testZextI64
; ARM32: and {{.*}}, #1
; ARM32: mov {{.*}}, #0
; MIPS32-LABEL: testZextI64
; MIPS32: andi {{.*}},0x1
; MIPS32: li {{.*}},0
; MIPS32: move
; MIPS32: move
; Test sext to i8.
define internal i32 @testSextI8(i32 %arg) {
......@@ -156,6 +187,12 @@ entry:
; ARM32: mvn {{.*}}, #0
; ARM32: movne
; ARM32: sxtb
;
; MIPS32-LABEL: testSextI8
; MIPS32: sll {{.*}},0x1f
; MIPS32: sra {{.*}},0x1f
; MIPS32: sll {{.*}},0x18
; MIPS32: sra {{.*}},0x18
; Test sext to i16.
define internal i32 @testSextI16(i32 %arg) {
......@@ -180,6 +217,12 @@ entry:
; ARM32: movne
; ARM32: sxth
; MIPS32-LABEL: testSextI16
; MIPS32: sll {{.*}},0x1f
; MIPS32: sra {{.*}},0x1f
; MIPS32: sll {{.*}},0x10
; MIPS32: sra {{.*}},0x10
; Test sext to i32.
define internal i32 @testSextI32(i32 %arg) {
entry:
......@@ -201,6 +244,10 @@ entry:
; ARM32: mvn {{.*}}, #0
; ARM32: movne
; MIPS32-LABEL: testSextI32
; MIPS32: sll {{.*}},0x1f
; MIPS32: sra {{.*}},0x1f
; Test sext to i64.
define internal i64 @testSextI64(i32 %arg) {
entry:
......@@ -223,6 +270,12 @@ entry:
; ARM32: movne [[REG:r[0-9]+]]
; ARM32: mov {{.*}}, [[REG]]
; MIPS32-LABEL: testSextI64
; MIPS32: sll {{.*}},0x1f
; MIPS32: sra {{.*}},0x1f
; MIPS32: move
; MIPS32: move
; Kind of like sext i1 to i32, but with an immediate source. On ARM,
; sxtb cannot take an immediate operand, so make sure it's using a reg.
; If we had optimized constants, this could just be mov dst, 0xffffffff
......@@ -240,6 +293,10 @@ define internal i32 @testSextTrue() {
; ARM32: tst {{.*}}, #1
; ARM32: mvn {{.*}}, #0
; ARM32: movne
; MIPS32-LABEL: testSextTrue
; MIPS32: li {{.*}},1
; MIPS32: sll {{.*}},0x1f
; MIPS32: sra {{.*}},0x1f
define internal i32 @testZextTrue() {
%result = zext i1 true to i32
......@@ -251,6 +308,9 @@ define internal i32 @testZextTrue() {
; ARM32-LABEL: testZextTrue
; ARM32: mov{{.*}}, #1
; ARM32: and {{.*}}, #1
; MIPS32-LABEL: testZextTrue
; MIPS32: li {{.*}},1
; MIPS32: andi {{.*}},0x1
; Test fptosi float to i1.
define internal i32 @testFptosiFloat(float %arg) {
......@@ -265,6 +325,11 @@ entry:
; CHECK: movzx [[REG:.*]],
; CHECK-NEXT: shl [[REG]],0x1f
; CHECK-NEXT: sar [[REG]],0x1f
; MIPS32-LABEL: testFptosiFloat
; MIPS32: trunc.w.s
; MIPS32: mfc1
; MIPS32: sll {{.*}},0x1f
; MIPS32: sra {{.*}},0x1f
; Test fptosi double to i1.
define internal i32 @testFptosiDouble(double %arg) {
......@@ -279,3 +344,8 @@ entry:
; CHECK: movzx [[REG:.*]],
; CHECK-NEXT: shl [[REG]],0x1f
; CHECK-NEXT: sar [[REG]],0x1f
; MIPS32-LABEL: testFptosiDouble
; MIPS32: trunc.w.d
; MIPS32: mfc1
; MIPS32: sll {{.*}},0x1f
; MIPS32: sra {{.*}},0x1f
......@@ -5,6 +5,12 @@
; RUN: %p2i -i %s --target=x8632 --filetype=obj --disassemble -a -O2 \
; RUN: --allow-externally-defined-symbols | FileCheck %s --check-prefix=X86
; RUN: %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
; RUN: | %if --need=target_MIPS32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix MIPS32 %s
declare void @useV4I32(<4 x i32> %t);
define internal void @shuffleV4I32(<4 x i32> %a, <4 x i32> %b) {
......@@ -51,3 +57,19 @@ define internal void @shuffleV4I32(<4 x i32> %a, <4 x i32> %b) {
ret void
}
; MIPS32-LABEL: shuffleV4I32
; MIPS32: move
; MIPS32: move
; MIPS32: move
; MIPS32: move
; MIPS32: jal
; MIPS32: move
; MIPS32: move
; MIPS32: move
; MIPS32: move
; MIPS32: jal
; MIPS32: move
; MIPS32: move
; MIPS32: move
; MIPS32: move
; MIPS32: jal
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment