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: unassignedb...@nondot.org
          Reporter: d...@dsprenkels.com
                CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
                    llvm-...@redking.me.uk, spatel+l...@rotateright.com

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
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to