This is an archive of the discontinued LLVM Phabricator instance.

[X86] Don't widen 128/256-bit strict compares with vXi1 result to 512-bits on KNL.
ClosedPublic

Authored by craig.topper on Feb 12 2020, 9:06 PM.

Details

Summary

If we widen the compare we might trigger a spurious exception from
the garbage data.

We have two choices here. Explicitly force the upper bits to zero.
Or use a legacy VEX vcmpps/pd instruction and convert the XMM/YMM
result to mask register.

I've chosen to go with the second option. I'm not sure which is
really best. In some cases we could get rid of the zeroing since
the producing instruction probably already zeroed it. But we lose
the ability to fold a load. So which is best is dependent on
surrounding code.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 12 2020, 9:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 12 2020, 9:06 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
spatel accepted this revision.Feb 13 2020, 6:43 AM

LGTM.

This is my first view of these test files, so it might just be me...but I didn't inspect every test diff. It looks like we're brute-forcing through a matrix of {x preds, y data types, (non)signalling, 32/64-bit targets, ... }. I'd interleave those parameters to reduce the number of tests by 8-16x or more. Save test and review time if we're pretty confident that the lowering logic is fairly uniform. :)

llvm/lib/Target/X86/X86ISelLowering.cpp
21760

Extra // in re-flowed comment text.

This revision is now accepted and ready to land.Feb 13 2020, 6:43 AM
This revision was automatically updated to reflect the committed changes.