From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Juri Lelli <juri.lelli@gmail.com>, Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC][PATCH 3/3] math128, x86_64: Implement {mult,add}_u128 in 64bit asm
Date: Wed, 25 Apr 2012 00:00:43 +0200 [thread overview]
Message-ID: <1335304843.28150.246.camel@twins> (raw)
In-Reply-To: <4F96E0EB.7030904@zytor.com>
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.
next prev parent reply other threads:[~2012-04-24 22:00 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 16:10 [RFC][PATCH 0/3] gcc work-around and math128 Peter Zijlstra
2012-04-24 16:10 ` [RFC][PATCH 1/3] kernel,sched,time: Clean up gcc work-arounds Peter Zijlstra
2012-04-24 16:10 ` Peter Zijlstra
2012-04-24 19:39 ` Linus Torvalds
2012-04-25 0:14 ` Stephen Rothwell
2012-04-25 0:14 ` Stephen Rothwell
2012-04-24 16:10 ` [RFC][PATCH 2/3] math128: Introduce {mult,add,cmp}_u128 Peter Zijlstra
2012-04-24 16:10 ` Peter Zijlstra
2012-04-24 19:37 ` Linus Torvalds
2012-04-24 19:43 ` Peter Zijlstra
2012-04-24 19:43 ` Peter Zijlstra
2012-04-24 20:12 ` Måns Rullgård
2012-04-24 20:12 ` Måns Rullgård
2012-04-24 21:54 ` Peter Zijlstra
2012-04-25 0:09 ` H. Peter Anvin
2012-04-25 1:46 ` Linus Torvalds
2012-04-25 1:46 ` Linus Torvalds
2012-04-25 8:35 ` Peter Zijlstra
2012-04-25 10:13 ` Peter Zijlstra
2012-04-25 0:23 ` Stephen Rothwell
2012-04-25 8:11 ` Peter Zijlstra
2012-04-25 11:23 ` Geert Uytterhoeven
2012-04-25 11:58 ` Peter Zijlstra
2012-04-25 14:35 ` Geert Uytterhoeven
2012-04-25 15:09 ` Peter Zijlstra
2012-04-24 16:10 ` [RFC][PATCH 3/3] math128, x86_64: Implement {mult,add}_u128 in 64bit asm Peter Zijlstra
2012-04-24 16:10 ` Peter Zijlstra
2012-04-24 16:34 ` H. Peter Anvin
2012-04-24 16:36 ` Peter Zijlstra
2012-04-24 17:17 ` H. Peter Anvin
2012-04-24 17:19 ` Peter Zijlstra
2012-04-24 17:20 ` H. Peter Anvin
2012-04-24 22:00 ` Peter Zijlstra [this message]
2012-04-24 22:03 ` H. Peter Anvin
2012-04-24 17:22 ` [RFC][PATCH 0/3] gcc work-around and math128 H. Peter Anvin
2012-04-24 17:27 ` H. Peter Anvin
2012-04-24 21:15 ` Andy Lutomirski
2012-04-24 21:18 ` Linus Torvalds
2012-04-24 21:32 ` Peter Zijlstra
2012-04-24 21:35 ` Andy Lutomirski
2012-04-24 21:35 ` Andy Lutomirski
2012-04-24 21:51 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1335304843.28150.246.camel@twins \
--to=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=juri.lelli@gmail.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).