This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Optimize fixed vector ABS. Fix crash on scalable vector ABS for SEW=64 with RV32.
ClosedPublic

Authored by craig.topper on Mar 4 2021, 4:46 PM.

Details

Summary

The default fixed vector expansion uses sra+xor+add since it can't
see that smax is legal due to our custom handling. So we select
smax(X, sub(0, X)) manually.

Scalable vectors are able to use the smax expansion automatically
for most cases. It crashes in one case because getConstant can't build a
SPLAT_VECTOR for nxvXi64 when i64 scalars aren't legal. So
we manually emit a SPLAT_VECTOR_I64 for that case.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 4 2021, 4:46 PM
craig.topper requested review of this revision.Mar 4 2021, 4:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2021, 4:46 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
This revision is now accepted and ready to land.Mar 9 2021, 1:39 AM
This revision was landed with ongoing or failed builds.Mar 9 2021, 8:58 AM
This revision was automatically updated to reflect the committed changes.