This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Add <saturate> operand to SQRSHRL and UQRSHLL
ClosedPublic

Authored by miyuki on Jul 16 2019, 10:49 AM.

Details

Summary

According to the new Armv8-M specification
https://static.docs.arm.com/ddi0553/bh/DDI0553B_h_armv8m_arm.pdf the
instructions SQRSHRL and UQRSHLL now have an additional immediate
operand <saturate>. The new assembly syntax is:

SQRSHRL<c> RdaLo, RdaHi, #<saturate>, Rm
UQRSHLL<c> RdaLo, RdaHi, #<saturate>, Rm

where <saturate> can be either 64 (the existing behavior) or 48, in
that case the result is saturated to 48 bits.

The new operand is encoded as follows:

#64 Encoded as sat = 0
#48 Encoded as sat = 1

sat is bit 7 of the instruction bit pattern.

This patch adds a new assembler operand class MveSaturateOperand which
implements parsing and encoding. Decoding is implemented in
DecodeMVEOverlappingLongShift.

Diff Detail

Repository
rL LLVM

Event Timeline

miyuki created this revision.Jul 16 2019, 10:49 AM
simon_tatham added inline comments.Jul 19 2019, 1:24 AM
llvm/lib/Target/ARM/ARMInstrMVE.td
431 ↗(On Diff #210132)

This class seems almost identical to MVE_ScalarShiftDRegReg, differing only in the extra input operand, the different AsmString, and the introduction of bit sat; assigned to Inst{7}. They could be merged into a common superclass to avoid all that copy and paste?

miyuki updated this revision to Diff 210781.Jul 19 2019, 2:31 AM

Removed some redundancy.

miyuki marked an inline comment as done.Jul 19 2019, 2:31 AM
simon_tatham accepted this revision.Jul 19 2019, 2:40 AM
This revision is now accepted and ready to land.Jul 19 2019, 2:40 AM
This revision was automatically updated to reflect the committed changes.