This is an archive of the discontinued LLVM Phabricator instance.

[X86][SSE] Improve recognition of uitofp conversions that can be performed as sitofp
ClosedPublic

Authored by RKSimon on Sep 8 2016, 6:27 AM.

Details

Summary

With D24253 we can now use SelectionDAG::SignBitIsZero with vector operations.

This patch uses SelectionDAG::SignBitIsZero to recognise that a zero sign bit means that we can use a sitofp instead of a uitofp (which is not directly support on pre-AVX512 hardware).

While AVX512 does provide support for uitofp, the conversion to sitofp should not cause any regressions.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon updated this revision to Diff 70692.Sep 8 2016, 6:27 AM
RKSimon retitled this revision from to [X86][SSE] Improve recognition of uitofp conversions that can be performed as sitofp.
RKSimon updated this object.
RKSimon set the repository for this revision to rL LLVM.
RKSimon added a subscriber: llvm-commits.
majnemer added inline comments.
test/CodeGen/X86/i64-to-float.ll
49–52

Was this here before?

51–54

Ditto.

RKSimon added inline comments.Sep 13 2016, 2:08 PM
test/CodeGen/X86/i64-to-float.ll
49–52

The stack spill/restore is a mess but the (f64 sitofp(i64)) fpu approach appears to be the better performing option on 32-bit targets.

Its also what gcc / icc does: https://godbolt.org/g/CMPJrA

RKSimon updated this revision to Diff 71386.Sep 14 2016, 10:35 AM

Updated now that D24345 has been committed

zvi accepted this revision.Sep 18 2016, 1:20 AM
zvi edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 18 2016, 1:20 AM
delena edited edge metadata.Sep 18 2016, 2:12 AM

Please update the cost of this conversion. You may do this in a separate patch, if you want.

This revision was automatically updated to reflect the committed changes.