[llvm-bugs] [Bug 31144] New: [ppc] Convert char/short to double through memory

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 23 13:31:18 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31144

            Bug ID: 31144
           Summary: [ppc] Convert char/short to double through memory
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: carrot at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Compile following code with options  -m64 -O2

extern void bar(double);
void foo(char* p)
{
  bar(*p);
}

void foo1(unsigned short* p)
{
  bar(*p);
}


LLVM generates:

.Lfunc_lep0:
        .localentry     foo, .Lfunc_lep0-.Lfunc_gep0
# BB#0:                                 # %entry
        mflr 0
        std 31, -8(1)
        std 0, 16(1)
        stdu 1, -112(1)
        lbz 3, 0(3)                  // load original value
        mr 31, 1
        addi 4, 31, 100 
        stw 3, 100(31)               // store
        ori 2, 2, 0
        lxsiwzx 0, 0, 4              // load
        xscvuxddp 1, 0
        bl bar 
        nop
        addi 1, 1, 112 
        ld 0, 16(1)
        ld 31, -8(1)
        mtlr 0
        blr


Note that lxsiwzx is immediately following stw, they access the same memory, it
is very slow. Instruction mtvsrwz can be used to move a value from integer
register to VSX register directly.

-- 
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/20161123/0a884ed6/attachment.html>


More information about the llvm-bugs mailing list