digitalmars.D.ldc - is there a way to do _umul128 on posix ?
- Newbie2019 (4/4) Sep 09 2019 I need _umul128 to do the fast math, is there a way to made it
- Newbie2019 (2/6) Sep 09 2019 I need this to work: __uint128_t r = uint64_t * uint64_t;
- a11e99z (17/21) Sep 10 2019 https://run.dlang.io/is/2xYt5j
- a11e99z (4/26) Sep 10 2019 just realized that D uses the registers in the reverse order than
- Kagamin (1/1) Sep 10 2019 https://forum.dlang.org/post/nydunscuwdcinamqails@forum.dlang.org
- Newbie2019 (4/8) Sep 10 2019 Thanks, this work great for me.
I need _umul128 to do the fast math, is there a way to made it work for posix ? On windows I can use _umul128, is there a ASM or work around in LDC to do this on posix ?
Sep 09 2019
On Tuesday, 10 September 2019 at 04:13:25 UTC, Newbie2019 wrote:I need _umul128 to do the fast math, is there a way to made it work for posix ? On windows I can use _umul128, is there a ASM or work around in LDC to do this on posix ?I need this to work: __uint128_t r = uint64_t * uint64_t;
Sep 09 2019
On Tuesday, 10 September 2019 at 04:13:25 UTC, Newbie2019 wrote:I need _umul128 to do the fast math, is there a way to made it work for posix ? On windows I can use _umul128, is there a ASM or work around in LDC to do this on posix ?https://run.dlang.io/is/2xYt5j struct m128 { ulong lo, hi; } // REX.W + F7 /4 MUL r/m64 (RDX:RAX ← RAX ∗ r/m64). // https://en.wikipedia.org/wiki/X86_calling_conventions#x86-64_calling_conventions // Windows RCX, RDX, R8, R9. returns RAX only // Linux RDI, RSI, RDX, RCX, R8, R9. returns RDX:RAX m128 mul128( ulong a, ulong b ) pure nothrow nogc trusted { asm pure nogc nothrow { naked; mov RAX, RDI; mul RSI; ret; } } // probably u can do it inline
Sep 10 2019
On Tuesday, 10 September 2019 at 07:34:49 UTC, a11e99z wrote:On Tuesday, 10 September 2019 at 04:13:25 UTC, Newbie2019 wrote:just realized that D uses the registers in the reverse order than Linux convention (maybe Windows too). one more WTF.I need _umul128 to do the fast math, is there a way to made it work for posix ? On windows I can use _umul128, is there a ASM or work around in LDC to do this on posix ?https://run.dlang.io/is/2xYt5j struct m128 { ulong lo, hi; } // REX.W + F7 /4 MUL r/m64 (RDX:RAX ← RAX ∗ r/m64). // https://en.wikipedia.org/wiki/X86_calling_conventions#x86-64_calling_conventions // Windows RCX, RDX, R8, R9. returns RAX only // Linux RDI, RSI, RDX, RCX, R8, R9. returns RDX:RAX m128 mul128( ulong a, ulong b ) pure nothrow nogc trusted { asm pure nogc nothrow { naked; mov RAX, RDI; mul RSI; ret; } } // probably u can do it inline
Sep 10 2019
https://forum.dlang.org/post/nydunscuwdcinamqails forum.dlang.org
Sep 10 2019
On Tuesday, 10 September 2019 at 08:50:39 UTC, Kagamin wrote:https://forum.dlang.org/post/nydunscuwdcinamqails forum.dlang.orgThanks, this work great for me. On Tuesday, 10 September 2019 at 07:34:49 UTC, a11e99z wrote:On Tuesday, 10 September 2019 at 04:13:25 UTC, Newbie2019 wrote: https://run.dlang.io/is/2xYt5j struct m128 { ulong lo, hi; }Thanks for the tips.
Sep 10 2019