[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/13] target-ppc: add mask_u128 routine
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 02/13] target-ppc: add mask_u128 routine |
Date: |
Mon, 5 Dec 2016 09:36:40 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 12/05/2016 03:25 AM, Nikunj A Dadhania wrote:
> +#if defined(CONFIG_INT128)
> +FUNC_MASK(mask_u128, Int128, 128, Int128, ~((__uint128_t)0));
> +#else
> +static inline Int128 mask_u128(int start, int end)
> +{
> + Int128 r = {0};
> + if (start > 63) {
> + r.hi = 0;
> + r.lo = mask_u64(start - 64, end - 64);
> + } else if (end < 64) {
> + r.hi = mask_u64(start, end);
> + r.lo = 0;
> + } else {
> + r.hi = mask_u64(start, 63);
> + r.lo = mask_u64(0, end - 64);
> + }
> + return r;
> +}
> #endif
First, I would really really like you to stop adding *any* ifdefs on
CONFIG_INT128. All that's going to do is make sure that there's code that is
almost never tested, since x86_64 (and other 64-bit hosts) does support int128.
Second, you're not using the Int128 interface correctly. Better would be
static inline Int128 mask_u128(int start, int end)
{
uint64_t hi, lo;
if (start > 63) {
hi = 0;
lo = mask_u64(start - 64, end - 64);
} else if (end < 64) {
hi = mask_u64(start, end);
lo = 0;
} else {
hi = mask_u64(start, 63);
lo = mask_u64(0, end - 64);
}
return make_int128(lo, hi);
}
r~
- [Qemu-devel] [PATCH ppc-for-2.9 00/13] POWER9 TCG enablements - part9, Nikunj A Dadhania, 2016/12/05
- [Qemu-devel] [PATCH 02/13] target-ppc: add mask_u128 routine, Nikunj A Dadhania, 2016/12/05
- Re: [Qemu-devel] [PATCH 02/13] target-ppc: add mask_u128 routine,
Richard Henderson <=
- [Qemu-devel] [PATCH 03/13] target-ppc: implement lxvl instruction, Nikunj A Dadhania, 2016/12/05
- [Qemu-devel] [PATCH 01/13] target-ppc: move ppc_vsr_t to common header, Nikunj A Dadhania, 2016/12/05
- [Qemu-devel] [PATCH 05/13] target-ppc: implement stxvl instruction, Nikunj A Dadhania, 2016/12/05
- [Qemu-devel] [PATCH 04/13] target-ppc: implement lxvll instruction, Nikunj A Dadhania, 2016/12/05