[all-commits] [llvm/llvm-project] 7dd387: [clang] Add __builtin_isfpclass
Serge Pavlov via All-commits
all-commits at lists.llvm.org
Sun Jun 18 08:55:43 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7dd387d2971d7759cadfffeb2082439f6c7ddd49
https://github.com/llvm/llvm-project/commit/7dd387d2971d7759cadfffeb2082439f6c7ddd49
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2023-06-18 (Sun, 18 Jun 2023)
Changed paths:
M clang/docs/LanguageExtensions.rst
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/Builtins.def
M clang/lib/AST/ExprConstant.cpp
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/lib/Frontend/InitPreprocessor.cpp
M clang/lib/Sema/SemaChecking.cpp
M clang/test/CodeGen/builtins.c
A clang/test/CodeGen/isfpclass.c
M clang/test/Preprocessor/init-aarch64.c
M clang/test/Preprocessor/init.c
M clang/test/Sema/builtins.c
M clang/test/Sema/constant-builtins-2.c
M llvm/include/llvm/IR/IRBuilder.h
M llvm/lib/IR/IRBuilder.cpp
Log Message:
-----------
[clang] Add __builtin_isfpclass
A new builtin function __builtin_isfpclass is added. It is called as:
__builtin_isfpclass(<floating point value>, <test>)
and returns an integer value, which is non-zero if the floating point
argument falls into one of the classes specified by the second 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 (__FPCLASS_SNAN) - Signaling NaN
0x0002 (__FPCLASS_QNAN) - Quiet NaN
0x0004 (__FPCLASS_NEGINF) - Negative infinity
0x0008 (__FPCLASS_NEGNORMAL) - Negative normal
0x0010 (__FPCLASS_NEGSUBNORMAL) - Negative subnormal
0x0020 (__FPCLASS_NEGZERO) - Negative zero
0x0040 (__FPCLASS_POSZERO) - Positive zero
0x0080 (__FPCLASS_POSSUBNORMAL) - Positive subnormal
0x0100 (__FPCLASS_POSNORMAL) - Positive normal
0x0200 (__FPCLASS_POSINF) - Positive infinity
They have corresponding builtin macros to facilitate using the builtin
function:
if (__builtin_isfpclass(x, __FPCLASS_NEGZERO | __FPCLASS_POSZERO) {
// x is any zero.
}
The data class encoding is identical to that used in llvm.is.fpclass
function.
Differential Revision: https://reviews.llvm.org/D152351
More information about the All-commits
mailing list