-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[Clang] __has_builtin should return false for aux triple builtins #121839
base: main
Are you sure you want to change the base?
Changes from 1 commit
9973733
55c6d06
3ce5111
69198ca
ef1b0ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// REQUIRES: spirv-registered-target | ||
// REQUIRES: x86-registered-target | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These shouldn't be necessary, we're just emitting IR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in 3ce5111, thx |
||
// RUN: %clang_cc1 -fopenmp -triple=spirv64 -fopenmp-is-target-device \ | ||
// RUN: -aux-triple x86_64-linux-unknown -E %s | FileCheck -implicit-check-not=BAD %s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add lines for other targets. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hopefully addressed in 3ce5111, thx |
||
|
||
// CHECK: GOOD | ||
#if __has_builtin(__builtin_ia32_pause) | ||
BAD | ||
#else | ||
GOOD | ||
#endif |
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.
Why do we need this extra logic? I figured it would simply be if the builtin is only in the aux target, then we return false.
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.
If you mean why isn't the check just
if (getBuiltinInfo().isAuxBuiltinID(BuiltinID))
, it's because doing that breakstest/Headers/__cpuidex_conflict.c
(the lastRUN
line in the test).That test has x86 for both the default and aux target, but the builtin the test cares about is MSVC only and the default target env isn't MSVC, so that builtin is considered unsupported and not registered, but the aux target is MSVC, so it is registered and
isAuxBuiltinID
returns true, and then returning false in__has_builtin
breaks the test.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.
That seems like some weird behavior, since it's just going to end up with the GNU environment emitting an MSVC builtin. Maybe @boomanaiden154 can chime in on whether or not that's intended behavior.
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.
I'm assuming this is related to the openmp test in
__cpuidex_conflict.c
? I believe that is related to the following comment from @AaronBallman in https://reviews.llvm.org/D150646:The test is intended to make sure that the
__cpuidex
definiton fromcpuid.h
isn't used (and thus doesn't conflct) with the MSVC builtin definition. I'm not really familiar enough with OpenMP to tell if I set up the test correctly, and it could very well be the test that needs to be adjusted.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.
Sorry for the late response.
My interpretation of Aaron's comment seems like he expects the behavior we see today (aux triple builtins enabled on offloading targets), thus making the OpenMP offloading part of the
cpuid
LIT test correct.@AaronBallman Do you mind clarifying what you think should happen here? Sorry, your comment was from a while back.
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.
@boomanaiden154 If we break the aux triple use part of the test, do you expect it to affect actual users or could we just XFAIL it and proceed with this change (assuming everyone agrees the proposed behavior is correct) and fix it 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.
I wouldn't expect the aux triple part of the test to break any actual users, so that should be fine. Nothing in
cpuid.h
makes sense to use on an offloading target and I wouldn't really expect anyone to have done so.Then again, I wouldn't have expected people to include
cpuid.h
when compiling for windows, but I can see that being a vastly more popular configuration than somehow trying to use MS builtins on code that gets offloaded.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.
Thanks, are you okay with me disabling that part of the test and leaving it to you to figure out the correct guard when you have time?
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.
Should work for me. Can you add a
TODO(boomanaiden154)
as a comment when you disable it?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.
Sure, thanks!