| Issue |
180338
|
| Summary |
[LoongArch] Wrong code at -O1 -mlsx
|
| Labels |
miscompilation,
backend:loongarch,
generated by fuzzer
|
| Assignees |
|
| Reporter |
XChy
|
Reduced testcase:
```c
#include <stdint.h>
#include <stdio.h>
#include <lsxintrin.h>
#define BS_VEC(type, num) type __attribute__((vector_size(num * sizeof(type))))
#define BARRIER_v2u64(x) ((BS_VEC(uint64_t, 2))__lsx_vadd_d((__m128i)x, (__m128i){}))
BS_VEC(uint16_t, 2) backsmith_snippet_822(BS_VEC(uint32_t, 4) BS_ARG_1)
{
uint32_t BS_TEMP_0 = BS_ARG_1[2];
BS_ARG_1 -= (BS_VEC(uint32_t, 4)){ BS_TEMP_0, 0, BS_TEMP_0 };
return __builtin_convertvector(
__builtin_shufflevector(BS_ARG_1, BS_ARG_1, 0, 2), BS_VEC(uint16_t, 2));
}
int main()
{
BS_VEC(uint64_t, 2)
vec = BARRIER_v2u64((BS_VEC(uint64_t, 2)){ 8067293510808050 });
BS_VEC(uint16_t, 2)
BS_TEMP_4 = backsmith_snippet_822(__builtin_convertvector(
__builtin_shufflevector(vec, vec, 0, 0, 3, 3), BS_VEC(uint32_t, 4)));
uint64_t BS_CHECKSUM = BS_TEMP_4[0];
printf("BackSmith Checksum = 0x%016llx\n", BS_CHECKSUM);
}
```
Commands:
qemu-loongarch64 version 10.1.2
```bash
> clang --target=loongarch64-unknown-linux-musl -mlsx -O0 -static a.c
> qemu-loongarch64 a.out
BackSmith Checksum = 0x000000000000b1f2
> clang --target=loongarch64-unknown-linux-musl -mlsx -O1 -static a.c
> qemu-loongarch64 a.out
BackSmith Checksum = 0x0000000000000000
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs