lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 21 Apr 2013 05:29:28 +0100 (BST)
From:	"Maciej W. Rozycki" <>
To:	"H. Peter Anvin" <>
cc:	Linux Arch Mailing List <>,
	Linux Kernel Mailing List <>
Subject: Re: Using __int128 on 64-bit architectures

On Sun, 17 Mar 2013, H. Peter Anvin wrote:

> How desirable/portable is it to use __int128 on non-x86 64-bit
> architectures to get a 64*64 -> 128 bit multiply?  On x86-64 this works
> extremely well, but I'm worried about that needlessly breaking on other
> architectures.

 Hmm, nobody has replied, so just FYI such widening multiplication is 
available in all 64-bit MIPS hardware and GCC has supported it since 4.4 
or mid 2008 (older versions used a libgcc __multi3 helper, not quite so 
efficient as you can imagine).

$ cat mulditi3.c
typedef int int128_t __attribute__((mode(TI)));

int128_t mulditi3(long x, long y)
	int128_t _x = x, _y = y;
	return _x * _y;
$ mips64-linux-gcc -O2 -c mulditi3.c
$ mips64-linux-objdump -d mulditi3.o

mulditi3.o:     file format elf64-tradbigmips

Disassembly of section .text:

0000000000000000 <mulditi3>:
   0:	0085001c 	dmult	a0,a1
   4:	00001812 	mflo	v1
   8:	03e00008 	jr	ra
   c:	00001010 	mfhi	v0

(MFLO and MFHI are register moves from the MD accumulator to GPRs).  
There's an unsigned instruction variant as well.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists