[PATCH] D155372: [clang][Interp] Implement __builtin_isfinite

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 07:22:36 PDT 2023


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:194
+
+  S.Stk.push<Integral<32, true>>(Integral<32, true>::from(Arg.isFinite()));
+  return true;
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > We have platforms on which the width of an integer is not 32-bits; because this is pushing values back onto the stack, won't we run into some odd issues where `builtin + 1` would be adding a 32-bit and a 16-bit value?
> Yes, you don't even need to add anything for it to fail. I can add a way of doing that in a follow-up commit. And/or add an assertion now.
> 
> Also, what platform would that be? So I can add a test later.
AVR and MSP430 both use 16-bit int, I don't know of anyone using 8-bit currently. You can search for `IntWidth =` to see the choices made by various targets (default is 32-bit though).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155372/new/

https://reviews.llvm.org/D155372



More information about the cfe-commits mailing list