This is an archive of the discontinued LLVM Phabricator instance.

[X86][SSE] Improve recognition of i64 sitofp conversions can be performed as i32 (PR29078)
ClosedPublic

Authored by RKSimon on Sep 8 2016, 7:31 AM.

Details

Summary

Until AVX512DQ we only support i64/vXi64 sitofp conversion as scalars.

This patch sees if the sign bit extends far enough that we can truncate to a i32 type and then perform sitofp without loss of precision.

Sibling patch to D24343 - once that is applied the uitofp equivalent tests will reduce with this patch as well.

Note: the signum64a codegen change is an interesting one, it looks we could improve this if we updated truncateVectorCompareWithPACKSS to support 64-bit vector outputs.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon updated this revision to Diff 70697.Sep 8 2016, 7:31 AM
RKSimon retitled this revision from to [X86][SSE] Improve recognition of i64 sitofp conversions can be performed as i32 (PR29078).
RKSimon updated this object.
RKSimon set the repository for this revision to rL LLVM.
RKSimon added a subscriber: llvm-commits.
zvi accepted this revision.Sep 14 2016, 9:17 AM
zvi edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 14 2016, 9:17 AM
andreadb accepted this revision.Sep 14 2016, 9:25 AM
andreadb edited edge metadata.

Hi Simon,

the patch lgtm.

I have just one comment (see below).

test/CodeGen/X86/sse-fsignum.ll
42–45 ↗(On Diff #70697)

Isn't the vmovq+vmovd sequence redundant?

Thanks Zvi and Andrea

test/CodeGen/X86/sse-fsignum.ll
42–45 ↗(On Diff #70697)

Yes that was my comment about the signum64a codegen - we need to more aggressively use truncateVectorCompareWithPACKSS - at the moment its only used to truncate whole 128-bit vectors, when we could use it on subvectors as well. In fact we may even be able to generalize it to work with ComputeNumSignBits instead of just vector comparison results.

This revision was automatically updated to reflect the committed changes.