[LLVMbugs] [Bug 18603] New: clang -O3 does not produce best blend code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 24 09:39:57 PST 2014


            Bug ID: 18603
           Summary: clang -O3 does not produce best blend code
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: jn at sirrida.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

-O3 seems to assume an out of order architecture (GCC does not).
A better assumption would be in order architecture;
IMHO -O3 ought to produce the "best blend" which runs on all processors.
If e.g. -march=atom is given the in order architecture is assumed.

int test(int x) {
  return ((x>>2) & 15) ^ ((x>>3) & 31);
=> clang -O3
    movl    %edi, %eax
    shrl    $2, %eax
    andl    $15, %eax  //
    shrl    $3, %edi   // exchange
    andl    $31, %edi
    xorl    %eax, %edi
    movl    %edi, %eax
=> clang -O3 -march=atom
    movl    %edi, %eax
    shrl    $3, %edi
    shrl    $2, %eax
    andl    $31, %edi
    andl    $15, %eax
    xorl    %eax, %edi
    movl    %edi, %eax

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140124/58f4233a/attachment.html>

More information about the llvm-bugs mailing list