public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/66049] New: Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0.
@ 2015-05-07 12:35 vekumar at gcc dot gnu.org
  2015-05-08 16:33 ` [Bug target/66049] " ktkachov at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vekumar at gcc dot gnu.org @ 2015-05-07 12:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66049

            Bug ID: 66049
           Summary: Few AArch64 extend and add with shift tests generates
                    sub optimal code with trunk gcc 6.0.
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vekumar at gcc dot gnu.org
  Target Milestone: ---

After preventing conversion of shift to mults in combiner
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=222874

few Aarch64 target tests generates suboptimal code.

Tests that now fail, but worked before:
---------------------------------------
gcc.target/aarch64/adds1.c scan-assembler adds\tw[0-9]+, w[0-9]+, w[0-9]+, lsl
3
gcc.target/aarch64/adds1.c scan-assembler adds\tx[0-9]+, x[0-9]+, x[0-9]+, lsl
3
gcc.target/aarch64/adds3.c scan-assembler-times adds\tx[0-9]+, x[0-9]+,
x[0-9]+,
 sxtw 2
gcc.target/aarch64/extend.c scan-assembler add\tw[0-9]+,.*uxth #?1
gcc.target/aarch64/extend.c scan-assembler add\tx[0-9]+,.*uxtw #?3
gcc.target/aarch64/extend.c scan-assembler sub\tw[0-9]+,.*uxth #?1
gcc.target/aarch64/extend.c scan-assembler sub\tx[0-9]+,.*uxth #?1
gcc.target/aarch64/extend.c scan-assembler sub\tx[0-9]+,.*uxtw #?3
gcc.target/aarch64/subs1.c scan-assembler subs\tw[0-9]+, w[0-9]+, w[0-9]+, lsl
3
gcc.target/aarch64/subs1.c scan-assembler subs\tx[0-9]+, x[0-9]+, x[0-9]+, lsl
3
gcc.target/aarch64/subs3.c scan-assembler-times subs\tx[0-9]+, x[0-9]+,
x[0-9]+,
 sxtw 2

Sample Test case 
----------------
unsigned long long
adddi_uxtw (unsigned long long a, unsigned int i)
{
  /* { dg-final { scan-assembler "add\tx\[0-9\]+,.*uxtw #?3" } } */
  return a + ((unsigned long long)i << 3);
}

Before 

 add     x0, x0, x1, uxtw 3

Now 

ubfiz   x1, x1, 3, 32
add     x0, x1, x0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/66049] Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0.
  2015-05-07 12:35 [Bug target/66049] New: Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0 vekumar at gcc dot gnu.org
@ 2015-05-08 16:33 ` ktkachov at gcc dot gnu.org
  2015-05-12  8:16 ` ktkachov at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2015-05-08 16:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66049

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schwab@linux-m68k.org

--- Comment #2 from ktkachov at gcc dot gnu.org ---
*** Bug 66075 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/66049] Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0.
  2015-05-07 12:35 [Bug target/66049] New: Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0 vekumar at gcc dot gnu.org
  2015-05-08 16:33 ` [Bug target/66049] " ktkachov at gcc dot gnu.org
@ 2015-05-12  8:16 ` ktkachov at gcc dot gnu.org
  2015-05-15 14:35 ` ramana at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2015-05-12  8:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66049

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |aarch64*
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization
   Last reconfirmed|                            |2015-05-12
                 CC|                            |ktkachov at gcc dot gnu.org
     Ever confirmed|0                           |1
   Target Milestone|---                         |6.0
      Known to fail|                            |6.0

--- Comment #3 from ktkachov at gcc dot gnu.org ---
Venkat, are you planning to submit this patch to gcc-patches?
Also, does this mean we can remove the patterns that do arith+shift using MULT
rtxes? (like *adds_<optab><mode>_multp2)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/66049] Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0.
  2015-05-07 12:35 [Bug target/66049] New: Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0 vekumar at gcc dot gnu.org
  2015-05-08 16:33 ` [Bug target/66049] " ktkachov at gcc dot gnu.org
  2015-05-12  8:16 ` ktkachov at gcc dot gnu.org
@ 2015-05-15 14:35 ` ramana at gcc dot gnu.org
  2015-05-15 15:38 ` [Bug target/66049] [6 regression] " vekumar at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ramana at gcc dot gnu.org @ 2015-05-15 14:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66049

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ramana at gcc dot gnu.org

--- Comment #5 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
(In reply to vekumar from comment #4)
> (In reply to ktkachov from comment #3)
> > Venkat, are you planning to submit this patch to gcc-patches?
> > Also, does this mean we can remove the patterns that do arith+shift using
> > MULT rtxes? (like *adds_<optab><mode>_multp2)
> 
> Hi Kyrill, 
> 
> Yes I am planing to submit the patch. But before that I need to test by
> putting some assert and check if *adds_<optab><mode>_multp2 and similar
> patterns are not used anymore.

So this is a regression on GCC 6. what's holding up pushing this patch onto
gcc-patches@ ?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/66049] [6 regression] Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0.
  2015-05-07 12:35 [Bug target/66049] New: Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0 vekumar at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-05-15 14:35 ` ramana at gcc dot gnu.org
@ 2015-05-15 15:38 ` vekumar at gcc dot gnu.org
  2015-05-18 17:29 ` vekumar at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vekumar at gcc dot gnu.org @ 2015-05-15 15:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66049

--- Comment #6 from vekumar at gcc dot gnu.org ---
(In reply to Ramana Radhakrishnan from comment #5)
> (In reply to vekumar from comment #4)
> > (In reply to ktkachov from comment #3)
> > > Venkat, are you planning to submit this patch to gcc-patches?
> > > Also, does this mean we can remove the patterns that do arith+shift using
> > > MULT rtxes? (like *adds_<optab><mode>_multp2)
> > 
> > Hi Kyrill, 
> > 
> > Yes I am planing to submit the patch. But before that I need to test by
> > putting some assert and check if *adds_<optab><mode>_multp2 and similar
> > patterns are not used anymore.
> 
> So this is a regression on GCC 6. what's holding up pushing this patch onto
> gcc-patches@ ?

GCC bootstrap and regression testing completed. I am doing SPEC 2006 INT run
just to make sure no surprises. will post it in a day or two.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/66049] [6 regression] Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0.
  2015-05-07 12:35 [Bug target/66049] New: Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0 vekumar at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-05-15 15:38 ` [Bug target/66049] [6 regression] " vekumar at gcc dot gnu.org
@ 2015-05-18 17:29 ` vekumar at gcc dot gnu.org
  2015-05-19  9:27 ` ktkachov at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vekumar at gcc dot gnu.org @ 2015-05-18 17:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66049

--- Comment #7 from vekumar at gcc dot gnu.org ---
(In reply to ktkachov from comment #3)
> Venkat, are you planning to submit this patch to gcc-patches?
> Also, does this mean we can remove the patterns that do arith+shift using
> MULT rtxes? (like *adds_<optab><mode>_multp2)

Hi Kyrill, 

I added shift based patterns for 

*adds_<optab><mode>_multp2
*subs_<optab><mode>_multp2
*add_uxt<mode>_multp2
*add_uxtsi_multp2_uxtw
*sub_uxt<mode>_multp2
*sub_uxtsi_multp2_uxtw
*adds_mul_imm_<mode>
*subs_mul_imm_<mode>

I added "gcc_unreachable" to these patterns and gcc boostrapped except
add_uxt<mode>_multp2 pattern.


The pattern "*add_uxtdi_multp2" can still be generated. 

/root/work/GCC_Team/vekumar/build-assert-check/./gcc/xgcc
-B/root/work/GCC_Team/vekumar/build-assert-check/./gcc/
-B/root/work/GCC_Team/vekumar/install-assert-check/aarch64-unknown-linux-gnu/bin/
-B/root/work/GCC_Team/vekumar/install-assert-check/aarch64-unknown-linux-gnu/lib/
-isystem
/root/work/GCC_Team/vekumar/install-assert-check/aarch64-unknown-linux-gnu/include
-isystem
/root/work/GCC_Team/vekumar/install-assert-check/aarch64-unknown-linux-gnu/sys-include
   -g -O2 -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition  -isystem ./include   -fPIC -g -DIN_LIBGCC2
-fbuilding-libgcc -fno-stack-protector   -fPIC -I. -I. -I../.././gcc
-I../../../gcc-assert-check/libgcc -I../../../gcc-assert-check/libgcc/.
-I../../../gcc-assert-check/libgcc/../gcc
-I../../../gcc-assert-check/libgcc/../include  -DHAVE_CC_TLS  -o _gcov.o -MT
_gcov.o -MD -MP -MF _gcov.dep -DL_gcov -c
../../../gcc-assert-check/libgcc/libgcov-driver.c


insn 1325 1324 1326 137 (set (reg:DI 725 [ ix ])
        (zero_extend:DI (reg/v:SI 197 [ ix ])))
../../../gcc-assert-check/libgcc/libgcov-driver.c:103 73
{*zero_extendsidi2_aarch64}
     (nil))
(insn 1326 1325 1327 137 (set (reg:DI 726)
        (plus:DI (reg:DI 725 [ ix ])
            (const_int 4 [0x4])))
../../../gcc-assert-check/libgcc/libgcov-driver.c:103 87 {*adddi3_aarch64}
     (expr_list:REG_DEAD (reg:DI 725 [ ix ])
        (nil)))
(insn 1327 1326 3536 137 (set (reg/f:DI 727)
        (mem/f:DI (plus:DI (mult:DI (reg:DI 726)
                    (const_int 8 [0x8]))
                (reg/v/f:DI 571 [ list ])) [2 MEM[(const struct gcov_info
*)list_372].merge S8 A64]))
../../../gcc-assert-check/libgcc/libgcov-driver.c:103 40 {*movdi_aarch64}


Successfully matched this instruction:
(set (reg/f:DI 727)
    (plus:DI (and:DI (mult:DI (subreg:DI (reg/v:SI 197 [ ix ]) 0)
                (const_int 8 [0x8]))
            (const_int 34359738360 [0x7fffffff8]))
        (reg/v/f:DI 571 [ list ])))

(insn 1326 1325 1327 137 (set (reg:DI 726)
        (plus:DI (and:DI (mult:DI (subreg:DI (reg/v:SI 197 [ ix ]) 0)
                    (const_int 8 [0x8]))
                (const_int 34359738360 [0x7fffffff8]))
            (reg/v/f:DI 571 [ list ])))
../../../gcc-assert-check/libgcc/libgcov-driver.c:103 252 {*add_uxtdi_multp2}
     (nil))
(insn 1327 1326 3536 137 (set (reg/f:DI 727)
        (mem/f:DI (plus:DI (reg:DI 726)
                (const_int 32 [0x20])) [2 MEM[(const struct gcov_info
*)list_372].merge S8 A64]))
../../../gcc-assert-check/libgcc/libgcov-driver.c:103 40 {*movdi_aarch64}

I am going to first send out patch for adding new shift based patterns.
Then separate patch test  and remove mul patterns.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/66049] [6 regression] Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0.
  2015-05-07 12:35 [Bug target/66049] New: Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0 vekumar at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-05-18 17:29 ` vekumar at gcc dot gnu.org
@ 2015-05-19  9:27 ` ktkachov at gcc dot gnu.org
  2015-05-26 15:32 ` vekumar at gcc dot gnu.org
  2015-05-26 16:24 ` vekumar at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2015-05-19  9:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66049

--- Comment #8 from ktkachov at gcc dot gnu.org ---
(In reply to vekumar from comment #7)

> 
> I am going to first send out patch for adding new shift based patterns.
> Then separate patch test  and remove mul patterns.

Ok, please send out the patch that fixes the regressions we have, and the
cleanup/removal of redundant patterns (if needed) can come later.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/66049] [6 regression] Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0.
  2015-05-07 12:35 [Bug target/66049] New: Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0 vekumar at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-05-19  9:27 ` ktkachov at gcc dot gnu.org
@ 2015-05-26 15:32 ` vekumar at gcc dot gnu.org
  2015-05-26 16:24 ` vekumar at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vekumar at gcc dot gnu.org @ 2015-05-26 15:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66049

--- Comment #9 from vekumar at gcc dot gnu.org ---
Author: vekumar
Date: Tue May 26 15:32:02 2015
New Revision: 223703

URL: https://gcc.gnu.org/viewcvs?rev=223703&root=gcc&view=rev
Log:
2015-05-26  Venkataramanan Kumar  <venkataramanan.kumar@amd.com>

        PR target/66049
        * config/aarch64/aarch64.md
        (*adds_shift_imm_<mode>):  New pattern.
        (*subs_shift_imm_<mode>):  Likewise.
        (*adds_<optab><ALLX:mode>_shift_<GPI:mode>):  Likewise.
        (*subs_<optab><ALLX:mode>_shift_<GPI:mode>): Likewise.
        (*add_uxt<mode>_shift2): Likewise.
        (*add_uxtsi_shift2_uxtw): Likewise.
        (*sub_uxt<mode>_shift2): Likewise.
        (*sub_uxtsi_shift2_uxtw): Likewise.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/aarch64/aarch64.md


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/66049] [6 regression] Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0.
  2015-05-07 12:35 [Bug target/66049] New: Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0 vekumar at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2015-05-26 15:32 ` vekumar at gcc dot gnu.org
@ 2015-05-26 16:24 ` vekumar at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vekumar at gcc dot gnu.org @ 2015-05-26 16:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66049

vekumar at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from vekumar at gcc dot gnu.org ---
Fixed at r223703


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-05-26 16:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-07 12:35 [Bug target/66049] New: Few AArch64 extend and add with shift tests generates sub optimal code with trunk gcc 6.0 vekumar at gcc dot gnu.org
2015-05-08 16:33 ` [Bug target/66049] " ktkachov at gcc dot gnu.org
2015-05-12  8:16 ` ktkachov at gcc dot gnu.org
2015-05-15 14:35 ` ramana at gcc dot gnu.org
2015-05-15 15:38 ` [Bug target/66049] [6 regression] " vekumar at gcc dot gnu.org
2015-05-18 17:29 ` vekumar at gcc dot gnu.org
2015-05-19  9:27 ` ktkachov at gcc dot gnu.org
2015-05-26 15:32 ` vekumar at gcc dot gnu.org
2015-05-26 16:24 ` vekumar at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).