Skip to content

[X86-backend]LLVM regression: bitcast from i64 to x86_mmx type causes error in the current LLVM version but functions as expected in LLVM 19.1.0 and earlier #115806

Closed
@DigOrDog

Description

@DigOrDog

Description

In the latest LLVM version, an attempt to bitcast from i64 to x86_mmx type in the IR code triggers an error that did not occur in LLVM 19.0 or any previous versions.

The following example demonstrates the problem:

@G = global i64 -9223372036854775808

define i64 @test49(i64 %arg, i64 %x, i64 %y) {
  %cond = icmp eq i64 %arg, %x
  %cond1 = icmp eq i64 %arg, %y
  %xmmx = bitcast i64 %x to x86_mmx
  %ymmx = bitcast i64 %y to x86_mmx
  %slct = select i1 %cond, x86_mmx %xmmx, x86_mmx %ymmx
  %psll = tail call x86_mmx @llvm.x86.mmx.psll.w(x86_mmx %slct, x86_mmx %slct)
  %retc = bitcast x86_mmx %psll to i64
  ret i64 %retc
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare x86_mmx @llvm.x86.mmx.psll.w(x86_mmx, x86_mmx) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

In LLVM 19.0 and earlier, this code successfully compiles, but in the current version, it throws a type error. This regression impacts code bases relying on x86_mmx operations and should be addressed for backward compatibility.

https://godbolt.org/z/q7oKz9nd1

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:X86questionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions