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

    <tr>
        <th>Summary</th>
        <td>
            ARM SIMD backend bug in llvm >= 18
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          K-os
      </td>
    </tr>
</table>

<pre>
    When building [VVenC](fraunhoferhhi/vvenc) for ARMv7 with Clang-18 or 19 a backend bug was discovered (fraunhoferhhi/vvenc#560). The issue appeared when building with the Android NDK, but I was able to reproduce it using Clang-19 from the apt.llvm.org repository. Building the same code with Clang-17 worked without issues. Our code uses SIMD-Everywhere to translate x86 intrinsics to ARM-NEON.

This is the error message when compiling the attached reduced test-case:
[FGA_sse41-8b87a7.reduced.tar.gz](https://github.com/user-attachments/files/20795950/FGA_sse41-8b87a7.reduced.tar.gz)
```
fatal error: error in backend: Cannot select: 0x5f7772a16230: v4f32 = froundeven 0x5f7772a162a0
  0x5f7772a162a0: v4f32 = bitcast 0x5f7772a160e0
 0x5f7772a160e0: v2f64,ch = load<(dereferenceable load (s128) from @simde_mm_cvtps_epi32_a_, align 8, !tbaa !3)> 0x5f777298b608, 0x5f7772a16380, undef:i32
      0x5f7772a16380: i32,ch = load<(load (s32) from got)> 0x5f777298b608, 0x5f7772a16310, undef:i32
        0x5f7772a16310: i32 = ARMISD::WrapperPIC TargetGlobalAddress:i32<ptr @simde_mm_cvtps_epi32_a_> 0 [TF=8]
          0x5f7772a161c0: i32 = TargetGlobalAddress<ptr @simde_mm_cvtps_epi32_a_> 0 [TF=8]
        0x5f7772a16150: i32 = undef
 0x5f7772a16150: i32 = undef
In function: _Z20simde_mm_cvtps_epi32v
```

The archive also contains the LLVM bytecode in the file reduced.bc, which shows the issue.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVU1v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