http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56200



             Bug #: 56200

           Summary: queens benchmark is faster with -O0 than with any

                    other optimization level

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: target

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: a...@gcc.gnu.org

                CC: amona...@gcc.gnu.org

            Target: x86_64-unknown-linux-gnu





Created attachment 29346

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29346

queens benchmark



While preparing some teaching slides I have noticed that the queens benchmark

from Aburto generates slower code with -O1/O2/O3 than with plain -O0.  I've

removed all timing routines from the attached file, compile and run it with

./a.out 30.



For 4.7.1 of OpenSUSE 12.2, we have:



$ time ./o0 30 >/dev/null

user    0m10.017s



$ time ./o1 30 >/dev/null

user    0m11.824s



$ time ./o2 30 >/dev/null

user    0m10.388s



$ time ./o3 30 >/dev/null  //this one is with -march=native

user    0m11.065s



For today's 4.8, 



$ time ./o048 30 >/dev/null

user    0m9.780s



$ time ./o148 30 >/dev/null

user    0m12.590s



$ time ./o248 30 >/dev/null //this one is with -march=native

user    0m10.487s



$ time ./o348 30 >/dev/null //this one is with -march=native

user    0m10.850s



Perf shows that in the -O1 versions of above we have the new lea that has a lot

of counter hits and lots more of branch mispredictions.

Reply via email to