This is an archive of the discontinued LLVM Phabricator instance.

[mips][msa] Range check MSA intrinsics with immediates
ClosedPublic

Authored by sdardis on Sep 28 2016, 5:49 AM.

Details

Summary

This patch teaches clang to range check immediates for MIPS MSA instrinsics. This
checking is done strictly in comparison to some existing GCC implementations.
E.g. msa_andvi_b(var, 257) does not result in andvi $wX, 1. Similarily
msa_ldi_b takes a range of -128 to 127.

As part of this effort, correct the existing MSA test as it has both illegal types and
immediates.

Diff Detail

Repository
rL LLVM

Event Timeline

sdardis updated this revision to Diff 72810.Sep 28 2016, 5:49 AM
sdardis retitled this revision from to [mips][msa] Range check MSA intrinsics with immediates.
sdardis updated this object.
sdardis added a subscriber: cfe-commits.
sdardis updated this object.Sep 28 2016, 5:50 AM
sdardis updated this revision to Diff 74499.Oct 13 2016, 5:07 AM

Update ld / st to respect their range and multiple of 16 constraint.

vkalintiris accepted this revision.Oct 18 2016, 4:24 AM
vkalintiris edited edge metadata.

LGTM. See inline comments for a few small changes.

The only issue I've found with test/CodeGen/builtins-mips-msa-error.c is that GCC checks strictly the signedness of the arguments passed to the builtins. Having a FIXME comment in order to make Clang follow the same behaviour in the future would be nice.

test/CodeGen/builtins-mips-msa-error.c
24–35 ↗(On Diff #74499)

We don't use the vxxxx_b vectors anywhere.

37–45 ↗(On Diff #74499)

We don't test anything with these. We can delete them along with the typedef above.

49 ↗(On Diff #74499)

Unused as well.

119 ↗(On Diff #74499)

The passed argument is in the valid value range.

308–311 ↗(On Diff #74499)

The passed argument is in the valid range of values.

This revision is now accepted and ready to land.Oct 18 2016, 4:24 AM
vkalintiris added inline comments.Oct 18 2016, 4:35 AM
lib/Sema/SemaChecking.cpp
1633–1637 ↗(On Diff #74499)

Also, can you fix the indentation here and check with clang-format for long lines in the code?

This revision was automatically updated to reflect the committed changes.