* SH code suboptimal
@ 2001-01-09 10:58 Hartmut Schirmer
0 siblings, 0 replies; only message in thread
From: Hartmut Schirmer @ 2001-01-09 10:58 UTC (permalink / raw)
To: gcc
Hi,
compiling this file
---------------
# 1 "long.c"
extern unsigned long long ull1, ull2;
extern long long ll1, ll2;
# 18 "long.c"
void shift_R_u_2(void) { ull1 = (ull2) >> (2); }
---------------
with the 2001-01-08 snapshort gives the following output:
---------------
.file "long.c"
! GNU C version 2.97 20010108 (experimental) (sh-elf)
! compiled by GNU C version 2.7.2.3.
! options passed: -lang-c -D__GNUC__=2 -D__GNUC_MINOR__=97
! -D__GNUC_PATCHLEVEL__=0 -D__sh__ -D__ELF__ -D__sh__ -D__ELF__ -Acpu=sh
! -Amachine=sh -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -Wall -D__sh1__ -O3 -Wall
! -fomit-frame-pointer -fschedule-insns -fverbose-asm
[..]
_shift_R_u_2:
mov.l .L3,r2
mov.l @r2,r5
mov r5,r3
mov.l @(4,r2),r6
shll16 r3
shlr2 r3
shll16 r3
mov r6,r0 ! unneeded move
shlr2 r0 ! shlr2 r6
mov r3,r4 ! unneeded move
or r0,r4 ! or r6,r3
mov.l .L4,r0
shlr2 r5
mov.l r5,@r0
rts
mov.l r4,@(4,r0) ! mov.l r3,@(4,r0)
..L5:
.align 2
..L3:
.long _ull2
..L4:
.long _ull1
[...]
---------------
which could save two moves and two registers
Hartmut
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-01-09 10:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-09 10:58 SH code suboptimal Hartmut Schirmer
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).