[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1 5/8] target-ppc: add vcmpnez[b, h, w][.] inst
From: |
Nikunj A Dadhania |
Subject: |
Re: [Qemu-devel] [PATCH v1 5/8] target-ppc: add vcmpnez[b, h, w][.] instructions |
Date: |
Thu, 28 Jul 2016 23:01:17 +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:
>> +#define VCMPNEZ_DO(suffix, element, record) \
>> +void helper_vcmpnez##suffix(CPUPPCState *env, ppc_avr_t *r, \
>> + ppc_avr_t *a, ppc_avr_t *b) \
>> +{ \
>> + uint64_t ones = (uint64_t)-1; \
>> + uint64_t all = ones; \
>> + uint64_t none = 0; \
>> + int i; \
>> + \
>> + for (i = 0; i < ARRAY_SIZE(r->element); i++) { \
>> + uint64_t result = ((a->element[i] == 0) \
>> + || (b->element[i] == 0) \
>> + || (a->element[i] != b->element[i]) ? \
>> + ones : 0x0); \
>
> Don't you have the proper type to use, as opposed to widening everything to
> uint64_t?
And then truncating them as well. One option could be passing the
element type in the macro.
#define VCMPNEZ_DO(suffix, element, etype, record) \
void helper_vcmpnez##suffix(CPUPPCState *env, ppc_avr_t *r, \
ppc_avr_t *a, ppc_avr_t *b) \
{ \
etype ones = (etype)-1; \
etype all = ones; \
etype none = 0; \
int i; \
\
for (i = 0; i < ARRAY_SIZE(r->element); i++) { \
etype result = ((a->element[i] == 0) \
|| (b->element[i] == 0) \
|| (a->element[i] != b->element[i]) ? \
ones : 0x0); \
r->element[i] = result; \
all &= result; \
none |= result; \
} \
if (record) { \
env->crf[6] = ((all != 0) << 3) | ((none == 0) << 1); \
} \
}
/* VCMPNEZ - Vector compare not equal to zero
* suffix - instruction mnemonic suffix (b: byte, h: halfword, w: word)
* element - element type to access from vector
*/
#define VCMPNEZ(suffix, element, etype) \
VCMPNEZ_DO(suffix, element, etype, 0) \
VCMPNEZ_DO(suffix##_dot, element, etype, 1)
VCMPNEZ(b, u8, uint8_t)
VCMPNEZ(h, u16, uint16_t)
VCMPNEZ(w, u32, uint32_t)
#undef VCMPNEZ_DO
#undef VCMPNEZ
> I would guess element##_t would do the job.
That would be u32_t, we would need uint32_t
Regards
Nikunj
- [Qemu-devel] [PATCH v1 0/8] POWER9 TCG enablements - part2, Nikunj A Dadhania, 2016/07/28
- [Qemu-devel] [PATCH v1 3/8] target-ppc: add dtstsfi[q] instructions, Nikunj A Dadhania, 2016/07/28
- [Qemu-devel] [PATCH v1 4/8] target-ppc: add vabsdu[b, h, w] instructions, Nikunj A Dadhania, 2016/07/28
- [Qemu-devel] [PATCH v1 6/8] target-ppc: add vslv instruction, Nikunj A Dadhania, 2016/07/28
- [Qemu-devel] [PATCH v1 5/8] target-ppc: add vcmpnez[b, h, w][.] instructions, Nikunj A Dadhania, 2016/07/28
- [Qemu-devel] [PATCH v1 1/8] target-ppc: implement branch-less divw[o][.], Nikunj A Dadhania, 2016/07/28
- [Qemu-devel] [PATCH v1 2/8] target-ppc: implement branch-less divd[o][.], Nikunj A Dadhania, 2016/07/28
- [Qemu-devel] [PATCH v1 7/8] target-ppc: add vsrv instruction, Nikunj A Dadhania, 2016/07/28
- [Qemu-devel] [PATCH v1 8/8] target-ppc: add extswsli[.] instruction, Nikunj A Dadhania, 2016/07/28