[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1335304843.28150.246.camel@twins>
Date: Wed, 25 Apr 2012 00:00:43 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Juri Lelli <juri.lelli@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [RFC][PATCH 3/3] math128, x86_64: Implement {mult,add}_u128 in
64bit asm
On Tue, 2012-04-24 at 10:20 -0700, H. Peter Anvin wrote:
> I have been told __int128 works for all versions of gcc which support
> x86-64, but I haven't verified it myself, no.
The gcc version I have seems to grok it:
u128 mult_u64_u128(u64 a, u64 b)
{
unsigned __int128 t = a;
t *= b;
return U128_INIT(t >> 64, t);
}
#define mult_u64_u128 mult_u64_u128
generates:
.p2align 4,,15
.globl mult_u64_u128
.type mult_u64_u128, @function
mult_u64_u128:
.LFB38:
.cfi_startproc
movq %rsi, %rax
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
mulq %rdi
popq %rbp
.cfi_def_cfa_offset 8
movq %rax, %rdi
movq %rdx, %rax
movq %rdi, %rdx
ret
.cfi_endproc
.LFE38:
.size mult_u64_u128, .-mult_u64_u128
I haven't been able to make add_u128 generate sane code using __int128,
the conversion between my struct and the __int128 layout makes a horrid
mess.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists