public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/46975] New: Replace 32 bit instructions with 16 bit instructions in thumb2
@ 2010-12-16  0:39 carrot at google dot com
  2010-12-16 15:25 ` [Bug target/46975] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: carrot at google dot com @ 2010-12-16  0:39 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Replace 32 bit instructions with 16 bit instructions
                    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


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

int gzeof (int s)
{
    return s == 1;
}

GCC 4.6 generates:

00000000 <gzeof>:
   0:    f1a0 0301     sub.w    r3, r0, #1    // A
   4:    4258          negs    r0, r3
   6:    eb40 0003     adc.w    r0, r0, r3      // B
   a:    4770          bx    lr

Notice that instructions A and B are 32 bits, we can change them to subs and
adcs so both will be 16 bits.

The code sequence is generated by the following peephole2

 8731 ;; Attempt to improve the sequence generated by the compare_scc splitters
 8732 ;; not to use conditional execution.
 8733 (define_peephole2
 8734   [(set (reg:CC CC_REGNUM)
 8735         (compare:CC (match_operand:SI 1 "register_operand" "")
 8736                     (match_operand:SI 2 "arm_rhs_operand" "")))
 8737    (cond_exec (ne (reg:CC CC_REGNUM) (const_int 0))
 8738               (set (match_operand:SI 0 "register_operand" "") (const_int
0)))
 8739    (cond_exec (eq (reg:CC CC_REGNUM) (const_int 0))
 8740               (set (match_dup 0) (const_int 1)))
 8741    (match_scratch:SI 3 "r")]
 8742   "TARGET_32BIT"
 8743   [(set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
 8744    (parallel
 8745     [(set (reg:CC CC_REGNUM)
 8746           (compare:CC (const_int 0) (match_dup 3)))
 8747      (set (match_dup 0) (minus:SI (const_int 0) (match_dup 3)))])
 8748    (set (match_dup 0)
 8749         (plus:SI (plus:SI (match_dup 0) (match_dup 3))
 8750                  (geu:SI (reg:CC CC_REGNUM) (const_int 0))))])
 8751 

We should change the new instructions to use subs and adcs.


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

* [Bug target/46975] Replace 32 bit instructions with 16 bit instructions in thumb2
  2010-12-16  0:39 [Bug target/46975] New: Replace 32 bit instructions with 16 bit instructions in thumb2 carrot at google dot com
@ 2010-12-16 15:25 ` rguenth at gcc dot gnu.org
  2011-04-04 21:22 ` 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-12-16 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

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/46975] Replace 32 bit instructions with 16 bit instructions in thumb2
  2010-12-16  0:39 [Bug target/46975] New: Replace 32 bit instructions with 16 bit instructions in thumb2 carrot at google dot com
  2010-12-16 15:25 ` [Bug target/46975] " rguenth at gcc dot gnu.org
@ 2011-04-04 21:22 ` ramana at gcc dot gnu.org
  2011-04-28 16:45 ` rguenth at gcc dot gnu.org
  2023-05-15  5:19 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ramana at gcc dot gnu.org @ 2011-04-04 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.04.04 21:22:11
                 CC|                            |ramana at gcc dot gnu.org
   Target Milestone|---                         |4.7.0
     Ever Confirmed|0                           |1


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

* [Bug target/46975] Replace 32 bit instructions with 16 bit instructions in thumb2
  2010-12-16  0:39 [Bug target/46975] New: Replace 32 bit instructions with 16 bit instructions in thumb2 carrot at google dot com
  2010-12-16 15:25 ` [Bug target/46975] " rguenth at gcc dot gnu.org
  2011-04-04 21:22 ` ramana at gcc dot gnu.org
@ 2011-04-28 16:45 ` rguenth at gcc dot gnu.org
  2023-05-15  5:19 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-28 16:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.7.0                       |---


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

* [Bug target/46975] Replace 32 bit instructions with 16 bit instructions in thumb2
  2010-12-16  0:39 [Bug target/46975] New: Replace 32 bit instructions with 16 bit instructions in thumb2 carrot at google dot com
                   ` (2 preceding siblings ...)
  2011-04-28 16:45 ` rguenth at gcc dot gnu.org
@ 2023-05-15  5:19 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-15  5:19 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The fix was committed as r0-109399-g527e82c2679a4b but since the commit log
didn't have the bug # in it, it didn't reach here. The bug # is in the
changelog though.

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

end of thread, other threads:[~2023-05-15  5:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-16  0:39 [Bug target/46975] New: Replace 32 bit instructions with 16 bit instructions in thumb2 carrot at google dot com
2010-12-16 15:25 ` [Bug target/46975] " rguenth at gcc dot gnu.org
2011-04-04 21:22 ` ramana at gcc dot gnu.org
2011-04-28 16:45 ` rguenth at gcc dot gnu.org
2023-05-15  5:19 ` pinskia 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).