Skip to content

Commit 269f264

Browse files
authored
[X86] combineVectorSizedSetCCEquality - early out if the target uses SoftFloat/NoImplicitFloat. NFC. (llvm#165897)
Bail out earlier to help us simplify the logic for the MOVMSK/PTEST/KORTEST lowering, this will hopefully make it easier to reuse this for wider types in a future patch.
1 parent c8187f6 commit 269f264

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22861,6 +22861,13 @@ static SDValue combineVectorSizedSetCCEquality(EVT VT, SDValue X, SDValue Y,
2286122861
if (!OpVT.isScalarInteger() || OpSize < 128)
2286222862
return SDValue();
2286322863

22864+
// Don't do this if we're not supposed to use the FPU.
22865+
bool NoImplicitFloatOps =
22866+
DAG.getMachineFunction().getFunction().hasFnAttribute(
22867+
Attribute::NoImplicitFloat);
22868+
if (Subtarget.useSoftFloat() || NoImplicitFloatOps)
22869+
return SDValue();
22870+
2286422871
// Ignore a comparison with zero because that gets special treatment in
2286522872
// EmitTest(). But make an exception for the special case of a pair of
2286622873
// logically-combined vector-sized operands compared to zero. This pattern may
@@ -22883,13 +22890,9 @@ static SDValue combineVectorSizedSetCCEquality(EVT VT, SDValue X, SDValue Y,
2288322890
// Use XOR (plus OR) and PTEST after SSE4.1 for 128/256-bit operands.
2288422891
// Use PCMPNEQ (plus OR) and KORTEST for 512-bit operands.
2288522892
// Otherwise use PCMPEQ (plus AND) and mask testing.
22886-
bool NoImplicitFloatOps =
22887-
DAG.getMachineFunction().getFunction().hasFnAttribute(
22888-
Attribute::NoImplicitFloat);
22889-
if (!Subtarget.useSoftFloat() && !NoImplicitFloatOps &&
22890-
((OpSize == 128 && Subtarget.hasSSE2()) ||
22891-
(OpSize == 256 && Subtarget.hasAVX()) ||
22892-
(OpSize == 512 && Subtarget.useAVX512Regs()))) {
22893+
if ((OpSize == 128 && Subtarget.hasSSE2()) ||
22894+
(OpSize == 256 && Subtarget.hasAVX()) ||
22895+
(OpSize == 512 && Subtarget.useAVX512Regs())) {
2289322896
bool HasPT = Subtarget.hasSSE41();
2289422897

2289522898
// PTEST and MOVMSK are slow on Knights Landing and Knights Mill and widened

0 commit comments

Comments
 (0)