This is an archive of the discontinued LLVM Phabricator instance.

[ARM][AArch64] Add feature +fp16fml
ClosedPublic

Authored by SjoerdMeijer on Aug 3 2018, 1:46 AM.

Details

Summary

Armv8.4-A adds a few FP16 instructions that can optionally be implemented
in CPUs of Armv8.2-A and above.

This patch adds a feature to clang to permit selection of these
instructions. This interacts with the +fp16 option as follows:

Prior to Armv8.4-A:
*) +fp16fml implies +fp16
*) +nofp16 implies +nofp16fml

From Armv8.4-A:
*) The above conditions apply, additionally: +fp16 implies +fp16fml

Diff Detail

Repository
rC Clang

Event Timeline

bogden created this revision.Aug 3 2018, 1:46 AM

Hello Eli -- Sjoerd pointed out that you had concerns about this sort of command-line manipulation in his patch D50179. I'm having to do something similar here to deal with +fp16fml being implied by +fp16 from v8.4-A, but implying +fp16 prior to that.

The intent that this is a temporary workaround to permit use of this feature, until the TargetParser becomes capable of expressing this kind of thing. Is it acceptable to commit on this basis?

Thanks

Do you expect that the regression tests will be affected by the TargetParser fixes? If not, I guess this is okay... but please add clear comments explaining which bits of code you expect to go away after the TargetParser rewrite.

(I am now picking this up, and will try to progress this patch and also D50179)

Do you expect that the regression tests will be affected by the TargetParser fixes?

No, and that's exactly the reason why it would be nice to get this in. The tests won't change, they show the expected behaviour, and thus we have a sort of "baseline implementation" while we are working on the new options framework.

And just repeating what I said in the other ticket, this option handling implementation is far from ideal and pretty, it's very easy to agree on that. This is a low maintenance patch, so very easy to keep downstream for us, but it would be useful to have it on trunk too perhaps.

I will add comments and a FIXME that we expect a full reimplementation of it.

Ah, and just for your info, the proposal was just sent to the dev list:
http://lists.llvm.org/pipermail/llvm-dev/2018-September/126346.html

SjoerdMeijer commandeered this revision.Sep 21 2018, 3:42 AM
SjoerdMeijer edited reviewers, added: bogden; removed: SjoerdMeijer.
SjoerdMeijer retitled this revision from +fp16fml feature for ARM and AArch64 to [ARM][AArch64] Add feature +fp16fml.
SjoerdMeijer edited the summary of this revision. (Show Details)

Added FIXMEs.

This revision is now accepted and ready to land.Sep 21 2018, 11:08 AM
This revision was automatically updated to reflect the committed changes.
fpetrogalli added inline comments.
test/Driver/aarch64-cpus.c
518

Hi @SjoerdMeijer , I have noticed that this test does something different from what gcc does (well, claims to do, I haven't checked the actual behavior on gcc).

From the table in [1], it seems that armv8.4-a implies fp16fml... who got it right? GCC or clang? Or am I missing something?

Francesco

[1] https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html#AArch64-Options (see the description of -march=name)

SjoerdMeijer marked an inline comment as done.Jul 2 2020, 9:30 AM
SjoerdMeijer added inline comments.
test/Driver/aarch64-cpus.c
518

I think the ARMARM is pretty clear on this. Copied from one of the instruction descriptions enabled by fp16ml:

"In Armv8.2 and Armv8.3, this is an OPTIONAL instruction. From Armv8.4 it is mandatory for all implementations to support it."

So, looks like this needs fixing.