This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Asm: Support for DUP (immediate) instructions.
ClosedPublic

Authored by sdesmalen on May 24 2018, 12:14 AM.

Details

Summary

Unpredicated copy of optionally-shifted immediate to SVE vector,
along with MOV-aliases.

This patch contains parsing and printing support for
cpy_imm8_opt_lsl_(i8|i16|i32|i64). This operand allows a signed value in
the range -128 to +127. For element widths of 16 bits or higher it may
also be a signed multiple of 256 in the range -32768 to +32512.
For element-width of 8 bits a range of -128 to 255 is accepted, since a copy
of a byte can be considered either signed/unsigned.

Note: This patch renames tryParseAddSubImm() -> tryParseImmWithOptionalShift()
and moves the behaviour of trying to shift a plain immediate by an allowed
shift-value to its addImmWithOptionalShiftOperands() method, so that the
parsing itself is generic and allows immediates from multiple shifted operands.
This is done because an immediate can be divisible by both shifted operands.

Diff Detail

Repository
rL LLVM

Event Timeline

sdesmalen created this revision.May 24 2018, 12:14 AM
fhahn added inline comments.May 24 2018, 2:01 AM
lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
638 ↗(On Diff #148343)

You should be able to use return {} to return a None value and return { Val, Width } to return a value? I think that way the logic could be slightly simplified here.

2368 ↗(On Diff #148343)

Unneeded ()

lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
772 ↗(On Diff #148343)

no () needed here?

lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp
516 ↗(On Diff #148343)

any reason we are not using a fixed width type here, like the other getXXX functions around here?

sdesmalen updated this revision to Diff 148367.May 24 2018, 3:56 AM
sdesmalen marked 3 inline comments as done.
  • Some simplifications (such as getShiftedVal())
  • Moved a change from patch D47310 (in isAddSubImm()) into this patch to resolve a failing test that would otherwise be solved by D47310, related to checking whether a value is a shifted value.
sdesmalen marked an inline comment as done.May 24 2018, 3:57 AM
fhahn accepted this revision.May 24 2018, 6:41 AM

LGTM, thanks

This revision is now accepted and ready to land.May 24 2018, 6:41 AM
This revision was automatically updated to reflect the committed changes.