[PATCH] [SLPVectorization] Vectorize Reduction Chain feeding into a 'return' statement

suyog suyog.sarda at samsung.com
Wed Nov 12 09:10:12 PST 2014


Hi Hal, Arnold, James,

Thanks for reviewing the patch. 

I have updated the patch removing unnecessary metadata from test case.

After Arnold's suggestion, i tried using tryToVectorize() in place of tryToVectorizeList().
It was breaking some of the test cases (instead of <4xfloat>, <2xfloat> emitted for already existing 
test cases). Need to investigate that, till then sticking with tryToVectorizeList().

As Arnold suggested, this is an intermediate step to improve horizontal reductions.
Improvements as pointed earlier in 'llvm-dev' mailing discussion to follow in upcoming patches.

I did not run performance test yet. Will update soon with the results. 
(unfortunately my laptop broke yesterday and i have to rely on my office workstation).

However, for AArch64:
test case : 

float hadd(float * a) {
  return ((a[0] + a[2]) + (a[1] + a[3]));
}

Assembly without patch:
        
        ldp	 s0, s1, [x0]
	ldp	s2, s3, [x0, #8]
	fadd	s0, s0, s2
	fadd	s1, s1, s3
	fadd	s0, s0, s1
	ret

Assembly with patch:

        ldp	 d0, d1, [x0]
	fadd	  v0.2s, v0.2s, v1.2s
	faddp  s0, v0.2s

which indicates code improvement.

Please help in reviewing the updated patch.

Regards,
Suyog

http://reviews.llvm.org/D6227

Files:
  lib/Transforms/Vectorize/SLPVectorizer.cpp
  test/Transforms/SLPVectorizer/X86/return.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6227.16100.patch
Type: text/x-patch
Size: 2965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141112/a2e78ad3/attachment.bin>


More information about the llvm-commits mailing list