[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-28 Thread Timm Bäder via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGc2273e33bd13: [clang][Interp] Implement __builtin_nan family (authored by tbaeder). Changed prior to commit: https://reviews.llvm.org/D155356?vs=5

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-26 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 544435. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155356/new/ https://reviews.llvm.org/D155356 Files: clang/lib/AST/Interp/InterpBuiltin.cpp clang/test/AST/Interp/builtin-functions.cpp Index: clang/test/AST/Interp/builtin-functions.cpp =

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-26 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/builtin-functions.cpp:53 + constexpr char f[] = {'0', 'x', 'A', 'E', '\0'}; + constexpr double NaN6 = __builtin_nan(f); // ref-error {{must be initialized by a constant expression}} + aaron.ballm

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-26 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LG! Comment at: clang/test/AST/Interp/builtin-functions.cpp:53 + constexpr char f[] = {'0', 'x', 'A', 'E', '\0'}; + constexpr double NaN6 = __builtin_nan(f);

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-26 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/builtin-functions.cpp:53 + constexpr char f[] = {'0', 'x', 'A', 'E', '\0'}; + constexpr double NaN6 = __builtin_nan(f); // ref-error {{must be initialized by a constant expression}} + aaron.ballm

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-26 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/AST/Interp/builtin-functions.cpp:45 + /// The current interpreter does not accept this, but it should. + constexpr float NaN2 = __builtin_nans([](){return "0xAE98";}()); // ref-error {{must be initialized by a constan

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-26 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 544258. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155356/new/ https://reviews.llvm.org/D155356 Files: clang/lib/AST/Interp/InterpBuiltin.cpp clang/test/AST/Interp/builtin-functions.cpp Index: clang/test/AST/Interp/builtin-functions.cpp =

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D155356#4513303 , @tbaeder wrote: > One thing I'm wondering though is: > > constexpr char A[] = {'1', '2', '3'}; > constexpr double d = __builtin_nans(A); > > what's expected here? The given char array is not null-ter

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-18 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. One thing I'm wondering though is: constexpr char A[] = {'1', '2', '3'}; constexpr double d = __builtin_nans(A); what's expected here? The given char array is not null-terminated. Should the interpreter ignore the null byte at the end if it's there? `StringRef::get

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-18 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 541833. tbaeder marked an inline comment as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155356/new/ https://reviews.llvm.org/D155356 Files: clang/lib/AST/Interp/InterpBuiltin.cpp clang/test/AST/Interp/builtin-functions.cpp Index: clang/t

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-18 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder marked 2 inline comments as done. tbaeder added inline comments. Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:106 +// 2008 revisions, MIPS interpreted sNaN-2008 as qNan and qNaN-2008 as +// sNaN. This is now known as "legacy NaN" encoding. +if (Signaling

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-18 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 541832. tbaeder marked 3 inline comments as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155356/new/ https://reviews.llvm.org/D155356 Files: clang/lib/AST/Interp/InterpBuiltin.cpp clang/test/AST/Interp/builtin-functions.cpp Index: clang/t

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/AST/Interp/builtin-functions.cpp:44 + + constexpr float Nan2 = __builtin_nans([](){return "0xAE98";}()); // ref-error {{must be initialized by a constant expression}} +} tbaeder wrote: > aaron.ballman

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-18 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/builtin-functions.cpp:44 + + constexpr float Nan2 = __builtin_nans([](){return "0xAE98";}()); // ref-error {{must be initialized by a constant expression}} +} aaron.ballman wrote: > Probably worth

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:88 + else if (StringRef(Str).getAsInteger(0, Fill)) +return false; + Please add test coverage for a case like `__builtin_nan("derp")` to show it's not a valid constant e

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-17 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 541318. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155356/new/ https://reviews.llvm.org/D155356 Files: clang/lib/AST/Interp/InterpBuiltin.cpp clang/test/AST/Interp/builtin-functions.cpp Index: clang/test/AST/Interp/builtin-functions.cpp =

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-17 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 541314. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155356/new/ https://reviews.llvm.org/D155356 Files: clang/lib/AST/Interp/InterpBuiltin.cpp clang/test/AST/Interp/builtin-functions.cpp Index: clang/test/AST/Interp/builtin-functions.cpp =

[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

2023-07-14 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, shafik, cor3ntin. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. One existing problem is that we can't do much with the