summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2020-01-02 16:54:49 +0100
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2020-01-02 16:59:45 +0100
commit63336795f0d50a009e8ec034d95811170efc978b (patch)
tree57bad3c045728b5e88b35af479654ee5bd4b8664 /llvm/lib/Target
parent24ab9b537e61b3fe5e6a1019492ff6530d82a3ee (diff)
downloadbcm5719-llvm-63336795f0d50a009e8ec034d95811170efc978b.tar.gz
bcm5719-llvm-63336795f0d50a009e8ec034d95811170efc978b.zip
[FPEnv] Default NoFPExcept SDNodeFlag to false
The NoFPExcept bit in SDNodeFlags currently defaults to true, unlike all other such flags. This is a problem, because it implies that all code that transforms SDNodes without copying flags can introduce a correctness bug, not just a missed optimization. This patch changes the default to false. This makes it necessary to move setting the (No)FPExcept flag for constrained intrinsics from the visitConstrainedIntrinsic routine to the generic visit routine at the place where the other flags are set, or else the intersectFlagsWith call would erase the NoFPExcept flag again. In order to avoid making non-strict FP code worse, whenever SelectionDAGISel::SelectCodeCommon matches on a set of orignal nodes none of which can raise FP exceptions, it will preserve this property on all results nodes generated, by setting the NoFPExcept flag on those result nodes that would otherwise be considered as raising an FP exception. To check whether or not an SD node should be considered as raising an FP exception, the following logic applies: - For machine nodes, check the mayRaiseFPException property of the underlying MI instruction - For regular nodes, check isStrictFPOpcode - For target nodes, check a newly introduced isTargetStrictFPOpcode The latter is implemented by reserving a range of target opcodes, similarly to how memory opcodes are identified. (Note that there a bit of a quirk in identifying target nodes that are both memory nodes and strict FP nodes. To simplify the logic, right now all target memory nodes are automatically also considered strict FP nodes -- this could be fixed by adding one more range.) Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D71841
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/SystemZ/SystemZISelLowering.h36
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.h20
2 files changed, 40 insertions, 16 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.h b/llvm/lib/Target/SystemZ/SystemZISelLowering.h
index 0ac07a12ab7..defcaa6eb6e 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.h
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.h
@@ -58,8 +58,7 @@ enum NodeType : unsigned {
ICMP,
// Floating-point comparisons. The two operands are the values to compare.
- // Regular and strict (quiet and signaling) versions.
- FCMP, STRICT_FCMP, STRICT_FCMPS,
+ FCMP,
// Test under mask. The first operand is ANDed with the second operand
// and the condition codes are set on the result. The third operand is
@@ -249,10 +248,9 @@ enum NodeType : unsigned {
// Compare floating-point vector operands 0 and 1 to produce the usual 0/-1
// vector result. VFCMPE is for "ordered and equal", VFCMPH for "ordered and
// greater than" and VFCMPHE for "ordered and greater than or equal to".
- // Regular and strict (quiet and signaling) versions.
- VFCMPE, STRICT_VFCMPE, STRICT_VFCMPES,
- VFCMPH, STRICT_VFCMPH, STRICT_VFCMPHS,
- VFCMPHE, STRICT_VFCMPHE, STRICT_VFCMPHES,
+ VFCMPE,
+ VFCMPH,
+ VFCMPHE,
// Likewise, but also set the condition codes on the result.
VFCMPES,
@@ -263,12 +261,12 @@ enum NodeType : unsigned {
VFTCI,
// Extend the even f32 elements of vector operand 0 to produce a vector
- // of f64 elements. Regular and strict versions.
- VEXTEND, STRICT_VEXTEND,
+ // of f64 elements.
+ VEXTEND,
// Round the f64 elements of vector operand 0 to f32s and store them in the
- // even elements of the result. Regular and strict versions.
- VROUND, STRICT_VROUND,
+ // even elements of the result.
+ VROUND,
// AND the two vector operands together and set CC based on the result.
VTM,
@@ -292,6 +290,24 @@ enum NodeType : unsigned {
// Operand 1: the bit mask
TDC,
+ // Strict variants of scalar floating-point comparisons.
+ // Quiet and signaling versions.
+ STRICT_FCMP = ISD::FIRST_TARGET_STRICTFP_OPCODE,
+ STRICT_FCMPS,
+
+ // Strict variants of vector floating-point comparisons.
+ // Quiet and signaling versions.
+ STRICT_VFCMPE,
+ STRICT_VFCMPH,
+ STRICT_VFCMPHE,
+ STRICT_VFCMPES,
+ STRICT_VFCMPHS,
+ STRICT_VFCMPHES,
+
+ // Strict variants of VEXTEND and VROUND.
+ STRICT_VEXTEND,
+ STRICT_VROUND,
+
// Wrappers around the inner loop of an 8- or 16-bit ATOMIC_SWAP or
// ATOMIC_LOAD_<op>.
//
diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h
index 16b076e85af..f48bacd1391 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.h
+++ b/llvm/lib/Target/X86/X86ISelLowering.h
@@ -79,9 +79,6 @@ namespace llvm {
/// X86 compare and logical compare instructions.
CMP, COMI, UCOMI,
- /// X86 strict FP compare instructions.
- STRICT_FCMP, STRICT_FCMPS,
-
/// X86 bit-test instructions.
BT,
@@ -325,7 +322,6 @@ namespace llvm {
// Vector packed double/float comparison.
CMPP,
- STRICT_CMPP,
// Vector integer comparisons.
PCMPEQ, PCMPGT,
@@ -338,7 +334,6 @@ namespace llvm {
/// Vector comparison generating mask bits for fp and
/// integer signed and unsigned data types.
CMPM,
- STRICT_CMPM,
// Vector comparison with SAE for FP values
CMPM_SAE,
@@ -506,7 +501,6 @@ namespace llvm {
// Vector float/double to signed/unsigned integer with truncation.
CVTTP2SI, CVTTP2UI, CVTTP2SI_SAE, CVTTP2UI_SAE,
- STRICT_CVTTP2SI, STRICT_CVTTP2UI,
// Scalar float/double to signed/unsigned integer with truncation.
CVTTS2SI, CVTTS2UI, CVTTS2SI_SAE, CVTTS2UI_SAE,
@@ -605,6 +599,20 @@ namespace llvm {
// For avx512-vp2intersect
VP2INTERSECT,
+ /// X86 strict FP compare instructions.
+ STRICT_FCMP = ISD::FIRST_TARGET_STRICTFP_OPCODE,
+ STRICT_FCMPS,
+
+ // Vector packed double/float comparison.
+ STRICT_CMPP,
+
+ /// Vector comparison generating mask bits for fp and
+ /// integer signed and unsigned data types.
+ STRICT_CMPM,
+
+ // Vector float/double to signed/unsigned integer with truncation.
+ STRICT_CVTTP2SI, STRICT_CVTTP2UI,
+
// Compare and swap.
LCMPXCHG_DAG = ISD::FIRST_TARGET_MEMORY_OPCODE,
LCMPXCHG8_DAG,
OpenPOWER on IntegriCloud