Commit 07371c52 authored by Zhi An Ng's avatar Zhi An Ng Committed by Commit Bot

Reland "Add int64_t min and max to value helpers for test"

This is a reland of dde93768

Original change's description:
> Add int64_t min and max to value helpers for test
>
> And also fix up a truncate float to int test that was using
> int list as input instead of a float list.
>
> Change-Id: I544e38b2d212f8d11dfb5758db4fe6b283acae0d
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2419654
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Commit-Queue: Zhi An Ng <zhin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#70774}

Change-Id: Id196ea40eaf616d784d644346b912f1561fd97a0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2500926Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70810}
parent 51e15a6d
......@@ -9,6 +9,7 @@
#include "src/base/bits.h"
#include "src/base/ieee754.h"
#include "src/base/overflowing-math.h"
#include "src/base/safe_conversions.h"
#include "src/base/utils/random-number-generator.h"
#include "src/common/ptr-compr-inl.h"
#include "src/objects/objects-inl.h"
......@@ -6464,10 +6465,9 @@ TEST(RunChangeFloat64ToInt64) {
BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64());
m.Return(m.ChangeFloat64ToInt64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
double input = static_cast<double>(i);
if (static_cast<int64_t>(input) == i) {
CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
FOR_FLOAT64_INPUTS(i) {
if (base::IsValueInRangeForNumericType<int64_t>(i)) {
CHECK_EQ(static_cast<int64_t>(i), m.Call(i));
}
}
}
......@@ -6477,10 +6477,8 @@ TEST(RunChangeInt64ToFloat64) {
m.Return(m.ChangeInt64ToFloat64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
double output = static_cast<double>(i);
if (static_cast<int64_t>(output) == i) {
CHECK_EQ(output, m.Call(i));
}
}
}
TEST(RunBitcastInt64ToFloat64) {
......@@ -6548,10 +6546,12 @@ TEST(RunTryTruncateFloat64ToInt64WithoutCheck) {
BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64());
m.Return(m.TryTruncateFloat64ToInt64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(i) {
if (base::IsValueInRangeForNumericType<int64_t>(i)) {
double input = static_cast<double>(i);
CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
}
}
}
......
......@@ -273,6 +273,8 @@ class ValueHelper {
0x000007FFFFFFFFFF, 0x000003FFFFFFFFFF, 0x000001FFFFFFFFFF,
0x8000008000000000, 0x8000008000000001, 0x8000000000000400,
0x8000000000000401, 0x0000000000000020,
0x8000000000000000, // int64_t min
0x7FFFFFFFFFFFFFFF, // int64_t max
// Bit pattern of a quiet NaN and signaling NaN, with or without
// additional payload.
0x7FF8000000000000, 0x7FF0000000000000, 0x7FF8123456789ABC,
......
......@@ -250,6 +250,8 @@ WASM_EXEC_TEST(I64RemS) {
FOR_INT64_INPUTS(j) {
if (j == 0) {
CHECK_TRAP64(r.Call(i, j));
} else if (j == -1) {
CHECK_EQ(0, r.Call(i, j));
} else {
CHECK_EQ(i % j, r.Call(i, j));
}
......
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