This is an archive of the discontinued LLVM Phabricator instance.

[X86] Custom isel floating point X86ISD::CMP on pre-CMOV targets. Eliminate ConvertCmpIfNecessary
ClosedPublic

Authored by craig.topper on Feb 2 2020, 11:19 PM.

Details

Summary

If we don't have cmov, X87 compares write to FPSW and we need to
move the bits to EFLAGS to use as JCC/SETCC/CMOV conditions.

Previously this was done by calling ConvertCmpIfNecessary in
multiple places which would emit the extra code for the FNSTSW,
a shift, a truncate, and a SAHF instructions. Isel would then
select trunc+X86ISD::CMP to a FUCOM instruction that produces FPSW.

This patch centralizes all of the handling into a single custom
isel handler. This allows us to remove ConvertCmpIfNecessary and
a couple target specific ISD opcodes.

Event Timeline

craig.topper created this revision.Feb 2 2020, 11:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2020, 11:19 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
RKSimon added inline comments.Feb 3 2020, 3:01 AM
llvm/lib/Target/X86/X86ISelLowering.h
1493

Remove this?

Remove dead declaration of ConvertCmpIfNecessary

RKSimon accepted this revision.Feb 6 2020, 9:10 AM

LGTM

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