-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang][ARM] Ensure FPU Features are parsed when targeting cc1as
#134612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a5b81d2
[Clang] [ARM] Ensure FPU Features are collected when using the Clang …
Stylie777 e6e916f
Respond to review comments originally from #134366
Stylie777 7861b31
Respond to review comments
Stylie777 ecefc66
Fix spelling in Release Notes
Stylie777 0e88318
Improve release notes based on review comments.
Stylie777 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// REQUIRES: arm-registered-target | ||
/// Ensures that when targeting an ARM target with an Asm file, clang | ||
/// collects the features from the FPU. This is critical in the | ||
/// activation of NEON for supported targets. The Cortex-R52 will be | ||
/// used and tested for VFP and NEON Support | ||
|
||
// RUN: %clang -target arm-none-eabi -mcpu=cortex-r52 -c %s -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK-STDERR %s --allow-empty | ||
// RUN: %clang -target arm-none-eabi -mcpu=cortex-r52 -c %s -o /dev/null -### 2>&1 | FileCheck --check-prefix=CHECK-TARGET-FEATURES %s | ||
DavidSpickett marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Check that no errors or warnings are present when assembling using cc1as. | ||
// CHECK-STDERR-NOT: error: | ||
// CHECK-STDERR-NOT: warning: | ||
|
||
/// Check that NEON and VFPV5 have been activated when using Cortex-R52 when using cc1as | ||
// CHECK-TARGET-FEATURES: "-target-feature" "+vfp2sp" | ||
// CHECK-TARGET-FEATURES: "-target-feature" "+vfp3" | ||
// CHECK-TARGET-FEATURES: "-target-feature" "+fp-armv8" | ||
// CHECK-TARGET-FEATURES: "-target-feature" "+fp-armv8d16" | ||
// CHECK-TARGET-FEATURES: "-target-feature" "+fp-armv8d16sp" | ||
// CHECK-TARGET-FEATURES: "-target-feature" "+fp-armv8sp" | ||
// CHECK-TARGET-FEATURES: "-target-feature" "+neon" | ||
|
||
vadd.f32 s0, s1, s2 | ||
vadd.f64 d0, d1, d2 | ||
vcvt.u32.f32 s0, s0, #1 | ||
vcvt.u32.f64 d0, d0, #1 | ||
vcvtb.f32.f16 s0, s1 | ||
vcvtb.f64.f16 d0, s1 | ||
vfma.f32 s0, s1, s2 | ||
vfma.f64 d0, d1, d2 | ||
vcvta.u32.f32 s0, s1 | ||
vcvta.u32.f64 s0, d1 | ||
vadd.f32 q0, q1, q2 | ||
vcvt.f32.f16 q0, d1 | ||
vfma.f32 q0, q1, q2 | ||
vcvta.u32.f32 q0, q1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/// Ensure that we can assemble NEON by just specifying an armv7 | ||
/// Apple or Windows target. | ||
|
||
// REQUIRES: arm-registered-target | ||
// RUN: %clang -c -target armv7-apple-darwin -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-STDERR %s --allow-empty | ||
// RUN: %clang -c -target armv7-apple-darwin -o /dev/null %s -### 2>&1 | FileCheck --check-prefix=CHECK-TARGET-FEATURES %s | ||
// RUN: %clang -c -target armv7-windows -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-STDERR %s --allow-empty | ||
// RUN: %clang -c -target armv7-windows -o /dev/null %s -### 2>&1 | FileCheck --check-prefix=CHECK-TARGET-FEATURES %s | ||
|
||
/// Check that no errors or warnings are present when assembling using cc1as. | ||
// CHECK-STDERR-NOT: error: | ||
// CHECK-STDERR-NOT: warning: | ||
|
||
// CHECK-TARGET-FEATURES: "-target-feature" "+neon" | ||
|
||
vadd.i32 q0, q0, q0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/// Ensure that we can assemble VFPv4 by just specifying an armv7s target. | ||
|
||
// REQUIRES: arm-registered-target | ||
// RUN: %clang -c -target armv7s-apple-darwin -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-STDERR %s --allow-empty | ||
// RUN: %clang -c -target armv7s-apple-darwin -o /dev/null %s -### 2>&1 | FileCheck --check-prefix=CHECK-TARGET-FEATURES %s | ||
|
||
/// Check that no errors or warnings are present when assembling using cc1as. | ||
// CHECK-STDERR-NOT: error: | ||
// CHECK-STDERR-NOT: warning: | ||
|
||
// CHECK-TARGET-FEATURES: "-target-feature" "+vfp4" | ||
|
||
vfma.f32 q1, q2, q3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the isOSWindows || isOSDarwin if still needed and does it solve the issues reported for darwin?
If the point of this code is to work around an upstream patch in ubuntu, I'm wondering if that is better to address in the upstream ubuntu patch. Otherwise we get into a tug of war between their patch and the one here, which doesn't sound like the best solution. getARMCPUForArch already has some cpu overrides for different OS's.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are somewhat still needed in order to keep things working for that patched case, yes.
It's indeed a bit odd to avoid breakage for an out-of-tree downstream patch that isn't present here, this was discussed in #122095, but there @DavidSpickett agreed that it seems good to be explicit about these things - just like for the Android case just above here.
The problem with adjusting the downstream patch is that it is for Debian/Ubuntu packaging, adjusting what is included in the armv7 baseline (for the purposes of Linux targets), but affecting how useful it is as a cross compiler for other targets. But for them to take extra effort into their Linux-targeting patch to accommodate for using it for cross compilation for other OSes feels like a big thing to request anyway (even though it is their patch which is breaking things).
Yeah, that would be possible as well. Windows does have one, and thanks to this patch it gets applied on both assembly and C. Darwin doesn't, but it should be possible to pick e.g. a
cortex-a8
as baseline there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ubuntu includes other GCC cross-compiling toolchains in the packages they put out, so might be interested in allowing the cross-compiler to work for llvm if their patch can be adjusted. AFAIU they only want their change to apply to native linux compiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's definitely the intent of it - but making it work that way definitely is less obvious than one would want...