Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #256 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Bad code generation for asm { fdiv ST(1), ST; }

Reported by: Don Clugston Assigned to: ChristianK
Priority: major Milestone:
Component: unspecified Version: hg tip
Keywords: Cc:

Description

There were a defective set of dstress tests, based on an erroneous bug report. http://d.puremagic.com/issues/show_bug.cgi?id=840

LDC has been passing those tests -- which means it's wrong! Most likely, you guys went to some trouble to make it generate wrong code. Aaargh!

Attachments

fdivfsubreverse.patch (1.3 kB) - added by ChristianK on 05/03/09 07:53:46.
Here's a patch against asm-x86-32. It passes the revised dstress tests. Are there any other asm opcodes that need this treatment?

Change History

04/27/09 06:50:06 changed by lindquist

Actually I don't think we did, we simply translate fdiv to fdiv and fdivr to fdivr, however, as far as I can tell, at least with my assembler:

GNU assembler (GNU Binutils) 2.19.1.20090205
This assembler was configured for a target of `x86_64-unknown-linux-gnu'.

It looks like fdiv ST(1), ST; which we translate into fdiv %st, %st(1); ie. just like all the other instructions, just reverse src/dst params. But in this case, to actually get dc f9, we need to output fdivr %st, %st(1); , so both src/dst swap and the r suffix is needed.

As noted from the DMD ticket (and in there the ML post): This happens with all the non-commutative arithmetic floating point operations with two register operands, where the source register is %st, and destination register is %st(i)

05/03/09 07:53:46 changed by ChristianK

  • attachment fdivfsubreverse.patch added.

Here's a patch against asm-x86-32. It passes the revised dstress tests. Are there any other asm opcodes that need this treatment?

05/06/09 16:15:00 changed by ChristianK

  • status changed from new to closed.
  • resolution set to fixed.

Applied in [1302].

Copyright © 2008, LDC Development Team.