Skip to content

Int128 bit shift issue #3596

@Keno

Description

@Keno

From #3447

int128(1)<<0

is broken.

Corresponding 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
}

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

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorupstreamThe issue is with an upstream dependency, e.g. LLVM

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions