Ticket #7116 (new bug)

Opened 11 months ago

Last modified 9 months ago

Missing optimisation: strength reduction of floating-point multiplication

Reported by: simonmar Owned by: pcapriotti
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.4.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

e.g. x * 2.0 should turn into x + x. See #2253 (program 6) for an example.

Whether this is best done as a builtin RULE or in cmmMachOpFold, or possibly both, I don't know.

Attachments

7116.patch Download (4.8 KB) - added by pcapriotti 9 months ago.

Change History

Changed 9 months ago by pcapriotti

Changed 9 months ago by pcapriotti

I think this should be in PrelRules. Attached is a patch. Could it be done more generally?

Changed 9 months ago by simonmar

Looks good to me.

Changed 9 months ago by simonpj

  • owner set to pcapriotti

Paolo: yes, please commit your patch. But could you add a comment Note [Strength reduction] that explains how it works. In particular the "lit" is always 2, and the op is always (+); but at either Float or Double. Perhapas you can name the op parameter add_op? And lit can be two_lit. But the comment as well!

Thanks

Simon

Note: See TracTickets for help on using tickets.