[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH v1 4/8] target-ppc: add vabsdu[b, h, w] instructio
From: |
Nikunj A Dadhania |
Subject: |
Re: [Qemu-ppc] [PATCH v1 4/8] target-ppc: add vabsdu[b, h, w] instructions |
Date: |
Thu, 28 Jul 2016 22:51:31 +0530 |
User-agent: |
Notmuch/0.21 (https://notmuchmail.org) Emacs/25.0.94.1 (x86_64-redhat-linux-gnu) |
Richard Henderson <address@hidden> writes:
> On 07/28/2016 12:19 PM, Nikunj A Dadhania wrote:
>> + r->element[i] = abs(a->element[i] - b->element[i]); \
>> + } \
>> +}
>> +
>> +/* VABSDU - Vector absolute difference unsigned
>> + * name - instruction mnemonic suffix (b: byte, h: halfword, w: word)
>> + * element - element type to access from vector
>> + */
>> +#define VABSDU(type, element) \
>> + VABSDU_DO(absdu##type, element)
>> +VABSDU(b, u8)
>> +VABSDU(h, u16)
>> +VABSDU(w, u32)
>
> From whence are you receiving this abs definition, and how do you expect it
> to
> work with an unsigned input?
>
> I can only imagine you're getting abs(3), aka int abs(int), from stdlib.h.
> Which technically does work post-arithmetic promotion for u8 and u16, but it
> does not for u32.
Thanks for pointing that, wasn't aware about that.
> I think we'd prefer an explicit (a > b ? a - b : b - a).
That is what ISA also says, i thought of using library function abs().
Regards
Nikunj
- [Qemu-ppc] [PATCH v1 0/8] POWER9 TCG enablements - part2, Nikunj A Dadhania, 2016/07/28
- [Qemu-ppc] [PATCH v1 3/8] target-ppc: add dtstsfi[q] instructions, Nikunj A Dadhania, 2016/07/28
- [Qemu-ppc] [PATCH v1 5/8] target-ppc: add vcmpnez[b, h, w][.] instructions, Nikunj A Dadhania, 2016/07/28
- [Qemu-ppc] [PATCH v1 4/8] target-ppc: add vabsdu[b, h, w] instructions, Nikunj A Dadhania, 2016/07/28
- [Qemu-ppc] [PATCH v1 6/8] target-ppc: add vslv instruction, Nikunj A Dadhania, 2016/07/28
- [Qemu-ppc] [PATCH v1 7/8] target-ppc: add vsrv instruction, Nikunj A Dadhania, 2016/07/28
- [Qemu-ppc] [PATCH v1 2/8] target-ppc: implement branch-less divd[o][.], Nikunj A Dadhania, 2016/07/28
- [Qemu-ppc] [PATCH v1 8/8] target-ppc: add extswsli[.] instruction, Nikunj A Dadhania, 2016/07/28