[PATCH] D152351: [clang] Add __builtin_isfpclass
Serge Pavlov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 7 04:20:40 PDT 2023
sepavloff added a comment.
In D152351#4402615 <https://reviews.llvm.org/D152351#4402615>, @qiucf wrote:
> It's necessary to check range of first argument in `SemaChecking.cpp` using `SemaBuiltinConstantArgRange`.
>
> _Bool check_isfpclass_1(float x) { return __builtin_isfpclass(123456, x); } // ICE
>
> int g;
> // error: cannot compile this builtin function yet
> // there's better diagnostics when 1st argument is not constant
> _Bool check_isfpclass_2(float x) { return __builtin_isfpclass(g, x); }
Added the check and a test for it. Thanks!
================
Comment at: clang/include/clang/Basic/Builtins.def:491
BUILTIN(__builtin_isnormal, "i.", "FnctE")
+BUILTIN(__builtin_isfpclass, "iCi.", "nctE")
----------------
qiucf wrote:
> Why these intrinsics' type spec end with dot? I thought they are for vaargs.
It is a hack to have polymorphic builtin function. The argument `.` represents one argument but it can be of any type. So no need to have separate functions for every type.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152351/new/
https://reviews.llvm.org/D152351
More information about the cfe-commits
mailing list