Revision 1ac5889f target-s390x/int_helper.c
b/target-s390x/int_helper.c | ||
---|---|---|
30 | 30 |
#endif |
31 | 31 |
|
32 | 32 |
/* 64/64 -> 128 unsigned multiplication */ |
33 |
void HELPER(mlg)(CPUS390XState *env, uint32_t r1, uint64_t v2)
|
|
33 |
uint64_t HELPER(mul128)(CPUS390XState *env, uint64_t v1, uint64_t v2)
|
|
34 | 34 |
{ |
35 |
#if HOST_LONG_BITS == 64 && defined(__GNUC__) |
|
36 |
/* assuming 64-bit hosts have __uint128_t */ |
|
37 |
__uint128_t res = (__uint128_t)env->regs[r1 + 1]; |
|
38 |
|
|
39 |
res *= (__uint128_t)v2; |
|
40 |
env->regs[r1] = (uint64_t)(res >> 64); |
|
41 |
env->regs[r1 + 1] = (uint64_t)res; |
|
42 |
#else |
|
43 |
mulu64(&env->regs[r1 + 1], &env->regs[r1], env->regs[r1 + 1], v2); |
|
44 |
#endif |
|
35 |
uint64_t reth; |
|
36 |
mulu64(&env->retxl, &reth, v1, v2); |
|
37 |
return reth; |
|
45 | 38 |
} |
46 | 39 |
|
47 | 40 |
/* 128 -> 64/64 unsigned division */ |
Also available in: Unified diff