Status: New
Owner: ----

New issue 3737 by [email protected]: wrong rounding mode?
https://code.google.com/p/v8/issues/detail?id=3737

Not sure if this is a bug

--- Raw source ---
(x) { return x == Math.floor(x); }

0x51d542e4 36 8b4508 mov eax,[ebp+0x8] ;; debug: position 76
                      ;;; <@18,#31> double-untag
    0x51d542e7    39  a801           test al,0x1
    0x51d542e9    41  7414           jz 63  (0x51d542ff)
0x51d542eb 43 8178ff7181f04e cmp [eax-0x1],0x4ef08171 ;; object: 0x4ef08171 <Map(elements=3)>
    0x51d542f2    50  0f8567000000   jnz 159  (0x51d5435f)
    0x51d542f8    56  f20f104803     movsd xmm1,[eax+0x3]
    0x51d542fd    61  eb0b           jmp 74  (0x51d5430a)
    0x51d542ff    63  89c1           mov ecx,eax
    0x51d54301    65  d1f9           sar ecx,1
    0x51d54303    67  0f57c9         xorps xmm1,xmm1
    0x51d54306    70  f20f2ac9       cvtsi2sd xmm1,ecx
                      ;;; <@20,#15> math-floor
    0x51d5430a    74  0f57c0         xorps xmm0,xmm0
    0x51d5430d    77  660f2ec8       ucomisd xmm1,xmm0
    0x51d54311    81  750d           jnz 96  (0x51d54320)
    0x51d54313    83  660f50c9       movmskpd ecx,xmm1
    0x51d54317    87  f6c101         test_b cl,0x1
    0x51d5431a    90  0f8544000000   jnz 164  (0x51d54364)

    0x51d54320    96  660f3a0bc109   roundsd xmm0,xmm1,9

By my reading of the intel specs, this has an immediate byte operand (9 = 0b1001) specifying P=1, O=0, RC=01

The 'O' field is '0', selecting the MSCSR:RC, but I think it should be '1', selecting the immediate RC field.

Rounding control source definitions:
Value Description
0 MXCSR:RC
1 Use RC field value.

Should the field be 0b1101 ?


    0x51d54326   102  f20f2cc8       cvttsd2si ecx,xmm0
    0x51d5432a   106  83f901         cmp ecx,0x1
    0x51d5432d   109  0f8031000000   jo 164  (0x51d54364)
                      ;;; <@22,#32> int32-to-double
    0x51d54333   115  0f57d2         xorps xmm2,xmm2
    0x51d54336   118  f20f2ad1       cvtsi2sd xmm2,ecx
                      ;;; <@25,#16> compare-numeric-and-branch
    0x51d5433a   122  660f2eca       ucomisd xmm1,xmm2
    0x51d5433e   126  0f8a06000000   jpe 138  (0x51d5434a)
    0x51d54344   132  0f840a000000   jz 148  (0x51d54354)

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to