-
Notifications
You must be signed in to change notification settings - Fork 0
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
英雄帖: Support #pragma GCC target
in GCC
#82
Comments
cc @xry111 (you may bring in the Loongson folks for discussion, I have forgotten how to at-mention them) |
The pragma is already implemented in https://gcc.gnu.org/r15-7093. |
Oh that's nice to know! (I haven't reached that mail in my backlog yet, sad me) |
I have looked at https://gcc.gnu.org/r15-7093 but unfortunately it doesn't seem to include handling of preprocessor symbols. |
We should have this feature implemented in GCC, complete with automatic insertion/deletion of respective preprocessor macros.
Example:
Exact details of the target option string is up to the Hero picking up this 英雄帖, but discussion and broad community consensus is expected before anything is to be upstreamed.
Background
When building Skia currently there are some warnings when building with
-mlasx
(or equivalent, such as-march=la464
) in CFLAGS:While the direct cause is that the
SkOpts_SetTarget.h
is lacking a#pragma GCC push_options
, ultimately it is because GCC lacks#pragma GCC target()
support for LoongArch. When this patch is applied to Skia:We instead get:
Which brings us to this issue.
In fact: even if
__loongarch_asx
is manually defined, it's not enough for GCC to allow LASX usage, because the LASX builtins' availability is not gated on the presence of the symbol. If one builds with-mlsx -mno-lasx
errors will be raised:So it's a really important feature for any code that wants to provide multiple optimized codepaths AND without complicated CFLAGS manipulation and/or forced splitting into different compilation units.
The text was updated successfully, but these errors were encountered: