[PATCH] D119618: [RISCV] Fix incorrect extend type in vwmulsu combine.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 11 22:31:57 PST 2022
craig.topper created this revision.
craig.topper added reviewers: frasercrmck, Chenbing.Zheng, benshi001, arcbbb.
Herald added subscribers: VincentWu, luke957, achieveartificialintelligence, vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.
If while matching widening multiply, we matched an extend from i8->i32,
i16->i64 or i8->i64 we need to reintroduce a narrower extend. If we're
matching a vwmulsu we need to use a sext for op0 and a zext for op1.
This bug exists in LLVM 14 and will need to be backported.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D119618
Files:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vwmulsu.ll
Index: llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vwmulsu.ll
===================================================================
--- llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vwmulsu.ll
+++ llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vwmulsu.ll
@@ -375,7 +375,7 @@
; CHECK-NEXT: vle8.v v8, (a0)
; CHECK-NEXT: vle8.v v9, (a1)
; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
-; CHECK-NEXT: vsext.vf2 v10, v8
+; CHECK-NEXT: vzext.vf2 v10, v8
; CHECK-NEXT: vsext.vf2 v11, v9
; CHECK-NEXT: vwmulsu.vv v8, v11, v10
; CHECK-NEXT: ret
@@ -394,7 +394,7 @@
; CHECK-NEXT: vle8.v v8, (a0)
; CHECK-NEXT: vle16.v v9, (a1)
; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
-; CHECK-NEXT: vsext.vf2 v10, v8
+; CHECK-NEXT: vzext.vf2 v10, v8
; CHECK-NEXT: vwmulsu.vv v8, v9, v10
; CHECK-NEXT: ret
%a = load <4 x i8>, <4 x i8>* %x
Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -7805,6 +7805,7 @@
unsigned ExtOpc = IsSignExt ? RISCVISD::VSEXT_VL : RISCVISD::VZEXT_VL;
if (Op0.getValueType() != NarrowVT)
Op0 = DAG.getNode(ExtOpc, DL, NarrowVT, Op0, Mask, VL);
+ ExtOpc = (IsSignExt && !IsVWMULSU) ? RISCVISD::VSEXT_VL : RISCVISD::VZEXT_VL;
if (Op1.getValueType() != NarrowVT)
Op1 = DAG.getNode(ExtOpc, DL, NarrowVT, Op1, Mask, VL);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119618.408151.patch
Type: text/x-patch
Size: 1466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220212/e9142465/attachment.bin>
More information about the llvm-commits
mailing list