[PATCH] D152351: [clang] Add __builtin_isfpclass

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 7 02:09:40 PDT 2023


sepavloff created this revision.
sepavloff added reviewers: rjmccall, aaron.ballman, arsenm, kpn, qiucf, efriedma.
Herald added a subscriber: hiraditya.
Herald added a project: All.
sepavloff requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added projects: clang, LLVM.

A new builting function __builtin_isfpclass is added. It is called as:

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

and returns an 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 set of classes is an integer value, where each
value class is represented by a bit. There are ten data classes, as
defined by the IEEE-754 standard, they are represented by bits:

  0x0001 - Signaling NaN
  0x0002 - Quiet NaN
  0x0004 - Negative infinity
  0x0008 - Negative normal
  0x0010 - Negative subnormal
  0x0020 - Negative zero
  0x0040 - Positive zero
  0x0080 - Positive subnormal
  0x0100 - Positive normal
  0x0200 - Positive infinity

The data class encoding is identical to that used in llvm.is.fpclass
function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152351

Files:
  clang/include/clang/Basic/Builtins.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins.c
  clang/test/CodeGen/isfpclass.c
  llvm/include/llvm/IR/IRBuilder.h
  llvm/lib/IR/IRBuilder.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152351.529218.patch
Type: text/x-patch
Size: 4215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230607/4a21dd17/attachment.bin>


More information about the cfe-commits mailing list