This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Add builtins for xvtdiv(dp|sp) and xvtsqrt(dp|sp).
ClosedPublic

Authored by Esme on Sep 24 2020, 10:41 PM.

Details

Summary

This patch implements the builtins for xvtdivdp, xvtdivsp, xvtsqrtdp, xvtsqrtsp.
The instructions correspond to the following builtins:

int vec_test_swdiv(vector double v1, vector double v2);
int vec_test_swdivs(vector float v1, vector float v2);
int vec_test_swsqrt(vector double v1);
int vec_test_swsqrts(vector float v1);

This patch depends on D88274, which fixes the bug in copying from CRRC to GRC.

Diff Detail

Event Timeline

Esme created this revision.Sep 24 2020, 10:41 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 24 2020, 10:41 PM
Esme requested review of this revision.Sep 24 2020, 10:41 PM
Esme added a reviewer: Restricted Project.
steven.zhang added inline comments.Sep 24 2020, 11:06 PM
llvm/lib/Target/PowerPC/PPCInstrVSX.td
2594

Vector test for software divide and sqrt

amyk accepted this revision as: amyk.Oct 1 2020, 10:25 AM
amyk added a subscriber: amyk.

Overall I think this LGTM.

Please correct me if I am wrong but I think the description of the functions need to be updated to:

int vec_test_swdiv(vector double v1, vector double v2);
int vec_test_swdivs(vector float v1, vector float v2);
int vec_test_swsqrt(vector double v1);
int vec_test_swsqrts(vector float v1);
This revision is now accepted and ready to land.Oct 1 2020, 10:25 AM
Esme edited the summary of this revision. (Show Details)Oct 1 2020, 6:22 PM

Overall I think this LGTM.

Please correct me if I am wrong but I think the description of the functions need to be updated to:

int vec_test_swdiv(vector double v1, vector double v2);
int vec_test_swdivs(vector float v1, vector float v2);
int vec_test_swsqrt(vector double v1);
int vec_test_swsqrts(vector float v1);

Thanks! Updated.

Esme added inline comments.Oct 1 2020, 6:30 PM
llvm/lib/Target/PowerPC/PPCInstrVSX.td
2594

I'll update it when committing. Thanks.

I think some follow up is needed to optimize the code sequence for

cr = vec_test_div
if (rotate_and_mask(cr, 62))
  ...

For now, we will copy the cr to gpr, and shift it to 61-64 bit,then, extract the bit and then compare to 0. the shift is not needed. Please double confirm to see if the peephole handle it well.

This revision was landed with ongoing or failed builds.Oct 4 2020, 9:26 AM
This revision was automatically updated to reflect the committed changes.