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
aarch64: -march=armv8-a produces armv8.2 'bfc' instruction #41921
Comments
assigned to @nickdesaulniers |
It's an alias so the underlying instruction exists in v8.0. Gating it on the architecture is weird. We might want to change how we print it when targeting < v8.2, but I'm pretty disinclined to diagnose an error in our own assembler. |
Orthogonal, Arnd, is there a config that sets that specific march flag?
Would be a bug in AsmPrinter? |
In LLVM terms, if the current behaviour is considered a bug, it would be fixed in what's called the "InstPrinter" in lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp. There's specific C++ code to detect and print "bfc", which could be modified to only do that when targeting v8.2a or above. How's that for a carefully hedged reply! |
I don't think so, I added that to the test case for clarification. If I remember correctly, the kernel is always built for armv8-a rather than a later version, to provide the best compatibility with existing CPUs (most of what is in production today is still armv8-a, not 8.1 or 8.2).
Makes sense. As I understand section A1.7.4 in the ARM ARM, an assembler is only required to understand bfc when targetting v8.2, but it is may choose to interpret it correctly anyway. |
Nicely put! I wish I'd thought of that when writing my reply. |
I see the bug is still present in clang-9 and clang-10, so I'm resending my workaround for the kernel. |
Tim, is this OK to merge to the release/9.x branch? |
I think so. |
(Reopening to track 9.0.1.) |
Merged: 62a16ca |
mentioned in issue #42705 |
changed the description |
Extended Description
Building arm64 linux randconfig kernels, I came across this assembler error:
https://godbolt.org/z/8Gcjl9 shows the 'bfc' instruction being generated, but not the error message as it is unable to call the external assembler correctly.
According to https://sourceware.org/ml/binutils/2015-11/msg00221.html, the 'bfc' instruction is only valid in armv8.2 or higher but llvm uses it for any armv8 version.
The text was updated successfully, but these errors were encountered: