[LLVMbugs] [Bug 16439] New: shl by 0 produces the wrong result for i128 on 32bit systems

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 24 23:48:04 PDT 2013


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

            Bug ID: 16439
           Summary: shl by 0 produces the wrong result for i128 on 32bit
                    systems
           Product: libraries
           Version: 3.2
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: kfischer at college.harvard.edu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider the following LLVM IR

```
define i128 @julia_foo2599(i32) {
top:
  %1 = shl i32 %0, 4
  %2 = zext i32 %1 to i128
  %3 = shl i128 1, %2
  %4 = icmp ugt i32 %1, 127
  %5 = select i1 %4, i128 0, i128 %3
  ret i128 %5
}
define i32 @main() {
top:
  %0 = call i128 @julia_foo2599(i32 0)
  %1 = lshr i128 %0, 64
  %2 = trunc i128 %1 to i32
  ret i32 %2
}

```

Running this in lli, the return code is 1 instead of 0. The actual issue if the
first shl which instead of producing 0x00000000000000000000000000000001
produces 0x00000000000000010000000000000001. This happens of 3.2 as well as on
3.3.

-- 
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/20130625/7fa2eccb/attachment.html>


More information about the llvm-bugs mailing list