-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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] Predefined macros for float128 support #67196
Conversation
@llvm/pr-subscribers-clang ChangesExpose some predefined macros for Float128 support. Full diff: https://github.com/llvm/llvm-project/pull/67196.diff 1 Files Affected:
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index e5db8a654e6707d..9e4d4d398a21da5 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -1076,6 +1076,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
DefineFloatMacros(Builder, "FLT", &TI.getFloatFormat(), "F");
DefineFloatMacros(Builder, "DBL", &TI.getDoubleFormat(), "");
DefineFloatMacros(Builder, "LDBL", &TI.getLongDoubleFormat(), "L");
+ if (TI.hasFloat128Type())
+ DefineFloatMacros(Builder, "FLT128", &TI.getFloat128Format(), "Q");
// Define a __POINTER_WIDTH__ macro for stdint.h.
Builder.defineMacro("__POINTER_WIDTH__",
|
@@ -1076,6 +1076,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI, | |||
DefineFloatMacros(Builder, "FLT", &TI.getFloatFormat(), "F"); | |||
DefineFloatMacros(Builder, "DBL", &TI.getDoubleFormat(), ""); | |||
DefineFloatMacros(Builder, "LDBL", &TI.getLongDoubleFormat(), "L"); | |||
if (TI.hasFloat128Type()) | |||
DefineFloatMacros(Builder, "FLT128", &TI.getFloat128Format(), "Q"); |
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.
This needs tests (see e.g. https://reviews.llvm.org/D111382, https://github.com/llvm/llvm-project/blob/main/clang/test/Preprocessor)
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 am not adding any new float type or any literal suffix (unlike other revision you pointed by Ray). This is only adding float macros for which I modified the test that was expecting 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.
In general this looks good. Since we don't have full compiler-rt support for this yet we may want to wait until that to merge. Alex is already looking at this and coordinating with his needs is probably the best solution.
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.
LG
Expose some predefined macros for Float128 support.