public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/46631] New: Change operands order so we can use 16bit and instead of 32bit in thumb2
@ 2010-11-24  2:57 carrot at google dot com
  2010-11-24 12:09 ` [Bug target/46631] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: carrot at google dot com @ 2010-11-24  2:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46631

           Summary: Change operands order so we can use 16bit and instead
                    of 32bit in thumb2
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: carrot@google.com
                CC: carrot@google.com


Compile the following code with options -march=armv7-a -mthumb -Os

struct S {
      int bi_buf;
      int bi_valid;
};

int tz (struct S* p, int bits, int value)
{
      if (p == 0) return 1;
      p->bi_valid = bits;
      p->bi_buf = value & ((1 << bits) - 1);
      return 0;
}

GCC 4.6 generates:

00000000 <tz>:
   0:    2301          movs    r3, #1
   2:    b138          cbz    r0, 14 <tz+0x14>
   4:    408b          lsls    r3, r1
   6:    6041          str    r1, [r0, #4]
   8:    3b01          subs    r3, #1
   a:    ea03 0202     and.w    r2, r3, r2             // A
   e:    6002          str    r2, [r0, #0]
  10:    2000          movs    r0, #0
  12:    4770          bx    lr
  14:    4618          mov    r0, r3
  16:    4770          bx    lr

Notice instruction A is 32 bit, if we change it to

   and  r2, r2, r3

then we can encode it as 16bit.


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

* [Bug target/46631] Change operands order so we can use 16bit and instead of 32bit in thumb2
  2010-11-24  2:57 [Bug target/46631] New: Change operands order so we can use 16bit and instead of 32bit in thumb2 carrot at google dot com
@ 2010-11-24 12:09 ` rguenth at gcc dot gnu.org
  2010-12-03  9:55 ` ramana at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-24 12:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46631

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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

* [Bug target/46631] Change operands order so we can use 16bit and instead of 32bit in thumb2
  2010-11-24  2:57 [Bug target/46631] New: Change operands order so we can use 16bit and instead of 32bit in thumb2 carrot at google dot com
  2010-11-24 12:09 ` [Bug target/46631] " rguenth at gcc dot gnu.org
@ 2010-12-03  9:55 ` ramana at gcc dot gnu.org
  2010-12-08 16:38 ` rearnsha at gcc dot gnu.org
  2010-12-08 16:49 ` rearnsha at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ramana at gcc dot gnu.org @ 2010-12-03  9:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46631

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.12.03 09:55:09
                 CC|                            |ramana at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2010-12-03 09:55:09 UTC ---
Confirmed.


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

* [Bug target/46631] Change operands order so we can use 16bit and instead of 32bit in thumb2
  2010-11-24  2:57 [Bug target/46631] New: Change operands order so we can use 16bit and instead of 32bit in thumb2 carrot at google dot com
  2010-11-24 12:09 ` [Bug target/46631] " rguenth at gcc dot gnu.org
  2010-12-03  9:55 ` ramana at gcc dot gnu.org
@ 2010-12-08 16:38 ` rearnsha at gcc dot gnu.org
  2010-12-08 16:49 ` rearnsha at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2010-12-08 16:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46631

--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2010-12-08 16:38:14 UTC ---
Author: rearnsha
Date: Wed Dec  8 16:38:10 2010
New Revision: 167595

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167595
Log:
2010-12-08  Richard Earnshaw  <rearnsha@arm.com>

    PR target/46631
    * arm.c (thumb2_reorg): Also try to reduce <commutative_op> Rd, Rn, Rd
    into a 16-bit instruction.

2010-12-08  Wei Guozhi  <carrot@google.com>

    PR target/46631
    * gcc.target/arm/pr46631: New testcase.

Added:
    trunk/gcc/testsuite/gcc.target/arm/pr46631.c   (with props)
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/testsuite/ChangeLog

Propchange: trunk/gcc/testsuite/gcc.target/arm/pr46631.c
            ('svn:eol-style' added)

Propchange: trunk/gcc/testsuite/gcc.target/arm/pr46631.c
            ('svn:keywords' added)


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

* [Bug target/46631] Change operands order so we can use 16bit and instead of 32bit in thumb2
  2010-11-24  2:57 [Bug target/46631] New: Change operands order so we can use 16bit and instead of 32bit in thumb2 carrot at google dot com
                   ` (2 preceding siblings ...)
  2010-12-08 16:38 ` rearnsha at gcc dot gnu.org
@ 2010-12-08 16:49 ` rearnsha at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2010-12-08 16:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46631

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0

--- Comment #3 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2010-12-08 16:48:46 UTC ---
Fixed in trunk


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

end of thread, other threads:[~2010-12-08 16:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-24  2:57 [Bug target/46631] New: Change operands order so we can use 16bit and instead of 32bit in thumb2 carrot at google dot com
2010-11-24 12:09 ` [Bug target/46631] " rguenth at gcc dot gnu.org
2010-12-03  9:55 ` ramana at gcc dot gnu.org
2010-12-08 16:38 ` rearnsha at gcc dot gnu.org
2010-12-08 16:49 ` rearnsha 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).