Page MenuHomePhabricator

[X86] Re-enable lowerUINT_TO_FP_vXi32 under fast-math by using an FSUB instead of an FADD.

Authored by craig.topper on Dec 28 2019, 4:55 PM.



We previously disabled this under fast math due to aggressive
reassociation by the machine combiner. But I think we can work
around this by using a FSUB instead of FADD for the first

This matches the similar algorithm we do for uint_to_fp i64->f64
in TargetLowering::expandUINT_TO_FP. If reassociation hasn't
been a problem for that, hopefully its not a problem here.

Diff Detail

Event Timeline

craig.topper created this revision.Dec 28 2019, 4:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 28 2019, 4:55 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
spatel accepted this revision.Jan 2 2020, 1:27 PM

LGTM - we could do what the existing code comment suggests, but it's more work, and I don't think it's worth the effort.


We actually do have FMF on MIR now - see D52006 and related patches.


Better leave a code comment here to explain that this is fragile and requires subtracting the positive constant rather than adding the negative constant.

This revision is now accepted and ready to land.Jan 2 2020, 1:27 PM
This revision was automatically updated to reflect the committed changes.