https://bugs.llvm.org/show_bug.cgi?id=45314

            Bug ID: 45314
           Summary: Redundant vmov{q,d} before 32-bit splat
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

The following code:

```
#include <immintrin.h>

__m256i broadcast(const __m256i x) {
    return _mm256_set_epi32(x[0], x[0], x[0], x[0], x[0], x[0], x[0], x[0]);
}
```

is compiled to:

```
broadcast:                              # @broadcast
        vmovq   rax, xmm0
        vmovd   xmm0, eax
        vpbroadcastd    ymm0, xmm0
        ret
```

These two vmov operations are redundant.

GCC already omits these operations:

```
broadcast:
        vpbroadcastd    ymm0, xmm0
        ret
```

Godbolt link: https://c.godbolt.org/z/bkVDWj

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to