This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/80402] New: Missed optimization on x86/x86_64


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80402

            Bug ID: 80402
           Summary: Missed optimization on x86/x86_64
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mednafen at sent dot com
  Target Milestone: ---
            Target: x86_64

Created attachment 41181
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41181&action=edit
sample code

A statement like "if(!(a & 0xF) || (b & (1U << 6)))" could be compiled to a
"test","bt" pair followed by a single conditional branch/move instruction, but
gcc currently compiles it to a combination of two tests and conditional
branch/move instructions.

From
https://software.intel.com/sites/default/files/managed/ad/01/253666-sdm-vol-2a.pdf
Page 3-114, BT: "The ZF flag is unaffected."

Old versions(prior to early 2010, as far as I can tell) of the manual had the
flag as being undefined, so it may be prudent to talk to Intel and AMD
engineers before implementing this optimization.

Attached is sample code that includes the optimal form via inline
assembly(test4() function).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]