Commit d5ffbfef authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: Change the test case for X87 RunTruncateFloat32ToUint32.

  The CL #35651 (https://codereview.chromium.org/1858323003) exposed one hiden issue in RunTruncateFloat32ToUint32 test cases and X87 failed at it.

  Here is the issue in RunTruncateFloat32ToUint32:
  For float input = static_cast<float>(*i), the x87 GCC would optimize the input viariable in float floating register for release build.

  The problem is:
  SSE float register has single precision rounding semantic While X87 register hasn't when directly use floating register value. It will cause the value of input viariable has
  different precision for IA32 and X87 port. So static_cast<uint32_t>(input) will be different for IA32 and X87 port too.
  This led to CHECK_EQ(static_cast<uint32_t>(input), m.Call(input)) fail although V8 turbofan JITTed code m.Call(input) has exactly same result in both X87 and IA32 port.

  So we add the following sentence to do type cast to keep the single precision for RunTruncateFloat32ToUint32 by forcing the input viariable get value from memory insread of
  floating register.
  Such as: volatile float input = static_cast<float>(*i).

BUG=

Review URL: https://codereview.chromium.org/1905883002

Cr-Commit-Position: refs/heads/master@{#35689}
parent 2d454e22
......@@ -4019,7 +4019,7 @@ TEST(RunTruncateFloat32ToUint32) {
m.Return(m.TruncateFloat32ToUint32(m.Parameter(0)));
{
FOR_UINT32_INPUTS(i) {
float input = static_cast<float>(*i);
volatile float input = static_cast<float>(*i);
// This condition on 'input' is required because
// static_cast<float>(std::numeric_limits<uint32_t>::max()) results in a
// value outside uint32 range.
......
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