This is an archive of the discontinued LLVM Phabricator instance.

[X86] AVX512 fallback for floating-point scalar selects
ClosedPublic

Authored by zvi on Oct 6 2016, 3:42 AM.

Details

Summary

In the case where of 'select i1 , f32, f32' or select i1, f64, f64 prefer lowering to masked-moves over branches.

Fixes pr30561

Diff Detail

Repository
rL LLVM

Event Timeline

zvi updated this revision to Diff 73755.Oct 6 2016, 3:42 AM
zvi retitled this revision from to [X86] AVX512 fallback for floating-point scalar selects .
zvi updated this object.
zvi added a reviewer: delena.
zvi set the repository for this revision to rL LLVM.
delena edited edge metadata.Oct 6 2016, 4:09 AM

I'm not sure that RHS code is better than LHS.
I assume that this case should give better results:

define float @pr30561_f32(float %a, float %b, double %c, double %d) {

%c = fcmp oeq double %c, %d
%cond = select i1 %c, float %a, float %b
ret float %cond

}

delena added a reviewer: igorb.Oct 6 2016, 4:10 AM
zvi updated this revision to Diff 73761.Oct 6 2016, 4:29 AM
zvi added a comment.Oct 25 2016, 5:37 AM

I'm not sure that RHS code is better than LHS.

After a consultation i believe that the RHS is at least as good as in the LHS, and in cases of branch-mispredictions the RHS is much better.

I assume that this case should give better results:

define float @pr30561_f32(float %a, float %b, double %c, double %d) {

%c = fcmp oeq double %c, %d
%cond = select i1 %c, float %a, float %b
ret float %cond

}

Note that the case in your example is already handled in line 16023.

delena accepted this revision.Oct 26 2016, 6:55 AM
delena edited edge metadata.
This revision is now accepted and ready to land.Oct 26 2016, 6:55 AM
This revision was automatically updated to reflect the committed changes.