public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/49468] New: SH Target: inefficient integer abs code
@ 2011-06-19 15:15 oleg.endo@t-online.de
  2011-06-19 15:30 ` [Bug target/49468] " oleg.endo@t-online.de
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: oleg.endo@t-online.de @ 2011-06-19 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: SH Target: inefficient integer abs code
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: oleg.endo@t-online.de


The generated code for abs:SI and abs:DI is a bit inefficient:

int abs (int i)
{
  return (i < 0) ? -i : i;
}

mov    r4,r1
shll    r1
subc    r1,r1
mov    r1,r0
xor    r4,r0
rts
sub    r1,r0


long long abs (long long i)
{
  return (i < 0) ? -i : i;
}

mov    r4,r3
shll    r3
subc    r3,r3
mov    r5,r1
xor    r3,r1
mov    r3,r0
clrt
xor    r4,r0
subc    r3,r1
rts    
subc    r3,r0


There is a define_split in sh.md which is supposed to handle the special case
for SH4 but it is not doing anything. The problem has been around since a
couple of GCC 4.x versions. 



sh-elf-gcc -v
Using built-in specs.
COLLECT_GCC=sh-elf-gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/sh-elf/4.7.0/lto-wrapper
Target: sh-elf
Configured with: ../gcc-trunk/configure --target=sh-elf --prefix=/usr/local
--enable-languages=c,c++ --enable-multilib --disable-libssp --without-headers
--disable-nls --disable-werror --enable-lto --with-newlib --with-gnu-as
--with-gnu-ld --with-system-zlib : (reconfigured) ../gcc-trunk/configure
--target=sh-elf --prefix=/usr/local --enable-languages=c,c++ --enable-multilib
--disable-libssp --without-headers --disable-nls --disable-werror --enable-lto
--with-newlib --with-gnu-as --with-gnu-ld --with-system-zlib : (reconfigured)
../gcc-trunk/configure --target=sh-elf --prefix=/usr/local
--enable-languages=c,c++ --enable-multilib --disable-libssp --without-headers
--disable-nls --disable-werror --enable-lto --with-newlib --with-gnu-as
--with-gnu-ld --with-system-zlib : (reconfigured) ../gcc-trunk/configure
--target=sh-elf --prefix=/usr/local --enable-multilib --disable-libssp
--without-headers --disable-nls --disable-werror --enable-lto --with-newlib
--with-gnu-as --with-gnu-ld --with-system-zlib target_alias=sh-elf CFLAGS=-Os
CXXFLAGS=-Os --enable-languages=c,c++,lto --no-create --no-recursion
Thread model: single
gcc version 4.7.0 20110619 (experimental) (GCC)


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

end of thread, other threads:[~2013-12-05 19:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-19 15:15 [Bug target/49468] New: SH Target: inefficient integer abs code oleg.endo@t-online.de
2011-06-19 15:30 ` [Bug target/49468] " oleg.endo@t-online.de
2011-06-19 15:49 ` oleg.endo@t-online.de
2011-06-22 22:38 ` kkojima at gcc dot gnu.org
2011-06-26 20:49 ` oleg.endo@t-online.de
2011-06-27  6:40 ` kkojima at gcc dot gnu.org
2011-06-29  1:37 ` oleg.endo@t-online.de
2011-09-25 12:53 ` oleg.endo@t-online.de
2012-02-26 23:38 ` olegendo at gcc dot gnu.org
2012-02-28  8:44 ` olegendo at gcc dot gnu.org
2012-02-29 23:23 ` kkojima at gcc dot gnu.org
2012-03-14 23:10 ` olegendo at gcc dot gnu.org
2013-12-05 19:26 ` olegendo 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).