public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/43473] hword size destination variable induces suboptimal code generation compared to full word size var
       [not found] <bug-43473-4@http.gcc.gnu.org/bugzilla/>
@ 2024-03-15  3:19 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-15  3:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The difference is.
for ma:
```
(insn 11 10 13 2 (set (reg:SI 122)
        (ior:SI (subreg:SI (reg:HI 119 [ a ]) 0)
            (const_int -16384 [0xffffffffffffc000]))) "/app/example.cpp":9:11
110 {*iorsi3_insn}
     (expr_list:REG_DEAD (reg:HI 119 [ a ])
        (nil)))
```

vs for mb:
```
(insn 9 8 10 2 (set (reg:SI 121 [ _3 ])
        (ior:SI (reg:SI 120 [ b ])
            (const_int 49152 [0xc000]))) "/app/example.cpp":16:22 110
{*iorsi3_insn}
     (expr_list:REG_DEAD (reg:SI 120 [ b ])
        (nil)))
```

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

* [Bug rtl-optimization/43473] hword size destination variable induces suboptimal code generation compared to full word size var
  2010-03-21 20:30 [Bug web/43473] New: " mirq-gccboogs at rere dot qmqm dot pl
  2010-03-23 13:21 ` [Bug rtl-optimization/43473] " rearnsha at gcc dot gnu dot org
@ 2010-03-23 14:37 ` mirq-gccboogs at rere dot qmqm dot pl
  1 sibling, 0 replies; 3+ messages in thread
From: mirq-gccboogs at rere dot qmqm dot pl @ 2010-03-23 14:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from mirq-gccboogs at rere dot qmqm dot pl  2010-03-23 14:37 -------
Sorry, I try to split encountered problems into simple testcases and after a
few I forgot to add the common things to bugreports.

The difference between ma() and mb() in the example is a global's size:

ma():
- unsigned short global, generates two insns for the operation:

        ldrh    r2, [r3, #0]
        mvn     r2, r2, asl #18
        mvn     r2, r2, lsr #18
        strh    r2, [r3, #0]    @ movhi

mb():

- unsigned int global, generates one insn for the same operation:

        ldr     r2, [r3, #0]
        orr     r2, r2, #49152
        str     r2, [r3, #0]

'u' and 'd' are compile time constants.

compiled with:

arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -O3 -S a.c

$ LANG=C arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/src/gcc-armtest/bin/arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/usr/src/gcc-armtest/libexec/gcc/arm-none-eabi/4.5.0/lto-wrapper
Target: arm-none-eabi
Configured with: ../gcc-combined/configure --with-newlib
--prefix=/usr/src/gcc-armtest --target arm-none-eabi --enable-languages=c
--disable-libssp
Thread model: single
gcc version 4.5.0 20100319 (experimental) (GCC) 

$ LANG=C svn info
Path: .
URL: svn://gcc.gnu.org/svn/gcc/trunk
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 157582
Node Kind: directory
Schedule: normal
Last Changed Author: bernds
Last Changed Rev: 157582
Last Changed Date: 2010-03-19 19:41:22 +0100 (Fri, 19 Mar 2010)


-- 


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


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

* [Bug rtl-optimization/43473] hword size destination variable induces suboptimal code generation compared to full word size var
  2010-03-21 20:30 [Bug web/43473] New: " mirq-gccboogs at rere dot qmqm dot pl
@ 2010-03-23 13:21 ` rearnsha at gcc dot gnu dot org
  2010-03-23 14:37 ` mirq-gccboogs at rere dot qmqm dot pl
  1 sibling, 0 replies; 3+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2010-03-23 13:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rearnsha at gcc dot gnu dot org  2010-03-23 13:21 -------
You haven't explained what you think is wrong, and you haven't even said what
options you used to generated the code.

If the optimizer is not on the generated code *will* be very poor.  That's why
we have an optimizer.


-- 

rearnsha at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

end of thread, other threads:[~2024-03-15  3:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-43473-4@http.gcc.gnu.org/bugzilla/>
2024-03-15  3:19 ` [Bug rtl-optimization/43473] hword size destination variable induces suboptimal code generation compared to full word size var pinskia at gcc dot gnu.org
2010-03-21 20:30 [Bug web/43473] New: " mirq-gccboogs at rere dot qmqm dot pl
2010-03-23 13:21 ` [Bug rtl-optimization/43473] " rearnsha at gcc dot gnu dot org
2010-03-23 14:37 ` mirq-gccboogs at rere dot qmqm dot pl

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).