Skip to content

Commit f09a8c3

Browse files
committed
[MIPS][MSA] Invert operand order of ILVOD when lowering VECTOR_SHUFFLE
The result was <y[1], x[1]> while it should be <x[1], y[1]>. This affects the result of vector shuffles: %result = shufflevector <4 x i32> %x, <4 x i32> %y, <4 x 132> <i32 1, i32 5, i32 3, i32 7> The mask above matches the pattern wanted by the ILVOD lowering. The result is <%y[1], %x[1], %y[3], %x[3]>, while it should be <%x[1], %y[1], %x[3], %y[3]>. * tests/CodeGen/Mips: Update MSA shuffle tests according to the change.
1 parent 34d5072 commit f09a8c3

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

llvm/lib/Target/Mips/MipsSEISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2736,7 +2736,7 @@ static SDValue lowerVECTOR_SHUFFLE_ILVOD(SDValue Op, EVT ResTy,
27362736
else
27372737
return SDValue();
27382738

2739-
return DAG.getNode(MipsISD::ILVOD, SDLoc(Op), ResTy, Wt, Ws);
2739+
return DAG.getNode(MipsISD::ILVOD, SDLoc(Op), ResTy, Ws, Wt);
27402740
}
27412741

27422742
// Lower VECTOR_SHUFFLE into ILVR (if possible).

llvm/test/CodeGen/Mips/msa/shuffle.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ define void @ilvod_v16i8_0(ptr %c, ptr %a, ptr %b) nounwind {
533533
; CHECK-DAG: ld.b [[R2:\$w[0-9]+]], 0($6)
534534
%3 = shufflevector <16 x i8> %1, <16 x i8> %2,
535535
<16 x i32> <i32 1, i32 17, i32 3, i32 19, i32 5, i32 21, i32 7, i32 23, i32 9, i32 25, i32 11, i32 27, i32 13, i32 29, i32 15, i32 31>
536-
; CHECK-DAG: ilvod.b [[R3:\$w[0-9]+]], [[R1]], [[R2]]
536+
; CHECK-DAG: ilvod.b [[R3:\$w[0-9]+]], [[R2]], [[R1]]
537537
store <16 x i8> %3, ptr %c
538538
; CHECK-DAG: st.b [[R3]], 0($4)
539539

@@ -548,7 +548,7 @@ define void @ilvod_v8i16_0(ptr %c, ptr %a, ptr %b) nounwind {
548548
%2 = load <8 x i16>, ptr %b
549549
; CHECK-DAG: ld.h [[R2:\$w[0-9]+]], 0($6)
550550
%3 = shufflevector <8 x i16> %1, <8 x i16> %2, <8 x i32> <i32 1, i32 9, i32 3, i32 11, i32 5, i32 13, i32 7, i32 15>
551-
; CHECK-DAG: ilvod.h [[R3:\$w[0-9]+]], [[R1]], [[R2]]
551+
; CHECK-DAG: ilvod.h [[R3:\$w[0-9]+]], [[R2]], [[R1]]
552552
store <8 x i16> %3, ptr %c
553553
; CHECK-DAG: st.h [[R3]], 0($4)
554554

@@ -563,7 +563,7 @@ define void @ilvod_v4i32_0(ptr %c, ptr %a, ptr %b) nounwind {
563563
%2 = load <4 x i32>, ptr %b
564564
; CHECK-DAG: ld.w [[R2:\$w[0-9]+]], 0($6)
565565
%3 = shufflevector <4 x i32> %1, <4 x i32> %2, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
566-
; CHECK-DAG: ilvod.w [[R3:\$w[0-9]+]], [[R1]], [[R2]]
566+
; CHECK-DAG: ilvod.w [[R3:\$w[0-9]+]], [[R2]], [[R1]]
567567
store <4 x i32> %3, ptr %c
568568
; CHECK-DAG: st.w [[R3]], 0($4)
569569

@@ -578,7 +578,7 @@ define void @ilvod_v2i64_0(ptr %c, ptr %a, ptr %b) nounwind {
578578
%2 = load <2 x i64>, ptr %b
579579
; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
580580
%3 = shufflevector <2 x i64> %1, <2 x i64> %2, <2 x i32> <i32 1, i32 3>
581-
; CHECK-DAG: ilvod.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
581+
; CHECK-DAG: ilvod.d [[R3:\$w[0-9]+]], [[R2]], [[R1]]
582582
store <2 x i64> %3, ptr %c
583583
; CHECK-DAG: st.d [[R3]], 0($4)
584584

@@ -934,7 +934,7 @@ define void @ilvl_v2i64_0(ptr %c, ptr %a, ptr %b) nounwind {
934934
; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
935935
%3 = shufflevector <2 x i64> %1, <2 x i64> %2, <2 x i32> <i32 1, i32 3>
936936
; ilvl.d and ilvod.d are equivalent for v2i64
937-
; CHECK-DAG: ilvod.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
937+
; CHECK-DAG: ilvod.d [[R3:\$w[0-9]+]], [[R2]], [[R1]]
938938
store <2 x i64> %3, ptr %c
939939
; CHECK-DAG: st.d [[R3]], 0($4)
940940

@@ -1290,7 +1290,7 @@ define void @pckod_v2i64_0(ptr %c, ptr %a, ptr %b) nounwind {
12901290
; CHECK-DAG: ld.d [[R2:\$w[0-9]+]], 0($6)
12911291
%3 = shufflevector <2 x i64> %1, <2 x i64> %2, <2 x i32> <i32 1, i32 3>
12921292
; pckod.d and ilvod.d are equivalent for v2i64
1293-
; CHECK-DAG: ilvod.d [[R3:\$w[0-9]+]], [[R1]], [[R2]]
1293+
; CHECK-DAG: ilvod.d [[R3:\$w[0-9]+]], [[R2]], [[R1]]
12941294
store <2 x i64> %3, ptr %c
12951295
; CHECK-DAG: st.d [[R3]], 0($4)
12961296

0 commit comments

Comments
 (0)