This is an archive of the discontinued LLVM Phabricator instance.

[SVE][Builtins] Lower X forms of binop arithmetic builtins to dedicated intrinsics.
ClosedPublic

Authored by paulwalker-arm on Jan 17 2023, 7:52 AM.

Details

Summary

This patch changes the lowering for the following builtins to emit
calls to the new aarch64.sve.###.u intrinsics.

svabd_x
svabd_n_x
svadd_x
svadd_n_x
svasr_x
svasr_n_x
svdiv_x
svdiv_n_x
svdivr_x
svdivr_n_x
svlsl_x
svlsl_n_x
svlsr_x
svlsr_n_x
svmax_x
svmax_n_x
svmin_x
svmin_n_x
svmul_x
svmul_n_x
svmulh_x
svmulh_n_x
svsub_x
svsub_n_x
svsubr_x
svsubr_n_x

Depends on D141938

Diff Detail

Event Timeline

paulwalker-arm created this revision.Jan 17 2023, 7:52 AM
paulwalker-arm requested review of this revision.Jan 17 2023, 7:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2023, 7:52 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Matt added a subscriber: Matt.Jan 18 2023, 2:07 PM
sdesmalen accepted this revision.Feb 1 2023, 4:03 AM

LGTM. Feel free to ignore the nit if you think the explicit x_intrinsic is better.

clang/include/clang/Basic/arm_sve.td
762–787

nit is it worth adding a bit hasUndefVariant and doing !if (hasUndefVariant, intrinsic # "_u", intrinsic)?

This revision is now accepted and ready to land.Feb 1 2023, 4:03 AM
paulwalker-arm added inline comments.Feb 5 2023, 4:35 AM
clang/include/clang/Basic/arm_sve.td
762–787

Thanks for the suggestion but this assumes the m and x intrinsics have the same name, which for the reversed instructions is not the case (see SVDIVR_S for an example). It seemed wrong to add intrinsics for both div_u and divr_u given they're essentially the same operation.