This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][ISel] Remove the commutative flag on SUB
ClosedPublic

Authored by qcolombet on Sep 26 2022, 9:51 PM.

Details

Summary

I wasn't able to produce a testcase for that because right now VWSUB is only generated from VWSUB_W and to trigger the commutative bug we would need to turn that VWSUB_W into VWSUB while having the splat value on the LHS, which is currently not matched by the existing combine.

Presumably we could hit this issue directly with vwsub intrinsics, but I didn't know how to produce a splat value for a vscale type and I don't know if it is possible to use the intrinsic without the vscale type.

Diff Detail

Event Timeline

qcolombet created this revision.Sep 26 2022, 9:51 PM
qcolombet requested review of this revision.Sep 26 2022, 9:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 26 2022, 9:51 PM
craig.topper accepted this revision.Sep 26 2022, 10:01 PM

The vwsub intrinsic doesn't go through RISCVISD::VWSUB_VL/VWSUBU_VL. It's pattern matched separately in RISCVInstrInfoVPseudos.td

vscale splat is insertelement into element 0 followed by shufflevector with zeroinitializer for the mask.

LGTM

This revision is now accepted and ready to land.Sep 26 2022, 10:01 PM

Thanks @craig.topper for the details!

This revision was landed with ongoing or failed builds.Sep 27 2022, 1:15 PM
This revision was automatically updated to reflect the committed changes.