[CFE, SystemZ] New target hook testFPKind() for checks of FP values.
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>
Fri, 12 Feb 2021 01:57:26 +0000 (02:57 +0100)
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>
Thu, 18 Feb 2021 18:36:46 +0000 (12:36 -0600)
commite57bd1ff4fb65208cb3060b62e1c48aa0aac623f
tree4b2aac52d3c09b5aa0a8c702d0ea88128ca710ac
parentbb260b1ca7d51869e140212aa543f53dfcf01a1b
[CFE, SystemZ]  New target hook testFPKind() for checks of FP values.

The recent commit 00a6254 "Stop traping on sNaN in builtin_isnan" changed the
lowering in constrained FP mode of builtin_isnan from an FP comparison to
integer operations to avoid trapping.

SystemZ has a special instruction "Test Data Class" which is the preferred
way to do this check. This patch adds a new target hook "testFPKind()" that
lets SystemZ emit the s390_tdc intrinsic instead.

testFPKind() takes the BuiltinID as an argument and is expected to soon
handle more opcodes than just 'builtin_isnan'.

Review: Thomas Preud'homme, Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D96568
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/CodeGen/TargetInfo.h
clang/test/CodeGen/SystemZ/strictfp_builtins.c [new file with mode: 0644]