This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Asm: Fix supported immediates for DUP/CPY
ClosedPublic

Authored by sdesmalen on Jan 15 2021, 6:42 AM.

Details

Summary

This patch fixes an issue in the implementation of DUP/CPY where certain
immediates were not accepted. Immediates should be interpreted as a two's
complement encoding of a value that fits the number of bits of the element
type.

     mov z0.b, p0/z, #127
<=>  mov z0.b, p0/z, #-129
<=>  mov z0.b, p0/z, #0xffffffffffffff7f

This behaviour is in line with the GNU assembler.

Diff Detail

Event Timeline

sdesmalen created this revision.Jan 15 2021, 6:42 AM
sdesmalen requested review of this revision.Jan 15 2021, 6:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 15 2021, 6:42 AM
c-rhodes added inline comments.Feb 1 2021, 10:00 AM
llvm/test/MC/AArch64/SVE/dup-diagnostics.s
26

Do we want to update the ranges in the diagnostics? [-255, 255] here for instance.

llvm/test/MC/AArch64/SVE/mov.s
422

missing test for .d?

Matt added a subscriber: Matt.Feb 3 2021, 5:52 AM
sdesmalen updated this revision to Diff 322490.Feb 9 2021, 1:43 PM
sdesmalen marked an inline comment as done.

added test for .d.

llvm/test/MC/AArch64/SVE/dup-diagnostics.s
26

I'm not sure that's desirable, because it's not that -255 is really accepted as value -255, it's rather that #-255 is interpreted as #1 (i.e. an 8-bit value cannot represent -255). Now the accepted range is a signed byte value -128..127, or an unsigned byte value 0..255, together being -128..255.

c-rhodes accepted this revision.Feb 10 2021, 2:52 AM
c-rhodes added inline comments.
llvm/test/MC/AArch64/SVE/dup-diagnostics.s
26

I'm not sure that's desirable, because it's not that -255 is really accepted as value -255, it's rather that #-255 is interpreted as #1 (i.e. an 8-bit value cannot represent -255). Now the accepted range is a signed byte value -128..127, or an unsigned byte value 0..255, together being -128..255.

Ah, so for values in the range -255..-129 they're interpreted as unsigned byte values negated. Thanks for clarifying.

This revision is now accepted and ready to land.Feb 10 2021, 2:52 AM