This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Corrected FP16 Intrinsic range checks in Clang + added Sema tests
ClosedPublic

Authored by LukeGeeson on May 31 2018, 8:01 AM.

Details

Summary

This fixes the ranges for the vcvth family of FP16 intrinsics in the clang front end. Previously it was accepting incorrect ranges
-Changed builtin range checking in SemaChecking
-added tests SemaCheck changes - included in their own file since no similar one exists
-modified existing tests to reflect new ranges

Diff Detail

Repository
rL LLVM

Event Timeline

LukeGeeson created this revision.May 31 2018, 8:01 AM
SjoerdMeijer added inline comments.Jun 1 2018, 2:29 AM
test/Sema/aarch64-neon-fp16-ranges.c
1 ↗(On Diff #149295)

Nit: target feature fullfp16 implies ARMv8 FP, so I think you can remove +neon; just a tiny optimisation to make the command line shorter (same below).

39 ↗(On Diff #149295)

why is this is 'a' an int64_t? Should this not be float16_t?

SjoerdMeijer added inline comments.Jun 1 2018, 2:33 AM
lib/Sema/SemaChecking.cpp
1409 ↗(On Diff #149295)

Why do we need to remove this?

1462 ↗(On Diff #149295)

And also this one?

LukeGeeson updated this revision to Diff 149737.Jun 4 2018, 5:46 AM
LukeGeeson marked an inline comment as done.

-generates range checks in NEON Emitter rather than hardcoding in SemaChecking.cpp
-uses 'isVCVT_N' to correctly direct the emitter to generate the correct ranges.

LukeGeeson marked 2 inline comments as done.Jun 4 2018, 5:47 AM
LukeGeeson added inline comments.
lib/Sema/SemaChecking.cpp
1409 ↗(On Diff #149295)

We don't actually need this one, inspecting include/clang/Basic/arm_fp16.inc after building shows an empty set of #ifdefs pragmas - ie nothing is generated and hence nothing happens.
Will leave in for continuity, however this may be redundant

test/Sema/aarch64-neon-fp16-ranges.c
1 ↗(On Diff #149295)

That doesn't seem to work, removing neon introduces hundreds of errors around incompatible types (including things this diff doesn't change) which would suggest maybe neon doesn't cover everything?

39 ↗(On Diff #149295)

Agreed. Fixed.

SjoerdMeijer accepted this revision.Jun 4 2018, 9:06 AM

I think this looks ok now, just some nits inline.

Can you please upload your diffs with more context next time?

utils/TableGen/NeonEmitter.cpp
2166 ↗(On Diff #149737)

Nit: can you realign this?

2193 ↗(On Diff #149737)

Nit: for a moment I thought this could match more cases than intended, but we have already checked for isVCVT_N, so should be fine?

2194 ↗(On Diff #149737)

Nit: think you're (almost) repeating the comment above, so you can omit this one?

This revision is now accepted and ready to land.Jun 4 2018, 9:06 AM
This revision was automatically updated to reflect the committed changes.
LukeGeeson marked an inline comment as done.