Commit 45230a40 by Uros Bizjak Committed by Uros Bizjak

re PR tree-optimization/85693 (Generation of SAD (Sum of Absolute Difference) instruction)

	PR target/85693
	* config/i386/mmx.md (usadv8qi): New expander.

testsuite/ChangeLog:

	PR target/85693
	* gcc.target/i386/pr85693-1.c: New test.

From-SVN: r273981
parent ce529ffc
2019-08-01 Uroš Bizjak <ubizjak@gmail.com>
PR target/85693
* config/i386/mmx.md (usadv8qi): New expander.
2019-08-01 Matthew Beliveau <mbelivea@redhat.com>
PR c++/90590
......
......@@ -1970,6 +1970,21 @@
DONE;
})
(define_expand "usadv8qi"
[(match_operand:V2SI 0 "register_operand")
(match_operand:V8QI 1 "register_operand")
(match_operand:V8QI 2 "vector_operand")
(match_operand:V2SI 3 "vector_operand")]
"TARGET_MMX_WITH_SSE"
{
rtx t1 = gen_reg_rtx (V1DImode);
rtx t2 = gen_reg_rtx (V2SImode);
emit_insn (gen_mmx_psadbw (t1, operands[1], operands[2]));
convert_move (t2, t1, 0);
emit_insn (gen_addv2si3 (operands[0], t2, operands[3]));
DONE;
})
(define_insn_and_split "mmx_pmovmskb"
[(set (match_operand:SI 0 "register_operand" "=r,r")
(unspec:SI [(match_operand:V8QI 1 "register_operand" "y,x")]
......
2019-08-01 Uroš Bizjak <ubizjak@gmail.com>
PR target/85693
* gcc.target/i386/pr85693-1.c: New test.
2019-08-01 Matthew Beliveau <mbelivea@redhat.com>
PR c++/90590
......
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-msse2 -O2 -ftree-vectorize" } */
#define N 8
int abs (int);
unsigned char pix1[N], pix2[N];
int foo (void)
{
int i_sum = 0;
int i;
for (i = 0; i < N; i++)
i_sum += abs (pix1[i] - pix2[i]);
return i_sum;
}
/* { dg-final { scan-assembler "psadbw" } } */
/* { dg-do compile }
/* { dg-do compile } */
/* { dg-options "-msse2 -O2 -ftree-vectorize" } */
#define N 1024
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment