This is an archive of the discontinued LLVM Phabricator instance.

[x86] add special-case lowering for usubsat for pre-SSE4
ClosedPublic

Authored by spatel on Oct 19 2021, 1:51 PM.

Details

Summary

usubsat X, SMIN --> (X ^ SMIN) & (X s>> BW-1)

This would be a regression with D112085 where we combine to usubsat more aggressively, so avoid that by matching the special-case where we are subtracting SMIN (signmask):
https://alive2.llvm.org/ce/z/4_3gBD

Diff Detail

Event Timeline

spatel created this revision.Oct 19 2021, 1:51 PM
spatel requested review of this revision.Oct 19 2021, 1:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 19 2021, 1:51 PM
RKSimon accepted this revision.Oct 19 2021, 2:06 PM

LGTM

llvm/test/CodeGen/X86/psubus.ll
31–32

Please can you add a comment explaining the fold:

; usubsat X, (1 << (BW-1)) --> (X ^ (1 << (BW-1))) & (ashr X, (BW-1))
This revision is now accepted and ready to land.Oct 19 2021, 2:06 PM
This revision was landed with ongoing or failed builds.Oct 19 2021, 2:15 PM
This revision was automatically updated to reflect the committed changes.