Index: test/cctest/test-macro-assembler-mips64.cc |
diff --git a/test/cctest/test-macro-assembler-mips64.cc b/test/cctest/test-macro-assembler-mips64.cc |
index 5f9451027c90f03d1e7e372d4a0455779b7c444c..1dc260ff01c1e512cc27c7cf03dcce49b04044b1 100644 |
--- a/test/cctest/test-macro-assembler-mips64.cc |
+++ b/test/cctest/test-macro-assembler-mips64.cc |
@@ -1901,4 +1901,68 @@ TEST(Uldc1) { |
} |
} |
+static const std::vector<uint64_t> sltu_test_values() { |
+ static const uint64_t kValues[] = { |
+ 0, |
+ 1, |
+ 0x7ffe, |
+ 0x7fff, |
+ 0x8000, |
+ 0x8001, |
+ 0xfffe, |
+ 0xffff, |
+ 0xffffffffffff7ffe, |
+ 0xffffffffffff7fff, |
+ 0xffffffffffff8000, |
+ 0xffffffffffff8001, |
+ 0xfffffffffffffffe, |
+ 0xffffffffffffffff, |
+ }; |
+ return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); |
+} |
+ |
+template <typename Func> |
+bool run_Sltu(uint64_t rs, uint64_t rd, Func GenerateSltuInstructionFunc) { |
+ typedef int64_t (*F_CVT)(uint64_t x0, uint64_t x1, int x2, int x3, int x4); |
+ |
+ Isolate* isolate = CcTest::i_isolate(); |
+ HandleScope scope(isolate); |
+ MacroAssembler assm(isolate, nullptr, 0, |
+ v8::internal::CodeObjectRequired::kYes); |
+ MacroAssembler* masm = &assm; |
+ |
+ GenerateSltuInstructionFunc(masm, rd); |
+ __ jr(ra); |
+ __ nop(); |
+ |
+ CodeDesc desc; |
+ assm.GetCode(&desc); |
+ Handle<Code> code = isolate->factory()->NewCode( |
+ desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
+ |
+ F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); |
+ int64_t res = reinterpret_cast<int64_t>( |
+ CALL_GENERATED_CODE(isolate, f, rs, rd, 0, 0, 0)); |
+ return res == 1; |
+} |
+ |
+TEST(Sltu) { |
+ CcTest::InitializeVM(); |
+ |
+ FOR_UINT64_INPUTS(i, sltu_test_values) { |
+ FOR_UINT64_INPUTS(j, sltu_test_values) { |
+ uint64_t rs = *i; |
+ uint64_t rd = *j; |
+ |
+ CHECK_EQ(rs < rd, run_Sltu(rs, rd, |
+ [](MacroAssembler* masm, uint64_t imm) { |
+ __ Sltu(v0, a0, Operand(imm)); |
+ })); |
+ CHECK_EQ(rs < rd, |
+ run_Sltu(rs, rd, [](MacroAssembler* masm, |
+ uint64_t imm) { __ Sltu(v0, a0, a1); })); |
+ } |
+ } |
+} |
+ |
#undef __ |