Index: tests_lit/llvm2ice_tests/return_immediates.ll |
diff --git a/tests_lit/llvm2ice_tests/return_immediates.ll b/tests_lit/llvm2ice_tests/return_immediates.ll |
index 2d94fb5ff105995588c8ee46acdf3c9d34297afa..054b16ec989a1823969a1c77bd99fb1da418f767 100644 |
--- a/tests_lit/llvm2ice_tests/return_immediates.ll |
+++ b/tests_lit/llvm2ice_tests/return_immediates.ll |
@@ -13,6 +13,15 @@ |
; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
; RUN: --command FileCheck --check-prefix ARM32 %s |
+; TODO(rkotler): Stop skipping unimplemented parts (via --skip-unimplemented) |
+; once enough infrastructure is in. Also, switch to --filetype=obj |
+; when possible. |
+; RUN: %if --need=target_MIPS32 --need=allow_dump \ |
+; RUN: --command %p2i --filetype=asm --assemble \ |
+; RUN: --disassemble --target mips32 -i %s --args -O2 --skip-unimplemented \ |
+; RUN: | %if --need=target_MIPS32 --need=allow_dump \ |
+; RUN: --command FileCheck --check-prefix MIPS32 %s |
+ |
; Test 8-bits of all ones rotated right by various amounts (even vs odd). |
; ARM has a shifter that allows encoding 8-bits rotated right by even amounts. |
; The first few "rotate right" test cases are expressed as shift-left. |
@@ -24,6 +33,8 @@ define i32 @ret_8bits_shift_left0() { |
; CHECK-NEXT: mov eax,0xff |
; ARM32-LABEL: ret_8bits_shift_left0 |
; ARM32-NEXT: mov r0, #255 |
+; MIPS32-LABEL: <ret_8bits_shift_left0> |
+; MIPS32-NEXT: li v0,255 |
define i32 @ret_8bits_shift_left1() { |
ret i32 510 |
@@ -32,6 +43,8 @@ define i32 @ret_8bits_shift_left1() { |
; CHECK-NEXT: mov eax,0x1fe |
; ARM32-LABEL: ret_8bits_shift_left1 |
; ARM32-NEXT: movw r0, #510 |
+; MIPS32-LABEL: <ret_8bits_shift_left1> |
+; MIPS32-NEXT: li v0,510 |
define i32 @ret_8bits_shift_left2() { |
ret i32 1020 |
@@ -40,6 +53,8 @@ define i32 @ret_8bits_shift_left2() { |
; CHECK-NEXT: mov eax,0x3fc |
; ARM32-LABEL: ret_8bits_shift_left2 |
; ARM32-NEXT: mov r0, #1020 |
+; MIPS32-LABEL: <ret_8bits_shift_left2> |
+; MIPS32-NEXT: li v0,1020 |
define i32 @ret_8bits_shift_left4() { |
ret i32 4080 |
@@ -48,6 +63,8 @@ define i32 @ret_8bits_shift_left4() { |
; CHECK-NEXT: mov eax,0xff0 |
; ARM32-LABEL: ret_8bits_shift_left4 |
; ARM32-NEXT: mov r0, #4080 |
+; MIPS32-LABEL: <ret_8bits_shift_left4> |
+; MIPS32-NEXT: li v0,4080 |
define i32 @ret_8bits_shift_left14() { |
ret i32 4177920 |
@@ -56,6 +73,9 @@ define i32 @ret_8bits_shift_left14() { |
; CHECK-NEXT: mov eax,0x3fc000 |
; ARM32-LABEL: ret_8bits_shift_left14 |
; ARM32-NEXT: mov r0, #4177920 |
+; MIPS32-LABEL: <ret_8bits_shift_left14> |
+; MIPS32-NEXT: lui v0,0x3f |
+; MIPS32-NEXT: ori v0,v0,0xc000 |
define i32 @ret_8bits_shift_left15() { |
ret i32 8355840 |
@@ -65,6 +85,9 @@ define i32 @ret_8bits_shift_left15() { |
; ARM32-LABEL: ret_8bits_shift_left15 |
; ARM32-NEXT: movw r0, #32768 |
; ARM32-NEXT: movt r0, #127 |
+; MIPS32-LABEL: <ret_8bits_shift_left15> |
+; MIPS32-NEXT: lui v0,0x7f |
+; MIPS32-NEXT: ori v0,v0,0x8000 |
; Shift 8 bits left by 24 to the i32 limit. This is also ror by 8 bits. |
@@ -76,6 +99,9 @@ define i32 @ret_8bits_shift_left24() { |
; ARM32-LABEL: ret_8bits_shift_left24 |
; ARM32-NEXT: mov r0, #-16777216 |
; ARM32-NEXT: bx lr |
+; MIPS32-LABEL: <ret_8bits_shift_left24> |
+; MIPS32-NEXT: lui v0,0xff00 |
+; MIPS32-NEXT: ori v0,v0,0x0 |
; The next few cases wrap around and actually demonstrate the rotation. |
@@ -87,6 +113,9 @@ define i32 @ret_8bits_ror7() { |
; ARM32-LABEL: ret_8bits_ror7 |
; ARM32-NEXT: movw r0, #1 |
; ARM32-NEXT: movt r0, #65024 |
+; MIPS32-LABEL: <ret_8bits_ror7> |
+; MIPS32-NEXT: lui v0,0xfe00 |
+; MIPS32-NEXT: ori v0,v0,0x1 |
define i32 @ret_8bits_ror6() { |
ret i32 4227858435 |
@@ -96,6 +125,9 @@ define i32 @ret_8bits_ror6() { |
; ARM32-LABEL: ret_8bits_ror6 |
; ARM32-NEXT: mov r0, #-67108861 |
; ARM32-NEXT: bx lr |
+; MIPS32-LABEL: <ret_8bits_ror6> |
+; MIPS32-NEXT: lui v0,0xfc00 |
+; MIPS32-NEXT: ori v0,v0,0x3 |
define i32 @ret_8bits_ror5() { |
ret i32 4160749575 |
@@ -105,6 +137,9 @@ define i32 @ret_8bits_ror5() { |
; ARM32-LABEL: ret_8bits_ror5 |
; ARM32-NEXT: movw r0, #7 |
; ARM32-NEXT: movt r0, #63488 |
+; MIPS32-LABEL: <ret_8bits_ror5> |
+; MIPS32-NEXT: lui v0,0xf800 |
+; MIPS32-NEXT: ori v0,v0,0x7 |
define i32 @ret_8bits_ror4() { |
ret i32 4026531855 |
@@ -114,6 +149,9 @@ define i32 @ret_8bits_ror4() { |
; ARM32-LABEL: ret_8bits_ror4 |
; ARM32-NEXT: mov r0, #-268435441 |
; ARM32-NEXT: bx lr |
+; MIPS32-LABEL: <ret_8bits_ror4> |
+; MIPS32-NEXT: lui v0,0xf000 |
+; MIPS32-NEXT: ori v0,v0,0xf |
define i32 @ret_8bits_ror3() { |
ret i32 3758096415 |
@@ -123,6 +161,10 @@ define i32 @ret_8bits_ror3() { |
; ARM32-LABEL: ret_8bits_ror3 |
; ARM32-NEXT: movw r0, #31 |
; ARM32-NEXT: movt r0, #57344 |
+; MIPS32-LABEL: <ret_8bits_ror3> |
+; MIPS32-NEXT: lui v0,0xe000 |
+; MIPS32-NEXT: ori v0,v0,0x1f |
+ |
define i32 @ret_8bits_ror2() { |
ret i32 3221225535 |
@@ -132,6 +174,9 @@ define i32 @ret_8bits_ror2() { |
; ARM32-LABEL: ret_8bits_ror2 |
; ARM32-NEXT: mov r0, #-1073741761 |
; ARM32-NEXT: bx lr |
+; MIPS32-LABEL: <ret_8bits_ror2> |
+; MIPS32-NEXT: lui v0,0xc000 |
+; MIPS32-NEXT: ori v0,v0,0x3f |
define i32 @ret_8bits_ror1() { |
ret i32 2147483775 |
@@ -141,6 +186,9 @@ define i32 @ret_8bits_ror1() { |
; ARM32-LABEL: ret_8bits_ror1 |
; ARM32-NEXT: movw r0, #127 |
; ARM32-NEXT: movt r0, #32768 |
+; MIPS32-LABEL: <ret_8bits_ror1> |
+; MIPS32-NEXT: lui v0,0x8000 |
+; MIPS32-NEXT: ori v0,v0,0x7f |
; Some architectures can handle 16-bits at a time efficiently, |
; so also test those. |
@@ -153,6 +201,9 @@ define i32 @ret_16bits_lower() { |
; ARM32-LABEL: ret_16bits_lower |
; ARM32-NEXT: movw r0, #65535 |
; ARM32-NEXT: bx lr |
+; MIPS32-LABEL: <ret_16bits_lower> |
+; MIPS32-NEXT: lui v0,0x0 |
+; MIPS32-NEXT: ori v0,v0,0xffff |
define i32 @ret_17bits_lower() { |
ret i32 131071 |
@@ -162,6 +213,10 @@ define i32 @ret_17bits_lower() { |
; ARM32-LABEL: ret_17bits_lower |
; ARM32-NEXT: movw r0, #65535 |
; ARM32-NEXT: movt r0, #1 |
+; MIPS32-LABEL: <ret_17bits_lower> |
+; MIPS32-NEXT: lui v0,0x1 |
+; MIPS32-NEXT: ori v0,v0,0xffff |
+ |
define i32 @ret_16bits_upper() { |
ret i32 4294901760 |
@@ -171,6 +226,10 @@ define i32 @ret_16bits_upper() { |
; ARM32-LABEL: ret_16bits_upper |
; ARM32-NEXT: movw r0, #0 |
; ARM32-NEXT: movt r0, #65535 |
+; MIPS32-LABEL: <ret_16bits_upper> |
+; MIPS32-NEXT: lui v0,0xffff |
+; MIPS32-NEXT: ori v0,v0,0x0 |
+ |
; Some 32-bit immediates can be inverted, and moved in a single instruction. |
@@ -182,6 +241,8 @@ define i32 @ret_8bits_inverted_shift_left0() { |
; ARM32-LABEL: ret_8bits_inverted_shift_left0 |
; ARM32-NEXT: mvn r0, #255 |
; ARM32-NEXT: bx lr |
+; MIPS32-LABEL: <ret_8bits_inverted_shift_left0> |
+; MIPS32-NEXT: li v0,-256 |
define i32 @ret_8bits_inverted_shift_left24() { |
ret i32 16777215 |
@@ -191,6 +252,9 @@ define i32 @ret_8bits_inverted_shift_left24() { |
; ARM32-LABEL: ret_8bits_inverted_shift_left24 |
; ARM32-NEXT: mvn r0, #-16777216 |
; ARM32-NEXT: bx lr |
+; MIPS32-LABEL: <ret_8bits_inverted_shift_left24> |
+; MIPS32-NEXT: lui v0,0xff |
+; MIPS32-NEXT: ori v0,v0,0xffff |
define i32 @ret_8bits_inverted_ror2() { |
ret i32 1073741760 |
@@ -200,6 +264,9 @@ define i32 @ret_8bits_inverted_ror2() { |
; ARM32-LABEL: ret_8bits_inverted_ror2 |
; ARM32-NEXT: mvn r0, #-1073741761 |
; ARM32-NEXT: bx lr |
+; MIPS32-LABEL: <ret_8bits_inverted_ror2> |
+; MIPS32-NEXT: lui v0,0x3fff |
+; MIPS32-NEXT: ori v0,v0,0xffc0 |
define i32 @ret_8bits_inverted_ror6() { |
ret i32 67108860 |
@@ -209,6 +276,10 @@ define i32 @ret_8bits_inverted_ror6() { |
; ARM32-LABEL: ret_8bits_inverted_ror6 |
; ARM32-NEXT: mvn r0, #-67108861 |
; ARM32-NEXT: bx lr |
+; MIPS32-LABEL: <ret_8bits_inverted_ror6> |
+; MIPS32-NEXT: lui v0,0x3ff |
+; MIPS32-NEXT: ori v0,v0,0xfffc |
+ |
define i32 @ret_8bits_inverted_ror7() { |
ret i32 33554430 |
@@ -218,6 +289,9 @@ define i32 @ret_8bits_inverted_ror7() { |
; ARM32-LABEL: ret_8bits_inverted_ror7 |
; ARM32-NEXT: movw r0, #65534 |
; ARM32-NEXT: movt r0, #511 |
+; MIPS32-LABEL: <ret_8bits_inverted_ror7> |
+; MIPS32-NEXT: lui v0,0x1ff |
+; MIPS32-NEXT: ori v0,v0,0xfffe |
; 64-bit immediates. |
@@ -230,6 +304,10 @@ define i64 @ret_64bits_shift_left0() { |
; ARM32-LABEL: ret_64bits_shift_left0 |
; ARM32-NEXT: movw r0, #255 |
; ARM32-NEXT: movw r1, #255 |
+; MIPS32-LABEL: <ret_64bits_shift_left0> |
+; MIPS32-NEXT: li v0,255 |
+; MIPS32-NEXT: li v1,255 |
+ |
; A relocatable constant is assumed to require 32-bits along with |
; relocation directives. |
@@ -245,3 +323,8 @@ define i32 @ret_addr() { |
; ARM32-LABEL: ret_addr |
; ARM32-NEXT: movw r0, #0 {{.*}} R_ARM_MOVW_ABS_NC _start |
; ARM32-NEXT: movt r0, #0 {{.*}} R_ARM_MOVT_ABS _start |
+; TODO(RKotler) emitting proper li but in disassembly |
+; it shows up only in the relocation records. Should emit |
+; without the macro but we still need to add GOT implementation |
+; to finish this case |
+; |