Re: Runaway cron task on 2.5.63/4 bk?

george anzinger (george@mvista.com)
Tue, 11 Mar 2003 15:46:11 -0800


Andrew Morton wrote:
> Linus Torvalds <torvalds@transmeta.com> wrote:
>
>>
>>On Tue, 11 Mar 2003, Andrew Morton wrote:
>>
>>>2.95.3 and 3.2.1 seem to do it right?
>>
>>Try the "64x32->64" version. gcc didn't use to get that one right, but
>>maybe it does now.
>>
>
>
>
> long a;
> long long b;
> long long c;
>
> void foo(void)
> {
> c = a * b;
> }
>
> It seems to get that wrong. At least, there are three multiplies in there.
> 3.2.1 is similar.
>

You might try it unsigned. There are issues with the signed version.
>
> .file "t.c"
> .version "01.01"
> gcc2_compiled.:
> .text
> .align 4
> .globl foo
> .type foo,@function
> foo:
> pushl %ebp
> movl %esp,%ebp
> subl $16,%esp
> pushl %esi
> pushl %ebx
> movl a,%eax
> movl %eax,%ebx
> movl %eax,%esi
> sarl $31,%esi
> movl %ebx,%eax
> mull b
> movl %eax,-8(%ebp)
> movl %edx,-4(%ebp)
> movl %ebx,%eax
> imull b+4,%eax
> addl %eax,%edx
> movl %edx,-4(%ebp)
> movl b,%eax
> imull %esi,%eax
> addl %eax,-4(%ebp)
> movl -8(%ebp),%eax
> movl -4(%ebp),%edx
> movl %eax,c
> movl %edx,c+4
> popl %ebx
> popl %esi
> movl %ebp,%esp
> popl %ebp
> ret
> .Lfe1:
> .size foo,.Lfe1-foo
> .comm a,4,4
> .comm b,8,4
> .comm c,8,4
> .ident "GCC: (GNU) 2.95.3 20010315 (release)"
>
>

-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/