This is to fix PR31620. MaxAtomicPromoteWidth and MaxAtomicInlineWidth are set to 128 for x86_64. However, for target without cx16 support, 128 atomic operation will generate __sync_* libcalls. The patch set MaxAtomicPromoteWidth and MaxAtomicInlineWidth to 64 if the target doesn't support cx16.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I would rather just fix clang (in lib/Basic/Targets/X86.cpp) to fix the bug, then handle the backend changes from D18201 together.
Needs testcase.
lib/Basic/Targets/X86.h | ||
---|---|---|
898 | I don't think we need to mess with MaxAtomicPromoteWidth? Probably more intuitive to check "if (hasFeature" rather than "if (!hasFeature". Adding a dedicated hook for this seems a bit overkill, but I don't have a better suggestion. |
lib/Basic/Targets/X86.h | ||
---|---|---|
898 | If 128 bits inline atomic is not supported, what is the point to promote atomic type to 128 bits? |
lib/Basic/Targets/X86.h | ||
---|---|---|
898 | MaxAtomicPromoteWidth affects the ABI, so it can't vary based on the target CPU. |
lib/Basic/Targets/X86.h | ||
---|---|---|
898 | That make senses. Thanks for the explanation. |
I don't think we need to mess with MaxAtomicPromoteWidth?
Probably more intuitive to check "if (hasFeature" rather than "if (!hasFeature".
Adding a dedicated hook for this seems a bit overkill, but I don't have a better suggestion.