re PR tree-optimization/91201 (SIMD not generated for horizontal sum of bytes in array)

PR tree-optimization/91201
	* config/i386/mmx.md (reduc_plus_scal_v8qi): New expander.

	* gcc.target/i386/sse2-pr91201-2.c: New test.

From-SVN: r273932
This commit is contained in:
Jakub Jelinek 2019-07-31 15:49:26 +02:00 committed by Jakub Jelinek
parent 930c55993f
commit 538e4cdc15
4 changed files with 46 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2019-07-31 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/91201
* config/i386/mmx.md (reduc_plus_scal_v8qi): New expander.
2019-07-31 Andrew Stubbs <ams@codesourcery.com>
* config/gcn/gcn-valu.md

View file

@ -1897,6 +1897,21 @@
(set_attr "type" "mmxshft,sseiadd,sseiadd")
(set_attr "mode" "DI,TI,TI")])
(define_expand "reduc_plus_scal_v8qi"
[(plus:V8QI
(match_operand:QI 0 "register_operand")
(match_operand:V8QI 1 "register_operand"))]
"TARGET_MMX_WITH_SSE"
{
rtx tmp = gen_reg_rtx (V8QImode);
emit_move_insn (tmp, CONST0_RTX (V8QImode));
rtx tmp2 = gen_reg_rtx (V1DImode);
emit_insn (gen_mmx_psadbw (tmp2, operands[1], tmp));
tmp2 = gen_lowpart (V8QImode, tmp2);
emit_insn (gen_vec_extractv8qiqi (operands[0], tmp2, const0_rtx));
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")]

View file

@ -1,3 +1,8 @@
2019-07-31 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/91201
* gcc.target/i386/sse2-pr91201-2.c: New test.
2019-07-31 Richard Biener <rguenther@suse.de>
PR tree-optimization/91178

View file

@ -0,0 +1,21 @@
/* PR tree-optimization/91201 */
/* { dg-do compile { target lp64 } } */
/* { dg-options "-O3 -msse2 -mno-sse3" } */
/* { dg-final { scan-assembler "\tpsadbw\t" } } */
unsigned char bytes[1024];
unsigned char
sum (void)
{
unsigned char r = 0;
unsigned char *p = (unsigned char *) bytes;
int n;
for (n = 8; n < sizeof (bytes); ++n)
{
p[n - 8] += p[n];
r += p[n];
}
return r;
}