[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-31 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Sema/constant-builtins-ilogb.cpp:1 +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics hubert.reinterpretcast wrote: > aaron.ballman wrote: > > hubert.reinterpretcast wrote: > > >

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-31 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments. Comment at: clang/test/Sema/constant-builtins-ilogb.cpp:1 +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics aaron.ballman wrote: > hubert.reinterpretcast wrote: > > There seems to be no C

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-31 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Sema/constant-builtins-ilogb.cpp:1 +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics hubert.reinterpretcast wrote: > There seems to be no C language test in the patch (although

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-30 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast requested changes to this revision. hubert.reinterpretcast added inline comments. This revision now requires changes to proceed. Comment at: clang/lib/AST/ExprConstant.cpp:12452 +int Ilogb; +if (APFloat::opStatus St = ilogb(F, Ilogb);

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-27 Thread Joshua Cranmer via Phabricator via cfe-commits
jcranmer-intel added inline comments. Comment at: clang/test/Sema/constant-builtins-ilogb.cpp:53-63 +// assert smallest subnormal and largest finite numbers +static_assert(__builtin_ilogbf(1.40129846E-45f) == -149); +static_assert(__builtin_ilogbf(3.40282347E+38f) == 127); +

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-27 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:12452 +int Ilogb; +if (APFloat::opStatus St = ilogb(F, Ilogb); !isConstantOpStatus(St)) + return false; hubert.reinterpretcast wrote: > hubert.reinterpretcast wrote: > >

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-27 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:12452 +int Ilogb; +if (APFloat::opStatus St = ilogb(F, Ilogb); !isConstantOpStatus(St)) + return false; hubert.reinterpretcast wrote: > hubert.reinterpretcast

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-27 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:12452 +int Ilogb; +if (APFloat::opStatus St = ilogb(F, Ilogb); !isConstantOpStatus(St)) + return false; hubert.reinterpretcast wrote: > Izaron wrote: > >

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-27 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:12452 +int Ilogb; +if (APFloat::opStatus St = ilogb(F, Ilogb); !isConstantOpStatus(St)) + return false; Izaron wrote: > majnemer wrote: > > Izaron wrote: > > >

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-27 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:12452 +int Ilogb; +if (APFloat::opStatus St = ilogb(F, Ilogb); !isConstantOpStatus(St)) + return false; majnemer wrote: > Izaron wrote: > > jcranmer-intel wrote: > > > Izaron

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-27 Thread David Majnemer via Phabricator via cfe-commits
majnemer added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:12452 +int Ilogb; +if (APFloat::opStatus St = ilogb(F, Ilogb); !isConstantOpStatus(St)) + return false; Izaron wrote: > jcranmer-intel wrote: > > Izaron wrote: > > >

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-27 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 471101. Izaron added a comment. Deal with MSVC where sizeof(long double) == sizeof(double) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136568/new/ https://reviews.llvm.org/D136568 Files:

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-26 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron marked 2 inline comments as done. Izaron added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:12452 +int Ilogb; +if (APFloat::opStatus St = ilogb(F, Ilogb); !isConstantOpStatus(St)) + return false; jcranmer-intel wrote: > Izaron

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-26 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron updated this revision to Diff 470962. Izaron added a comment. Add test for min/max value. Fix comment for ilog. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136568/new/ https://reviews.llvm.org/D136568 Files:

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-26 Thread Joshua Cranmer via Phabricator via cfe-commits
jcranmer-intel added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:12452 +int Ilogb; +if (APFloat::opStatus St = ilogb(F, Ilogb); !isConstantOpStatus(St)) + return false; Izaron wrote: > aaron.ballman wrote: > > jcranmer-intel wrote: >

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-26 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:12452 +int Ilogb; +if (APFloat::opStatus St = ilogb(F, Ilogb); !isConstantOpStatus(St)) + return false; aaron.ballman wrote: > jcranmer-intel wrote: > > `long double` is

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-26 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a subscriber: hubert.reinterpretcast. aaron.ballman added a comment. In D136568#3880711 , @jcranmer-intel wrote: > FWIW, I would be slightly wary of relying on cppreference as definitive for > niche semantic issues like this,

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-24 Thread Joshua Cranmer via Phabricator via cfe-commits
jcranmer-intel added a comment. In D136568#3878104 , @Izaron wrote: > The online documentation > (https://en.cppreference.com/w/cpp/numeric/math/ilogb) says: > > 1. If the correct result is greater than INT_MAX or smaller than INT_MIN, > FE_INVALID

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-23 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment. This patch is similar to `__bultin_fmax`: https://reviews.llvm.org/D134369 The constexpr version of ilogb matches the libc realization, this is verified with the same tests: https://github.com/llvm/llvm-project/blob/main/libc/test/src/math/ILogbTest.h

[PATCH] D136568: [Clang] Support constexpr builtin ilogb

2022-10-23 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision. Izaron added reviewers: jcranmer-intel, aaron.ballman, cor3ntin, efriedma. Herald added a subscriber: hiraditya. Herald added a project: All. Izaron requested review of this revision. Herald added projects: clang, LLVM. Herald added subscribers: llvm-commits,