[llvm-commits] AVX code optimization - please review
Nadav Rotem
nrotem at apple.com
Tue Sep 4 05:27:47 PDT 2012
+ SDValue Op0 = SVOp->getOperand(0);
+ SDValue Op1 = SVOp->getOperand(1);
+
+ if (MatchEvenMask) {
+ // Shift the second operand right to 32 bits
Period at the end of the sentence.
+ static const int ShiftRightMask[] = {-1, 0, -1, 2, -1, 4, -1, 6 };
+ Op1 = DAG.getVectorShuffle(VT, dl, Op1, UndefNode, ShiftRightMask);
+ }
+ else {
No line break.
+ // Shift the first operand left to 32 bits
Period at the end of the sentence.
+ static const int ShiftLeftMask[] = {1, -1, 3, -1, 5, -1, 7, -1 };
+ Op0 = DAG.getVectorShuffle(VT, dl, Op0, UndefNode, ShiftLeftMask);
+ }
+ static const int BlendMask[] = {0, 9, 2, 11, 4, 13, 6, 15};
+ return DAG.getVectorShuffle(VT, dl, Op0, Op1, BlendMask);
}
LGTM.
On Sep 4, 2012, at 2:46 PM, "Demikhovsky, Elena" <elena.demikhovsky at intel.com> wrote:
> This patch optimizes shuffle instruction - generates 2 instructions instead of 4.
> Since this specific shuffle is widely used in many workloads we have ~10% performance on them.
>
> shufflevector <8 x float> %A, <8 x float> %B, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
>
> vmovaps (%rdx), %ymm0
> vshufps $8, %ymm0, %ymm0, %ymm0
> vmovaps (%rcx), %ymm1
> vshufps $8, %ymm0, %ymm1, %ymm1
> vunpcklps %ymm0, %ymm1, %ymm0
>
> vmovaps (%rcx), %ymm0
> vmovsldup (%rdx), %ymm1
> vblendps $85, %ymm0, %ymm1, %ymm0
>
> Please review.
> Thanks.
>
> - Elena
>
>
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> <opt1.diff>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list