[LLVMdev] [RFC][PATCH] Adding absd/hadd/sad intrinsics

Shahid, Asghar-ahmad
Fri, 01 May 2015 16:59:26 -0000

Hi All,

I would like to introduce intrinsics to generate efficient codes for
'absolute differences', 'horizontal add'
and 'sum of absolute differences' Idioms used by user programs.

Identifying these idioms at lower level (Codegen) is complex. These idioms can
be identified in LV/SLP
and vectorized using above intrinsics to generate better code.

Proposal:
1. Add intrinsics for 'absolute differences', 'horizontal add'
and 'sum of absolute differences' having variants of
Fixed / floating point data types and signed/unsigned operations.
2. Recognize these idioms at loop vectorizer or SLP and replace with
corresponding intrinsics based on the target's
Backend support.

Having these intrinsic will also help in cost modeling for these idioms which is
complex down the lane.

Pls find attached a patch regarding this which is incomplete & dirty at this
moment, however, it may help in this
discussion.

Regards,
Shahid


-------------- next part --------------
A non-text attachment was scrubbed...
Name: absd_hadd_sad_intrinsic.patch
Type: application/octet-stream
Size: 30121 bytes
Desc: absd_hadd_sad_intrinsic.patch
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20150501/facd5cdb/attachment.obj>