OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 [](MacroAssembler* masm, int32_t in_offset, | 1894 [](MacroAssembler* masm, int32_t in_offset, |
1895 int32_t out_offset) { | 1895 int32_t out_offset) { |
1896 __ Uldc1(f0, MemOperand(a0, in_offset), t0); | 1896 __ Uldc1(f0, MemOperand(a0, in_offset), t0); |
1897 __ Usdc1(f0, MemOperand(a0, out_offset), t0); | 1897 __ Usdc1(f0, MemOperand(a0, out_offset), t0); |
1898 })); | 1898 })); |
1899 } | 1899 } |
1900 } | 1900 } |
1901 } | 1901 } |
1902 } | 1902 } |
1903 | 1903 |
| 1904 static const std::vector<uint64_t> sltu_test_values() { |
| 1905 static const uint64_t kValues[] = { |
| 1906 0, |
| 1907 1, |
| 1908 0x7ffe, |
| 1909 0x7fff, |
| 1910 0x8000, |
| 1911 0x8001, |
| 1912 0xfffe, |
| 1913 0xffff, |
| 1914 0xffffffffffff7ffe, |
| 1915 0xffffffffffff7fff, |
| 1916 0xffffffffffff8000, |
| 1917 0xffffffffffff8001, |
| 1918 0xfffffffffffffffe, |
| 1919 0xffffffffffffffff, |
| 1920 }; |
| 1921 return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); |
| 1922 } |
| 1923 |
| 1924 template <typename Func> |
| 1925 bool run_Sltu(uint64_t rs, uint64_t rd, Func GenerateSltuInstructionFunc) { |
| 1926 typedef int64_t (*F_CVT)(uint64_t x0, uint64_t x1, int x2, int x3, int x4); |
| 1927 |
| 1928 Isolate* isolate = CcTest::i_isolate(); |
| 1929 HandleScope scope(isolate); |
| 1930 MacroAssembler assm(isolate, nullptr, 0, |
| 1931 v8::internal::CodeObjectRequired::kYes); |
| 1932 MacroAssembler* masm = &assm; |
| 1933 |
| 1934 GenerateSltuInstructionFunc(masm, rd); |
| 1935 __ jr(ra); |
| 1936 __ nop(); |
| 1937 |
| 1938 CodeDesc desc; |
| 1939 assm.GetCode(&desc); |
| 1940 Handle<Code> code = isolate->factory()->NewCode( |
| 1941 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1942 |
| 1943 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); |
| 1944 int64_t res = reinterpret_cast<int64_t>( |
| 1945 CALL_GENERATED_CODE(isolate, f, rs, rd, 0, 0, 0)); |
| 1946 return res == 1; |
| 1947 } |
| 1948 |
| 1949 TEST(Sltu) { |
| 1950 CcTest::InitializeVM(); |
| 1951 |
| 1952 FOR_UINT64_INPUTS(i, sltu_test_values) { |
| 1953 FOR_UINT64_INPUTS(j, sltu_test_values) { |
| 1954 uint64_t rs = *i; |
| 1955 uint64_t rd = *j; |
| 1956 |
| 1957 CHECK_EQ(rs < rd, run_Sltu(rs, rd, |
| 1958 [](MacroAssembler* masm, uint64_t imm) { |
| 1959 __ Sltu(v0, a0, Operand(imm)); |
| 1960 })); |
| 1961 CHECK_EQ(rs < rd, |
| 1962 run_Sltu(rs, rd, [](MacroAssembler* masm, |
| 1963 uint64_t imm) { __ Sltu(v0, a0, a1); })); |
| 1964 } |
| 1965 } |
| 1966 } |
| 1967 |
1904 #undef __ | 1968 #undef __ |
OLD | NEW |