Skip to content

likely arm64 miscompile #55201

@regehr

Description

@regehr

ok this has been llvm-reduced but it's still a bit complex, sorry!

define i32 @f(i32 %x) {
  %or1 = or i32 %x, 1
  %sh1 = shl i32 %or1, 5
  %sh2 = lshr i32 %x, 27
  %1 = and i32 %sh2, 1
  %r = or i32 %sh1, %1
  ret i32 %r
}

we believe that f(0xf0000000) -> 32 and that is what we get when using global isel, and also when compiling this code for x64.

on the other hand, the default arm64 backend from top of tree gives f(0xf0000000) -> 62

we don't think there's any UB going on here, seems like a straight-up miscompile

cc @ornata @nunoplopes @ryan-berger @nbushehri @aqjune @Hatsunespica

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions