Skip to content

Commit 7f06770

Browse files
committed
Restore range check for strict-fp opcodes
1 parent 7e6a290 commit 7f06770

File tree

6 files changed

+15
-39
lines changed

6 files changed

+15
-39
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,10 @@ enum NodeType : unsigned {
477477
MSRR,
478478

479479
// Strict (exception-raising) floating point comparison
480-
STRICT_FCMP,
480+
FIRST_STRICTFP_OPCODE,
481+
STRICT_FCMP = FIRST_STRICTFP_OPCODE,
481482
STRICT_FCMPE,
483+
LAST_STRICTFP_OPCODE = STRICT_FCMPE,
482484

483485
// NEON Load/Store with post-increment base updates
484486
FIRST_MEMORY_OPCODE,

llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,8 @@ bool AArch64SelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const {
2929
}
3030

3131
bool AArch64SelectionDAGInfo::isTargetStrictFPOpcode(unsigned Opcode) const {
32-
switch (static_cast<AArch64ISD::NodeType>(Opcode)) {
33-
default:
34-
return false;
35-
case AArch64ISD::STRICT_FCMP:
36-
case AArch64ISD::STRICT_FCMPE:
37-
return true;
38-
}
32+
return Opcode >= AArch64ISD::FIRST_STRICTFP_OPCODE &&
33+
Opcode <= AArch64ISD::LAST_STRICTFP_OPCODE;
3934
}
4035

4136
SDValue AArch64SelectionDAGInfo::EmitMOPS(unsigned Opcode, SelectionDAG &DAG,

llvm/lib/Target/PowerPC/PPCISelLowering.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,8 @@ namespace llvm {
484484
XXMFACC,
485485

486486
// Constrained conversion from floating point to int
487-
STRICT_FCTIDZ,
487+
FIRST_STRICTFP_OPCODE,
488+
STRICT_FCTIDZ = FIRST_STRICTFP_OPCODE,
488489
STRICT_FCTIWZ,
489490
STRICT_FCTIDUZ,
490491
STRICT_FCTIWUZ,
@@ -497,6 +498,7 @@ namespace llvm {
497498

498499
/// Constrained floating point add in round-to-zero mode.
499500
STRICT_FADDRTZ,
501+
LAST_STRICTFP_OPCODE = STRICT_FADDRTZ,
500502

501503
/// SETBC - The ISA 3.1 (P10) SETBC instruction.
502504
SETBC,

llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,6 @@ bool PPCSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const {
1919
}
2020

2121
bool PPCSelectionDAGInfo::isTargetStrictFPOpcode(unsigned Opcode) const {
22-
switch (static_cast<PPCISD::NodeType>(Opcode)) {
23-
default:
24-
return false;
25-
case PPCISD::STRICT_FCTIDZ:
26-
case PPCISD::STRICT_FCTIWZ:
27-
case PPCISD::STRICT_FCTIDUZ:
28-
case PPCISD::STRICT_FCTIWUZ:
29-
case PPCISD::STRICT_FCFID:
30-
case PPCISD::STRICT_FCFIDU:
31-
case PPCISD::STRICT_FCFIDS:
32-
case PPCISD::STRICT_FCFIDUS:
33-
case PPCISD::STRICT_FADDRTZ:
34-
return true;
35-
}
22+
return Opcode >= PPCISD::FIRST_STRICTFP_OPCODE &&
23+
Opcode <= PPCISD::LAST_STRICTFP_OPCODE;
3624
}

llvm/lib/Target/SystemZ/SystemZISelLowering.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ enum NodeType : unsigned {
307307

308308
// Strict variants of scalar floating-point comparisons.
309309
// Quiet and signaling versions.
310-
STRICT_FCMP,
310+
FIRST_STRICTFP_OPCODE,
311+
STRICT_FCMP = FIRST_STRICTFP_OPCODE,
311312
STRICT_FCMPS,
312313

313314
// Strict variants of vector floating-point comparisons.
@@ -322,6 +323,7 @@ enum NodeType : unsigned {
322323
// Strict variants of VEXTEND and VROUND.
323324
STRICT_VEXTEND,
324325
STRICT_VROUND,
326+
LAST_STRICTFP_OPCODE = STRICT_VROUND,
325327

326328
// Wrappers around the inner loop of an 8- or 16-bit ATOMIC_SWAP or
327329
// ATOMIC_LOAD_<op>.

llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,8 @@ bool SystemZSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const {
2323
}
2424

2525
bool SystemZSelectionDAGInfo::isTargetStrictFPOpcode(unsigned Opcode) const {
26-
switch (static_cast<SystemZISD::NodeType>(Opcode)) {
27-
default:
28-
return false;
29-
case SystemZISD::STRICT_FCMP:
30-
case SystemZISD::STRICT_FCMPS:
31-
case SystemZISD::STRICT_VFCMPE:
32-
case SystemZISD::STRICT_VFCMPH:
33-
case SystemZISD::STRICT_VFCMPHE:
34-
case SystemZISD::STRICT_VFCMPES:
35-
case SystemZISD::STRICT_VFCMPHS:
36-
case SystemZISD::STRICT_VFCMPHES:
37-
case SystemZISD::STRICT_VEXTEND:
38-
case SystemZISD::STRICT_VROUND:
39-
return true;
40-
}
26+
return Opcode >= SystemZISD::FIRST_STRICTFP_OPCODE &&
27+
Opcode <= SystemZISD::LAST_STRICTFP_OPCODE;
4128
}
4229

4330
static unsigned getMemMemLenAdj(unsigned Op) {

0 commit comments

Comments
 (0)