Re: [RFC][PATCH 3/3] math128, x86_64: Implement {mult,add}_u128 in 64bit asm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux