This is an archive of the discontinued LLVM Phabricator instance.

[SPARC] Zero-extend the operands when doing UMULO on 64-bit integers
ClosedPublic

Authored by koakuma on Sep 27 2021, 8:11 AM.

Details

Summary

On SPARC, S/UMULO operation on 64-bit integers works by extending the value to 128-bit, then doing a multiplication and checking the upper half of the result.
This makes UMULO works correctly by putting a zero in the upper half rather than doing a sign extension.

Diff Detail

Event Timeline

koakuma created this revision.Sep 27 2021, 8:11 AM
koakuma requested review of this revision.Sep 27 2021, 8:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 27 2021, 8:11 AM
koakuma updated this revision to Diff 375286.Sep 27 2021, 8:37 AM

Fix clang-format errors.

koakuma updated this revision to Diff 377813.Oct 7 2021, 5:36 AM

Also fix the other testcases affected by this change, since they happen to contain the wrong behavior too.

Please upload the diff with full context, check out the contribution guide for more info.

koakuma updated this revision to Diff 383326.Oct 29 2021, 5:55 AM

Updated patch with full context.

koakuma updated this revision to Diff 383503.Oct 29 2021, 2:37 PM

clang-format fixes

The fix LGTM, there's only a minor nit wrt the test placement.

llvm/test/CodeGen/SPARC/mulo-64-lowering.ll
1 ↗(On Diff #383503)

Generate this file using update_llc_test_checks.py, that way it's much easier to update it if needed.

Minor nit to keep the test suite tidy, the unsigned case is already handled in umulo-128-legalisation-lowering.ll, perhaps copy-paste that and call it smulo-128-legalisation-lowering.ll.

koakuma updated this revision to Diff 386490.Nov 11 2021, 5:53 AM

Changed the test files as per @LemonBoy's suggestion.

koakuma updated this revision to Diff 386519.Nov 11 2021, 7:58 AM

Fix testcase generation.

LemonBoy accepted this revision.Nov 13 2021, 3:01 AM

LGTM. I can land this for you if you have no commit access, just give me the name/email you want to be credited as.

This revision is now accepted and ready to land.Nov 13 2021, 3:01 AM

LGTM. I can land this for you if you have no commit access, just give me the name/email you want to be credited as.

I have no commit access so please commit it for me. My email is koachan@protonmail.com.
Thanks a lot for the help.