This is an archive of the discontinued LLVM Phabricator instance.

[X86] Change signatures of avx512 packed fp compare intrinsics to return a vXi1 mask type to be closer to an fcmp.
ClosedPublic

Authored by craig.topper on Feb 9 2018, 11:34 AM.

Details

Summary

This patch changes the signature of the avx512 packed fp compare intrinsics to return a vXi1 vector and no longer take a mask as input. The casts to scalar type will now need to be explicit in the IR. The masking node will now be an explicit and in the IR.

This makes the intrinsic look much more similar to an fcmp instruction that we wish we could use for these but can't. We already use icmp instructions for integer compares.

Previously the lowering step of isel would turn the intrinsic into an X86 specific ISD node and a emit the masking nodes as well as some bitcasts. This means DAG combines can't see the vXi1 type until somewhat late, making it more difficult to combine out gpr<->mask transition sequences. By exposing the vXi1 type explicitly in the IR and initial SelectionDAG we give earlier DAG combines and even InstCombine the chance to see it and optimize it.

This should make any issues with gpr<->mask sequences the same between integer and fp. Meaning we only have to fix them once.

I'll post a clang patch for CGBuiltin.cpp soon.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Feb 9 2018, 11:34 AM

Can we remove CMP_MASK_CC completely with this?

I think we still need CMP_MASK_CC. I don't see another type that supports optional rounding mode and truncating the immediate from i32 to i8

RKSimon accepted this revision.Feb 10 2018, 9:59 AM

OK, LGTM

This revision is now accepted and ready to land.Feb 10 2018, 9:59 AM
This revision was automatically updated to reflect the committed changes.