Skip to content
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

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/lib/Frontend/InitPreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.


// Define a __POINTER_WIDTH__ macro for stdint.h.
Builder.defineMacro("__POINTER_WIDTH__",
Expand Down
15 changes: 15 additions & 0 deletions clang/test/Preprocessor/init-x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,21 @@
// X86_64-LINUX:#define __DBL_MIN_EXP__ (-1021)
// X86_64-LINUX:#define __DBL_MIN__ 2.2250738585072014e-308
// X86_64-LINUX:#define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
// X86_64-LINUX:#define __FLOAT128__ 1
// X86_64-LINUX:#define __FLT128_DECIMAL_DIG__ 36
// X86_64-LINUX:#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966Q
// X86_64-LINUX:#define __FLT128_DIG__ 33
// X86_64-LINUX:#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34Q
// X86_64-LINUX:#define __FLT128_HAS_DENORM__ 1
// X86_64-LINUX:#define __FLT128_HAS_INFINITY__ 1
// X86_64-LINUX:#define __FLT128_HAS_QUIET_NAN__ 1
// X86_64-LINUX:#define __FLT128_MANT_DIG__ 113
// X86_64-LINUX:#define __FLT128_MAX_10_EXP__ 4932
// X86_64-LINUX:#define __FLT128_MAX_EXP__ 16384
// X86_64-LINUX:#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932Q
// X86_64-LINUX:#define __FLT128_MIN_10_EXP__ (-4931)
// X86_64-LINUX:#define __FLT128_MIN_EXP__ (-16381)
// X86_64-LINUX:#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932Q
// X86_64-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F
// X86_64-LINUX:#define __FLT_DIG__ 6
// X86_64-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F
Expand Down
14 changes: 14 additions & 0 deletions clang/test/Preprocessor/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,20 @@
// EMSCRIPTEN-NEXT:#define __EMSCRIPTEN__ 1
// WEBASSEMBLY-NEXT:#define __FINITE_MATH_ONLY__ 0
// WEBASSEMBLY-NEXT:#define __FLOAT128__ 1
// WEBASSEMBLY-NEXT:#define __FLT128_DECIMAL_DIG__ 36
// WEBASSEMBLY-NEXT:#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966Q
// WEBASSEMBLY-NEXT:#define __FLT128_DIG__ 33
// WEBASSEMBLY-NEXT:#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34Q
// WEBASSEMBLY-NEXT:#define __FLT128_HAS_DENORM__ 1
// WEBASSEMBLY-NEXT:#define __FLT128_HAS_INFINITY__ 1
// WEBASSEMBLY-NEXT:#define __FLT128_HAS_QUIET_NAN__ 1
// WEBASSEMBLY-NEXT:#define __FLT128_MANT_DIG__ 113
// WEBASSEMBLY-NEXT:#define __FLT128_MAX_10_EXP__ 4932
// WEBASSEMBLY-NEXT:#define __FLT128_MAX_EXP__ 16384
// WEBASSEMBLY-NEXT:#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932Q
// WEBASSEMBLY-NEXT:#define __FLT128_MIN_10_EXP__ (-4931)
// WEBASSEMBLY-NEXT:#define __FLT128_MIN_EXP__ (-16381)
// WEBASSEMBLY-NEXT:#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932Q
// WEBASSEMBLY-NOT:#define __FLT16_DECIMAL_DIG__
// WEBASSEMBLY-NOT:#define __FLT16_DENORM_MIN__
// WEBASSEMBLY-NOT:#define __FLT16_DIG__
Expand Down