[LLVMbugs] [Bug 19107] select in thumb2 sign extends constants when it shouldn't

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 11 02:09:58 PDT 2014


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

Tilmann Scheller <t.scheller at samsung.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |t.scheller at samsung.com
         Resolution|---                         |WORKSFORME

--- Comment #2 from Tilmann Scheller <t.scheller at samsung.com> ---
Just tried this with trunk, getting the following machine code for the bad2
function:

bad2:
        .fnstart
.Leh_func_begin1:
@ BB#0:
        uxtb    r1, r1
        uxtb    r2, r0
        cmp     r2, r1
        it      hi
        mvnhi   r0, #127
        bx      lr

So indeed the 128 constant is sign extended, however this still matches the
semantics of the LLVM IR, so I don't think we have an actual bug here.

Since there are no 8-bit registers, i8 values effectively get promoted to i32.
In other words, the upper 24-bits of a promoted i8 value are undefined. That's
also why we need the two uxtb instructions in the beginning, since we need to
assume that the upper 24-bits of the incoming values are garbage.

-- 
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/20140611/5f832562/attachment.html>


More information about the llvm-bugs mailing list