<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/115806>115806</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [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
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          DigOrDog
      </td>
    </tr>
</table>

<pre>
    # 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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVV-L4zYQ_zTKy7DGlu3YefDDbUPK0SuFcpS-FVkaO2plySeNN_F9-iIlufVu6R8ohCSSfjPzm_8iBD1axI7Vz6w-7sRCZ-e7ox5_8kc37nqn1o7xEo4YpNczaWdZfmT5h48W6I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