This is an archive of the discontinued LLVM Phabricator instance.

[ARM,MVE] Support -ve offsets in gather-load intrinsics.
ClosedPublic

Authored by simon_tatham on Jan 6 2020, 6:59 AM.

Details

Summary

The ACLE intrinsics with gather_base or scatter_base in the name
are wrappers on the MVE load/store instructions that take a vector of
base addresses and an immediate offset. The immediate offset can be up
to 127 times the alignment unit, and it can be positive or negative.

At the MC layer, we got that right. But in the Sema error checking for
the wrapping intrinsics, the offset was erroneously constrained to be
positive.

To fix this I've adjusted the imm_mem7bit class in the Tablegen that
defines the intrinsics. But that causes integer literals like
0xfffffffffffffe04 to appear in the autogenerated calls to
SemaBuiltinConstantArgRange, which provokes a compiler warning
because that's out of the non-overflowing range of an int64_t. So
I've also tweaked MveEmitter to emit that as -0x1fc instead.

Updated the tests of the Sema checks themselves, and also adjusted a
random sample of the CodeGen tests to actually use negative offsets
and prove they get all the way through code generation without causing
a crash.

Event Timeline

simon_tatham created this revision.Jan 6 2020, 6:59 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 6 2020, 6:59 AM
dmgreen accepted this revision.Jan 6 2020, 8:32 AM

LGTM.

This revision is now accepted and ready to land.Jan 6 2020, 8:32 AM
This revision was automatically updated to reflect the committed changes.