Issue 176880
Summary [X86] Failure to fold input shuffle into pclmulqdq instruction
Labels backend:X86, missed-optimization
Assignees RKSimon
Reporter RKSimon
    ```ll
define <2 x i64> @test_shuffle_pclmulqdq_v2i64(<2 x i64> %a0, <2 x i64> %a1) {
 %s0 = shufflevector <2 x i64> %a0, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
  %s1 = shufflevector <2 x i64> %a1, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
  %clmul = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> %s0, <2 x i64> %s1, i8 1)
  ret <2 x i64> %clmul
}
```
llc -mcpu=tigerlake
```asm
test_shuffle_pclmulqdq_v2i64:           # @test_shuffle_pclmulqdq_v2i64
        vpbroadcastq    %xmm0, %xmm0
 vpshufd $78, %xmm1, %xmm1               # xmm1 = xmm1[2,3,0,1]
 vpclmulqdq      $1, %xmm1, %xmm0, %xmm0
        retq
```
This should fold to:
```asm
test_shuffle_pclmulqdq_v2i64:           # @test_shuffle_pclmulqdq_v2i64
  vpclmulqdq $16, %xmm1, %xmm0, %xmm0
 retq
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to