http://llvm.org/bugs/show_bug.cgi?id=3206

           Summary: lack of select use (cmov)
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


On i386-apple-darwin, built with "llvmc -O3 -S select_reduced.c" with or
without -clang. At the end of each case should be a select/cmov.

inline __attribute__((always_inline))
unsigned short _OSSwapInt16(unsigned short _data)
{
    return ((_data << 8) | (_data >> 8));
}

inline __attribute__((always_inline))
unsigned short ReadSwapShort(unsigned char* data, unsigned int offset)
{
        return _OSSwapInt16(*(unsigned short*) &data[offset]);
}

unsigned short* myfunc(unsigned short* endCodes, unsigned short probe, unsigned
short entrySelector, unsigned short c)
{
    #define PROBE_SHIFT \
        {\
                probe >>= 1;\
                if (c > _OSSwapInt16(endCodes[probe >> 1]))\
                        endCodes = &endCodes[probe >> 1];\
        }       

        switch (entrySelector)
        {
                case 15:        PROBE_SHIFT;    // FALL-THRU
                case 14:        PROBE_SHIFT;    // FALL-THRU
                case 13:        PROBE_SHIFT;    // FALL-THRU
                case 12:        PROBE_SHIFT;    // FALL-THRU
                case 11:        PROBE_SHIFT;    // FALL-THRU
                case 10:        PROBE_SHIFT;    // FALL-THRU
                case  9:        PROBE_SHIFT;    // FALL-THRU
                case  8:        PROBE_SHIFT;    // FALL-THRU
                case  7:        PROBE_SHIFT;    // FALL-THRU
                case  6:        PROBE_SHIFT;    // FALL-THRU
                case  5:        PROBE_SHIFT;    // FALL-THRU
                case  4:        PROBE_SHIFT;    // FALL-THRU
        }

    return endCodes;    
}


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to