[PATCH] D112932: [WIP] Use llvm.is_fpclass to implement FP classification functions

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 1 08:31:25 PDT 2021


sepavloff created this revision.
sepavloff requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Builtin floating-point number classification functions:

- __builtin_isnan,
- __builtin_isinf,
- __builtin_finite, and
- __builtin_isnormal

now are implemented using `llvm.is_fpclass`. New builtin functions were
added:

- __builtin_issubnormal,
- __builtin_iszero, and
- __builtin_issignaling.

They represent corresponding standard C library finctions and are also
implemented using `llvm.is_fpclass`.
The hook `testFPKind` from `TargetInfo` is removed.

New builting function `__builtin_isfpclass` is added. It is called as:

  __builtin_isfpclass(<test>, <floating point value>)

and returns integer value, which is non-zero if the floating point
argument belongs to one of the classes specified by the first argument,
and zero otherwise. The first argument is an integer value, where each
value class is represented by one bit. There are ten data classes, as
defined by the IEEE-754 standard.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112932

Files:
  clang/include/clang/Basic/Builtins.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/CodeGen/TargetInfo.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112932.383808.patch
Type: text/x-patch
Size: 13374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211101/012c562a/attachment-0001.bin>


More information about the cfe-commits mailing list