[PATCH] D152351: [clang] Add __builtin_isfpclass
Aaron Ballman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 7 11:08:59 PDT 2023
aaron.ballman added a comment.
In D152351#4402785 <https://reviews.llvm.org/D152351#4402785>, @arsenm wrote:
> Also should get mentioned in the builtin docs and release notes
+1, also, should there be named constants for the mask values?
================
Comment at: clang/include/clang/Basic/Builtins.def:491
BUILTIN(__builtin_isnormal, "i.", "FnctE")
+BUILTIN(__builtin_isfpclass, "iCi.", "nctE")
----------------
`E` in the third arguments means it can be constant evaluated in the frontend, but I don't see any code or tests for that.
================
Comment at: clang/lib/Sema/SemaChecking.cpp:2776-2778
+ case Builtin::BI__builtin_isfpclass:
+ if (SemaBuiltinConstantArgRange(TheCall, 0, 0, llvm::fcAllFlags))
+ return ExprError();
----------------
Do we diagnose if the second argument to the call isn't a floating-point value? e.g., `__builtin_isfpclass(0x1, some_struct)`
================
Comment at: clang/test/Sema/builtins.c:384
+ return __builtin_isfpclass(1024, x); // expected-error {{argument value 1024 is outside the valid range [0, 1023]}}
+}
----------------
arsenm wrote:
> What happens if you pass complex?
What happens if you pass a non-float second argument, or a bit mask that doesn't match any of the valid values, or a bit mask that matches multiple valid values?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152351/new/
https://reviews.llvm.org/D152351
More information about the llvm-commits
mailing list