[llvm] [PowerPC] Fix vector_shuffle combines when inputs are scalar_to_vector of differing types. (PR #80784)

zhijian lin via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 12:03:43 PDT 2024


================
@@ -102,42 +102,42 @@ define <2 x i64> @test_none_v16i8(i8 %arg1, ptr nocapture noundef readonly %b) {
 ; CHECK-LE-P8-NEXT:    lxvd2x vs0, 0, r4
 ; CHECK-LE-P8-NEXT:    xxswapd v2, vs0
 ; CHECK-LE-P8-NEXT:    mtfprd f0, r3
-; CHECK-LE-P8-NEXT:    xxmrgld v2, vs0, v2
+; CHECK-LE-P8-NEXT:    xxpermdi v2, vs0, v2, 1
----------------
diggerlin wrote:

according to the IR.

```
 159 entry:
 160   %lhs.tmp = insertelement <16 x i8> undef, i8 %arg1, i32 0
 161   %lhs = bitcast <16 x i8> %lhs.tmp to <2 x i64>
 162   %rhs = load <2 x i64>, ptr %b, align 4
 163   %shuffle = shufflevector <2 x i64> %rhs, <2 x i64> %lhs, <2 x i32> <i32 0, i32 2>
 164   ret <2 x i64> %shuffle
 165 }
```
line 163 indicated that the  %shuffle consist from  first element of the first vector (%rhs[0]) and  the first element of the second vector (%lhs[0]).

Mask index 0 refers to the first element of the first vector (%rhs[0]).
Mask index 2 refers to the first element of the second vector (%lhs[0]).

it should be `CHECK-LE-P8-NEXT: xxpermdi v2, vs0, v2, 0`  or `xxmrgld v2, vs0, v2` , Do I understand error ?

https://github.com/llvm/llvm-project/pull/80784


More information about the llvm-commits mailing list