Index: tests_lit/llvm2ice_tests/8bit.pnacl.ll |
diff --git a/tests_lit/llvm2ice_tests/8bit.pnacl.ll b/tests_lit/llvm2ice_tests/8bit.pnacl.ll |
index d11c857a7ee972f91b764898838f35fcd3deb128..d73dc40f11a83275b6bb8c78b8682719553d5952 100644 |
--- a/tests_lit/llvm2ice_tests/8bit.pnacl.ll |
+++ b/tests_lit/llvm2ice_tests/8bit.pnacl.ll |
@@ -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 |