Re: [RFC][PATCH 2/3] math128: Introduce {mult,add,cmp}_u128
From: Linus Torvalds
Date: Tue Apr 24 2012 - 21:46:34 EST
On Tue, Apr 24, 2012 at 2:54 PM, Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote:
>
> that does generate slightly better code in that it avoids some masks on
> 64bit:
>
> @@ -7,12 +7,11 @@
> .LFB38:
> .cfi_startproc
> movq %rdi, %r8
> - movq %rdi, %rdx
> movq %rsi, %rcx
> + mov %edi, %edx
> shrq $32, %r8
> - andl $4294967295, %edx
> shrq $32, %rcx
> - andl $4294967295, %esi
> + mov %esi, %esi
Oh christ.
What insane version of gcc is that? Can you please make a gcc bug-report?
Because a compiler that generates an instruction sequence like
movq %rdi,%rsi
andl $4294967295, %esi
is just so fricking stupid that it's outright buggy. That's just
crazy. It's demented. It's an "and" with all bits set.
But yeah, I do think that in general using a cast to 32-bit instead of
a mask to 32-bit is easier for the compiler. Although that still is a
particularly stupid code sequence to use.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/