public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/40129] New: M16C invalid shift count used by pack_d -> ashldi3
@ 2009-05-13 9:47 eightdot at hotmail dot com
2009-05-14 2:53 ` [Bug target/40129] " dj at redhat dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: eightdot at hotmail dot com @ 2009-05-13 9:47 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2145 bytes --]
some disasm listings to show what is going wrong..
i cant find the guilty source files:-(
000fa8b2 <___pack_d>:
<snip>
fadb7: 75 42 push.w:g r2 //pushing 64 bit exponent [63:48]
fadb9: 75 42 push.w:g r2 //pushing 64 bit exponent [47:32]
fadbb: 75 42 push.w:g r2 //pushing 64 bit exponent [31:16]
fadbd: 75 40 push.w:g r0 //pushing 64 bit exponent [15:0]
fadbf: 75 c2 34 00 mov.w:g #52,r2 //shift count to get exponent in
[62:52]
fadc3: fd 83 6f 0f jsr.a f6f83 <___ashldi3>
___ashldi3 detects that it needs to shift more then 32 bits and prepares to
shift by -(32-52) = 20 bits (and after that 'shift' by 32 by moving registers
around)
000f6f83 <___ashldi3>:
<snip>
f7055: 73 b2 07 mov.w:g 7[fb],r2 //src bit[15:0]
f7058: 73 b0 05 mov.w:g 5[fb],r0 //src bit[31:16]
f705b: 72 b2 e2 mov.b:g -30[fb],r1l //shift count (20)
f705e: 72 23 mov.b:g r1l,r1h //shift count (20)
f7060: eb 21 sha.l r1h,r2r0 //the shift
The M16C/60, M16C/20, M16C/Tine Series Software Manual says:
"If src is a register and you selected (.W) or (.L) for
the size specifier (.size), the number of shifts
is 16 to +16. Although you can set 0, no bits are shifted and
no flags are changed. If you set a value less than 16 or
greater than +16, the result of shift is indeterminate."
the actual result on my hardware is a shift by 4 (20 & 0xf).
i think ___ashldi3 (and friends!)
should (also) check if the shift is >16
and only do the shift % 16 with the shift instruction and do the rest of the
shift by moving registers.
--
Summary: M16C invalid shift count used by pack_d -> ashldi3
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: eightdot at hotmail dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: m32c-unknown-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40129
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/40129] M16C invalid shift count used by pack_d -> ashldi3
2009-05-13 9:47 [Bug c/40129] New: M16C invalid shift count used by pack_d -> ashldi3 eightdot at hotmail dot com
@ 2009-05-14 2:53 ` dj at redhat dot com
2009-05-18 7:14 ` eightdot at hotmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: dj at redhat dot com @ 2009-05-14 2:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from dj at redhat dot com 2009-05-14 02:52 -------
Do you have a test case that shows an actual problem? Because the m32c port
has special code that tests for shift counts outside -16..16 and pre-shifts the
value to make the shift count fit (see gcc/config/m32c/m32c.c
m32c_prepare_shift()).
--
dj at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dj at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40129
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/40129] M16C invalid shift count used by pack_d -> ashldi3
2009-05-13 9:47 [Bug c/40129] New: M16C invalid shift count used by pack_d -> ashldi3 eightdot at hotmail dot com
2009-05-14 2:53 ` [Bug target/40129] " dj at redhat dot com
@ 2009-05-18 7:14 ` eightdot at hotmail dot com
2009-05-18 7:15 ` eightdot at hotmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: eightdot at hotmail dot com @ 2009-05-18 7:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from eightdot at hotmail dot com 2009-05-18 07:13 -------
mm it apreas to be fixed somewhere between 4.1.1 and 4.4.2
(revision 109661 and 109987 seams to be good candidates afaik in viewcvs but i
cant find which release this is corresponding to..)
input main.c:
output "/usr/libexec/gcc/m32c-unknown-elf/4.1.1/cc1 -mcpu=m16c main.c":
enter #13
mov.w r1,-10[fb]
mov.w #4660,-6[fb]
mov.w #22136,-8[fb]
mov.w -10[fb],r0
mov.w r0,-13[fb]
mov.w -6[fb],r2
mov.w -8[fb],r0
mov.b -13[fb],r1l
neg.b r1l
mov.b r1l,-11[fb]
mov.b -11[fb],r1l
mov.b r1l,r1h
sha.l r1h,r2r0
mov.w r2,-2[fb]
mov.w r0,-4[fb]
mov.w -4[fb],r0
exitd
output "/usr/src/cross/m32c/build/gcc-4.4.0/gcc/cc1 -mcpu=m16c main.c"
_main:
enter #15-2
mov.w r1,-10[fb]
mov.w #4660,-6[fb]
mov.w #22136,-8[fb]
mov.w -10[fb],r0
mov.w r0,-13[fb]
mov.w -6[fb],r2
mov.w -8[fb],r0
mov.b -13[fb],r1l
neg.b r1l
mov.b r1l,-11[fb]
cmp.b #-16,-11[fb]
jge .L2
sha.l #-8,r2r0
sha.l #-8,r2r0
add.b #16,-11[fb]
.L2:
mov.b -11[fb],r1h
sha.l r1h,r2r0
mov.w r2,-2[fb]
mov.w r0,-4[fb]
mov.w -4[fb],r0
exitd
so it works ok for 4.4.0
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40129
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/40129] M16C invalid shift count used by pack_d -> ashldi3
2009-05-13 9:47 [Bug c/40129] New: M16C invalid shift count used by pack_d -> ashldi3 eightdot at hotmail dot com
2009-05-14 2:53 ` [Bug target/40129] " dj at redhat dot com
2009-05-18 7:14 ` eightdot at hotmail dot com
@ 2009-05-18 7:15 ` eightdot at hotmail dot com
2009-05-18 19:16 ` dj at redhat dot com
2009-05-19 11:23 ` eightdot at hotmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: eightdot at hotmail dot com @ 2009-05-18 7:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from eightdot at hotmail dot com 2009-05-18 07:15 -------
input:
int main(int argc)
{
long a=0x12345678;
long b;
b=a>>argc;
return (b);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40129
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/40129] M16C invalid shift count used by pack_d -> ashldi3
2009-05-13 9:47 [Bug c/40129] New: M16C invalid shift count used by pack_d -> ashldi3 eightdot at hotmail dot com
` (2 preceding siblings ...)
2009-05-18 7:15 ` eightdot at hotmail dot com
@ 2009-05-18 19:16 ` dj at redhat dot com
2009-05-19 11:23 ` eightdot at hotmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: dj at redhat dot com @ 2009-05-18 19:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dj at redhat dot com 2009-05-18 19:16 -------
Yes, those two changes are the fix you need. However, those fixes were over
three years ago, so I consider this bug "already fixed". If you agree, please
close this bug.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40129
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/40129] M16C invalid shift count used by pack_d -> ashldi3
2009-05-13 9:47 [Bug c/40129] New: M16C invalid shift count used by pack_d -> ashldi3 eightdot at hotmail dot com
` (3 preceding siblings ...)
2009-05-18 19:16 ` dj at redhat dot com
@ 2009-05-19 11:23 ` eightdot at hotmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: eightdot at hotmail dot com @ 2009-05-19 11:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from eightdot at hotmail dot com 2009-05-19 11:23 -------
i agree but could find in which release they are first included..
but already fixed in what i now use (4.3.3)...
--
eightdot at hotmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40129
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-05-19 11:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-13 9:47 [Bug c/40129] New: M16C invalid shift count used by pack_d -> ashldi3 eightdot at hotmail dot com
2009-05-14 2:53 ` [Bug target/40129] " dj at redhat dot com
2009-05-18 7:14 ` eightdot at hotmail dot com
2009-05-18 7:15 ` eightdot at hotmail dot com
2009-05-18 19:16 ` dj at redhat dot com
2009-05-19 11:23 ` eightdot at hotmail dot com
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).