[Bug target/70799] STV pass does not convert DImode shifts

2017-04-25 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

Uroš Bizjak  changed:

   What|Removed |Added

 Target||x86
 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |7.0

--- Comment #11 from Uroš Bizjak  ---
Constant shifts conversion done for gcc-7, variable shifts conversion for
gcc-8.

[Bug target/70799] STV pass does not convert DImode shifts

2017-04-25 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

--- Comment #10 from uros at gcc dot gnu.org ---
Author: uros
Date: Tue Apr 25 17:45:22 2017
New Revision: 247263

URL: https://gcc.gnu.org/viewcvs?rev=247263&root=gcc&view=rev
Log:
PR target/70799
* config/i386/i386.c (dimode_scalar_to_vector_candidate_p):
Handle ASHIFTRT.
(dimode_scalar_chain::compute_convert_gain): Ditto.
(dimode_scalar_chain::make_vector_copies): Ditto.
(dimode_scalar_chain::convert_reg): Ditto.
(dimode_scalar_chain::convert_insn): Ditto.
* config/i386/sse.md (VI24_AVX512BW_1): Remove mode iterator.
(VI248_AVX512BW_1): New mode iterator.
(ashr3): Merge insn pattern with
ashrv2di3 insn using VI248_AVX512BW_1
mode iterator.

testsuite/ChangeLog:

PR target/70799
* gcc.target/i386/pr70799-5.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr70799-5.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/config/i386/sse.md
trunk/gcc/testsuite/ChangeLog

[Bug target/70799] STV pass does not convert DImode shifts

2017-04-23 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

--- Comment #9 from uros at gcc dot gnu.org ---
Author: uros
Date: Sun Apr 23 07:25:30 2017
New Revision: 247082

URL: https://gcc.gnu.org/viewcvs?rev=247082&root=gcc&view=rev
Log:
PR target/70799
* config/i386/i386.c (dimode_scalar_to_vector_candidate_p)
: Also consider variable shifts.
Check "XEXP (src, 1)" operand here.
:
Check "XEXP (src, 1)" operand here.
(dimode_scalar_chain::make_vector_copies): Detect count register
of a shift instruction.  Zero extend count register from QImode
to DImode to satisfy vector shift pattern count operand predicate.
Substitute vector shift count operand with a DImode copy.
(dimode_scalar_chain::convert_reg): Ditto, zero-extend from
vector register.

testsuite/ChangeLog:

PR target/70799
* gcc.target/i186/pr70799-4.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr70799-4.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/testsuite/ChangeLog

[Bug target/70799] STV pass does not convert DImode shifts

2017-02-10 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

Uroš Bizjak  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |ubizjak at gmail dot com

--- Comment #8 from Uroš Bizjak  ---
Created attachment 40714
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40714&action=edit
Patch to handle variable DImode shifts

This patch converts variable DImode shifts to vector insns.

[Bug target/70799] STV pass does not convert DImode shifts

2016-12-11 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

--- Comment #7 from uros at gcc dot gnu.org ---
Author: uros
Date: Sun Dec 11 18:59:07 2016
New Revision: 243530

URL: https://gcc.gnu.org/viewcvs?rev=243530&root=gcc&view=rev
Log:
PR target/70799
* config/i386/i386.c (dimode_scalar_to_vector_candidate_p)
: Consider all constant shifts.
Add FIXME comment.
(dimode_scalar_chain::compute_convert_gain): Reduce gain for
constant shifts larger or equal than 32.

testsuite/ChangeLog:

PR target/70799
* gcc.target/i386/pr70799-3.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr70799-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/testsuite/ChangeLog

[Bug target/70799] STV pass does not convert DImode shifts

2016-12-02 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

--- Comment #6 from Uroš Bizjak  ---
(In reply to Uroš Bizjak from comment #5)
> (In reply to Uroš Bizjak from comment #0)
> > These should all be converted to DImode vector shifts for SSE2/AVX2 32bit
> > target (and similar for rotates):
> 
> There are no corresponding SSE insns for rotates.

There are only variable logical shifts missing from the set of possible STV
transformations on x86. There is slight complication present: in contrast to
integer instructions, SSE shifts don't use masked count operand, so masking of
count operand is necessary. Loading of 0x63 constant and executing AND on SSE
register can be costly, so masking should be performed with a SImode integer
instruction. After that, SImode value can be moved to SSE register and used in
a shift.

OTOH, following code for a simple DImode shift:

movl4(%esp), %ecx
movla+4, %edx
movla, %eax
shrdl   %edx, %eax
shrl%cl, %edx
testb   $32, %cl
je  .L2
movl%edx, %eax
xorl%edx, %edx
.L2:
movl%eax, c
movl%edx, c+4
ret

would be converted to:

movl4(%esp), %eax
andl$63, %eax
movd%eax, %xmm1
movqa, %xmm0
psrlq   %xmm1, %xmm0
movq%xmm0, c
ret

if we don't care about undefined values, then

movzbl  4(%esp), %eax
movd%eax, %xmm1
movqa, %xmm0
psrlq   %xmm1, %xmm0
movq%xmm0, c
ret

would do the trick, too.

[Bug target/70799] STV pass does not convert DImode shifts

2016-11-08 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

Uroš Bizjak  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-11-08
Summary|STV pass does not convert   |STV pass does not convert
   |DImode shifts and rotates   |DImode shifts
 Ever confirmed|0   |1

--- Comment #5 from Uroš Bizjak  ---
(In reply to Uroš Bizjak from comment #0)
> These should all be converted to DImode vector shifts for SSE2/AVX2 32bit
> target (and similar for rotates):

There are no corresponding SSE insns for rotates.

[Bug target/70799] STV pass does not convert DImode shifts and rotates

2016-11-08 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

--- Comment #4 from uros at gcc dot gnu.org ---
Author: uros
Date: Tue Nov  8 19:06:54 2016
New Revision: 241974

URL: https://gcc.gnu.org/viewcvs?rev=241974&root=gcc&view=rev
Log:
PR target/70799
* config/i386/i386.c (dimode_scalar_to_vector_candidate_p):
Handle ASHIFT and LSHIFTRT.
(dimode_scalar_chain::compute_convert_gain): Ditto.
(dimode_scalar_chain::convert_insn): Ditto.

testsuite/ChangeLog:

PR target/70799
* gcc.target/i386/pr70799-2.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr70799-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/testsuite/ChangeLog

[Bug target/70799] STV pass does not convert DImode shifts and rotates

2016-05-10 Thread ienkovich at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

--- Comment #3 from Ilya Enkovich  ---
Author: ienkovich
Date: Tue May 10 16:08:42 2016
New Revision: 236090

URL: https://gcc.gnu.org/viewcvs?rev=236090&root=gcc&view=rev
Log:
gcc/

PR target/70799
* config/i386/i386.c (dimode_scalar_to_vector_candidate_p): Allow
integer constants.
(dimode_scalar_chain::vector_const_cost): New.
(dimode_scalar_chain::compute_convert_gain): Handle constants.
(dimode_scalar_chain::convert_op): Likewise.
(dimode_scalar_chain::convert_insn): Likewise.

gcc/testsuite/

PR target/70799
* gcc.target/i386/pr70799-1.c: New test.

Added:
trunk/gcc/testsuite/gcc.target/i386/pr70799-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/testsuite/ChangeLog

[Bug target/70799] STV pass does not convert DImode shifts and rotates

2016-04-27 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

--- Comment #2 from Uroš Bizjak  ---
(In reply to Jakub Jelinek from comment #1)
> I've been also surprised that the STV pass punts on moves of constants into
> DImode registers, if it is not 0, sure, it has higher cost, because it needs
> to be loaded from memory, but in the end together with enough other DImode
> operations it can be still beneficial.

This is tracked in PR 70763.

[Bug target/70799] STV pass does not convert DImode shifts and rotates

2016-04-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70799

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
I've been also surprised that the STV pass punts on moves of constants into
DImode registers, if it is not 0, sure, it has higher cost, because it needs to
be loaded from memory, but in the end together with enough other DImode
operations it can be still beneficial.