public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/108642] New: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 @ 2023-02-02 16:57 david.spickett at linaro dot org 2023-02-02 17:04 ` [Bug target/108642] ACLE function __arm_wsr missing " pinskia at gcc dot gnu.org ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: david.spickett at linaro dot org @ 2023-02-02 16:57 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108642 Bug ID: 108642 Summary: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: david.spickett at linaro dot org Target Milestone: --- This was found by a user trying to compile llvm's libc (which is largely written in c++) using g++ 8.5.0 for AArch64. I then tried versions up to 12.2.0 and a recent trunk build. https://godbolt.org/z/qxaYxdTcv, and I've copied the details below. The following source: ``` #include <stdint.h> #include <arm_acle.h> void writeStatusWord(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); } ``` When compiled with g++ gives the error: ``` <source>:4:39: error: '__arm_wsr' was not declared in this scope 4 | void writeStatusWord(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); } | ^~~~~~~~~ ``` When compiled as C, there is instead a warning and it does compile: ``` <source>:4:39: warning: implicit declaration of function '__arm_wsr' [-Wimplicit-function-declaration] 4 | void writeStatusWord(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); } | ^~~~~~~~~ ``` The expected result would be that in either mode, we can compile without errors or warnings. This __arm_wsr function should be present after including arm_acle.h according to https://github.com/ARM-software/acle/releases/tag/r2022Q4 (acle-2022Q4.pdf ). See "11.1 Special register intrinsics". I looked in the arm_acle.h gcc/g++ is including and see no reference to it. Which makes me wonder if it's a compiler builtin that somehow isn't present for C++. Over in clang there is a builtin for it, that is then #defined into the __arm_wsr name in the header. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/108642] ACLE function __arm_wsr missing for AArch64 2023-02-02 16:57 [Bug c++/108642] New: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 david.spickett at linaro dot org @ 2023-02-02 17:04 ` pinskia at gcc dot gnu.org 2023-02-02 17:06 ` pinskia at gcc dot gnu.org ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-02-02 17:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108642 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-02-02 Target| |aarch64-linux-gnu Summary|ACLE function __arm_wsr |ACLE function __arm_wsr |missing when compiling in |missing for AArch64 |C++ mode for AArch64 | Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- They are not implemented at all for either C or C++. Confirmed. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/108642] ACLE function __arm_wsr missing for AArch64 2023-02-02 16:57 [Bug c++/108642] New: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 david.spickett at linaro dot org 2023-02-02 17:04 ` [Bug target/108642] ACLE function __arm_wsr missing " pinskia at gcc dot gnu.org @ 2023-02-02 17:06 ` pinskia at gcc dot gnu.org 2023-02-02 17:07 ` pinskia at gcc dot gnu.org ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-02-02 17:06 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108642 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note the ACLE does not require "fpsr" to be supported either only "o0:op1:CRn:CRm:op2" format is listed there ... ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/108642] ACLE function __arm_wsr missing for AArch64 2023-02-02 16:57 [Bug c++/108642] New: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 david.spickett at linaro dot org 2023-02-02 17:04 ` [Bug target/108642] ACLE function __arm_wsr missing " pinskia at gcc dot gnu.org 2023-02-02 17:06 ` pinskia at gcc dot gnu.org @ 2023-02-02 17:07 ` pinskia at gcc dot gnu.org 2023-02-02 17:09 ` david.spickett at linaro dot org ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-02-02 17:07 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108642 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- GCC has a builtin already for getting fpsr already too: __builtin_aarch64_get_fpsr Which of course is not documented ... ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/108642] ACLE function __arm_wsr missing for AArch64 2023-02-02 16:57 [Bug c++/108642] New: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 david.spickett at linaro dot org ` (2 preceding siblings ...) 2023-02-02 17:07 ` pinskia at gcc dot gnu.org @ 2023-02-02 17:09 ` david.spickett at linaro dot org 2023-02-02 17:10 ` pinskia at gcc dot gnu.org 2023-02-03 16:25 ` david.spickett at linaro dot org 5 siblings, 0 replies; 7+ messages in thread From: david.spickett at linaro dot org @ 2023-02-02 17:09 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108642 --- Comment #4 from David Spickett <david.spickett at linaro dot org> --- Of course, I was just looking at at assembly output in compiler explorer and then locally I didn't link the object. That's why it seemed to work. Compiling and linking I get: $ ./bin/aarch64-none-linux-gnu-gcc /tmp/test.c -o /tmp/test.o /tmp/test.c: In function ‘writeStatusWord’: /tmp/test.c:4:39: warning: implicit declaration of function ‘__arm_wsr’ [-Wimplicit-function-declaration] 4 | void writeStatusWord(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); } | ^~~~~~~~~ <...>aarch64-none-linux-gnu/bin/ld: /tmp/ccLie8Sh.o: in function `writeStatusWord': test.c:(.text+0x18): undefined reference to `__arm_wsr' collect2: error: ld returned 1 exit status Which makes more sense. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/108642] ACLE function __arm_wsr missing for AArch64 2023-02-02 16:57 [Bug c++/108642] New: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 david.spickett at linaro dot org ` (3 preceding siblings ...) 2023-02-02 17:09 ` david.spickett at linaro dot org @ 2023-02-02 17:10 ` pinskia at gcc dot gnu.org 2023-02-03 16:25 ` david.spickett at linaro dot org 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-02-02 17:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108642 --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #3) > Which of course is not documented ... They are documented but not in a decent way: https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/AArch64-Built-in-Functions.html#AArch64-Built-in-Functions ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/108642] ACLE function __arm_wsr missing for AArch64 2023-02-02 16:57 [Bug c++/108642] New: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 david.spickett at linaro dot org ` (4 preceding siblings ...) 2023-02-02 17:10 ` pinskia at gcc dot gnu.org @ 2023-02-03 16:25 ` david.spickett at linaro dot org 5 siblings, 0 replies; 7+ messages in thread From: david.spickett at linaro dot org @ 2023-02-03 16:25 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108642 --- Comment #6 from David Spickett <david.spickett at linaro dot org> --- Thanks for the link, we'll try to use those when we detect g++. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-02-03 16:25 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-02-02 16:57 [Bug c++/108642] New: ACLE function __arm_wsr missing when compiling in C++ mode for AArch64 david.spickett at linaro dot org 2023-02-02 17:04 ` [Bug target/108642] ACLE function __arm_wsr missing " pinskia at gcc dot gnu.org 2023-02-02 17:06 ` pinskia at gcc dot gnu.org 2023-02-02 17:07 ` pinskia at gcc dot gnu.org 2023-02-02 17:09 ` david.spickett at linaro dot org 2023-02-02 17:10 ` pinskia at gcc dot gnu.org 2023-02-03 16:25 ` david.spickett at linaro dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).