Bug 86423

Summary: Omnetpp is slower on PowerPC using -ffast-math than not using -ffast-math
Product: gcc Reporter: Michael Meissner <meissner>
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED WORKSFORME    
Severity: normal CC: bill.schmidt, dje, meissner, segher
Priority: P3 Keywords: missed-optimization
Version: 9.0   
Target Milestone: ---   
Host: Target: powerpc
Build: Known to work:
Known to fail: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 26163    

Description Michael Meissner 2018-07-06 16:53:37 UTC
I did some Spec 2006 runs, and one of the runs I was comparing normal speed with -ffast-math.  As expected a lot of SpecFP benchmarks were faster using the -ffast-math option.  However, 3 of the benchmarks were slower, including omnetpp.

In particular, cMessageHeap::shiftup(int) [clone .part.16], which is the hotest function took 2,442,614 cycles when compiled with -ffast-math, and 2,378,917 cycles when compiled without -ffast-math.

Looking at the profile within the function, we see:

The C++ name is cMessageHeap::shiftup(int) [clone .part.16].

Percent   Percent   |  Samples   Samples   |  Line #  Filename   
slowmath  fastmath  |  slowmath  fastmath  |  Line #  Filename   
--------  --------  |  --------  --------  |  ------  -----------
39.3521%  40.3151%  |   936,158   984,740  |     198  cmsgheap.cc
17.4123%  10.5189%  |   414,223   256,938  |     200  cmsgheap.cc
 4.6070%  16.3806%  |   109,595   400,114  |      43  cmsgheap.cc
14.2110%  14.2290%  |   338,071   347,561  |     199  cmsgheap.cc
 9.0102%   7.1333%  |   214,345   174,237  |      45  cmsgheap.cc
 7.4063%   1.8450%  |   176,191    45,066  |      44  cmsgheap.cc
 3.4912%   4.9701%  |    83,054   121,401  |     196  cmsgheap.cc
 2.3383%   2.3092%  |    55,627    56,405  |     204  cmsgheap.cc
 2.1165%   2.2862%  |    50,347    55,841  |      46  cmsgheap.cc
Comment 1 Bill Schmidt 2018-11-15 19:08:19 UTC
No longer repeatable -- please reopen if it recurs in future.