Issue 184251
Summary Miscompilation of `VCVT{T}P{H,S}2I{U}BS` intrinsics
Labels new issue
Assignees
Reporter sayantn
    Intrinsics such as `_mm_ipcvts_ph_epi8` have different output depending on optimization level. As typical, the `O0` output is correct, while the `O3` output seems to be completely wrong.

Concretely, consider the example

`experiment.c`
```C
#include<immintrin.h>
#include<stdio.h>
#include<math.h>
#include<stdint.h>

int main() {
    __m128h a = _mm_setr_ph(1.0, -2.5, 127.0, 128.0, 255.0, -128.0, 0.0, NAN);

    __m128i r = _mm_ipcvtts_ph_epi8(a);

    uint16_t array[8];
    _mm_storeu_si128((__m128i*) array, r);

    for (int i = 0; i < 8; ++i) {
        printf("%d\n", (int8_t) array[i]);
 }
}
```

<img width="811" height="609" alt="Image" src="" />

The versions are as follows
`clang --version`
```
ClangBuiltLinux clang version 22.1.0 (https://github.com/llvm/llvm-project.git 4434dabb69916856b824f68a64b029c67175e532)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/schak/Documents/llvm-22.1.0-x86_64/bin
```
`gcc --version`
```
gcc (GCC) 15.2.1 20260209
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
`sde64 --version`
```
Intel(R) Software Development Emulator.  Version:  10.5.0 external (0)
Copyright (C) 2008-2026, Intel Corporation. All rights reserved.
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to