X64: replace explicit zero-extend with runtime assert
authorbmeurer@chromium.org <bmeurer@chromium.org>
Fri, 31 Oct 2014 09:19:55 +0000 (09:19 +0000)
committerbmeurer@chromium.org <bmeurer@chromium.org>
Fri, 31 Oct 2014 09:20:13 +0000 (09:20 +0000)
Since the input float64 is in the range of [0, 2^32-1], the upper 32 bits of output register
should be zero.

BUG=
R=bmeurer@chromium.org, titzer@chromium.org

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

Patch from Weiliang Lin <weiliang.lin@intel.com>.

Cr-Commit-Position: refs/heads/master@{#25027}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25027 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/compiler/x64/code-generator-x64.cc

index 3e5485942959594e55c98a7e9eafeb48eb807ba6..9e107e20e63e8122680a15ea2ae7ee78ebdf2905 100644 (file)
@@ -441,16 +441,15 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
         __ cvttsd2si(i.OutputRegister(), i.InputOperand(0));
       }
       break;
-    case kSSEFloat64ToUint32:
+    case kSSEFloat64ToUint32: {
       if (instr->InputAt(0)->IsDoubleRegister()) {
         __ cvttsd2siq(i.OutputRegister(), i.InputDoubleRegister(0));
       } else {
         __ cvttsd2siq(i.OutputRegister(), i.InputOperand(0));
       }
-      __ andl(i.OutputRegister(), i.OutputRegister());  // clear upper bits.
-      // TODO(turbofan): generated code should not look at the upper 32 bits
-      // of the result, but those bits could escape to the outside world.
+      __ AssertZeroExtended(i.OutputRegister());
       break;
+    }
     case kSSEInt32ToFloat64:
       if (instr->InputAt(0)->IsRegister()) {
         __ cvtlsi2sd(i.OutputDoubleRegister(), i.InputRegister(0));