This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients Serge Anuchin, mark.dickinson, r.david.murray, rhettinger, serhiy.storchaka, skrah, steven.daprano, tim.peters, vstinner
Date 2015-07-04.12:17:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1436012261.72.0.317914045691.issue24546@psf.upfronthosting.co.za>
In-reply-to
Content
People have posted the asm now:

https://mail.python.org/pipermail/python-list/2015-July/693509.html


The fmull result appears to be the same. The good gcc versions set
the control word to "truncate" and then use fistpl (single rounding
with the correct mode):

  fmull  -0x10(%ebp)
  fnstcw -0x1a(%ebp)
  movzwl -0x1a(%ebp),%eax
  mov    $0xc,%ah
  mov    %ax,-0x1c(%ebp)
  fldcw  -0x1c(%ebp)
  fistpl -0x20(%ebp)


The bad versions dump the result of fmull to memory, using
"round-to-nearest" and *then* attempt to truncate with
cvttsd2si, which is too late.
 
  fmull  0x18(%esp)
​  fstpl  0x8(%esp)
  cvttsd2si 0x8(%esp),%eax


I suspect that there are passages in various standards that allow
both behaviors. ;)
History
Date User Action Args
2015-07-04 12:17:41skrahsetrecipients: + skrah, tim.peters, rhettinger, mark.dickinson, vstinner, steven.daprano, r.david.murray, serhiy.storchaka, Serge Anuchin
2015-07-04 12:17:41skrahsetmessageid: <1436012261.72.0.317914045691.issue24546@psf.upfronthosting.co.za>
2015-07-04 12:17:41skrahlinkissue24546 messages
2015-07-04 12:17:41skrahcreate