This is an archive of the discontinued LLVM Phabricator instance.

[Driver,ARM] Make -mfloat-abi=soft turn off MVE.
ClosedPublic

Authored by simon_tatham on Oct 16 2019, 2:36 AM.

Details

Summary

Since -mfloat-abi=soft is taken to mean turning off all uses of the
FP registers, it should turn off the MVE vector instructions as well
as NEON and scalar FP. But it wasn't doing so.

So the options -march=armv8.1-m.main+mve.fp+fp.dp -mfloat-abi=soft
would cause the underlying LLVM to not support MVE (because it
knows the real target feature relationships and turned off MVE when
the fpregs feature was removed), but the clang layer still thought
it was supported, and would misleadingly define the feature macro
__ARM_FEATURE_MVE.

The ARM driver code already has a long list of feature names to turn
off when -mfloat-abi=soft is selected. The fix is to add the missing
entries mve and mve.fp to that list.

Diff Detail

Event Timeline

simon_tatham created this revision.Oct 16 2019, 2:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 16 2019, 2:36 AM

I do not know this code super well. What happens to the preprocessor in such cases? Does it disable the relevant macros automatically because we've turned off the mve and mve.fp features?

Could you add a test?

Yes: this change is in the driver, and causes those features to be disabled on the command line to cc1, which responds by not defining __ARM_FEATURE_MVE.

So, as for adding a test ... the test I have added here ensures that this combination of driver options leads to -target-feature -mve and -mve.fp on the cc1 command line, and the existing test Preprocessor/arm-target-features.c checks that that in turn leads to __ARM_FEATURE_MVE not being defined.

A single end-to-end test that proves that these driver args lead to that preprocessor definition (or not) doesn't really have a place to live.

dmgreen accepted this revision.Oct 16 2019, 6:16 AM

Yeah, OK. That makes sense.

LGTM!

This revision is now accepted and ready to land.Oct 16 2019, 6:16 AM
This revision was automatically updated to reflect the committed changes.