On 09/01/2016 09:38 PM, Richard Henderson wrote:
On 08/31/2016 11:36 PM, Rajalakshmi Srinivasaraghavan wrote:
+#if defined(HOST_WORDS_BIGENDIAN)
+#define VEXTRACT(suffix,
element) \
+ void helper_vextract##suffix(ppc_avr_t *r, ppc_avr_t *b,
uint32_t index) \
+ { \
+ r->u64[0] = r->u64[1] =
0; \
+ memmove(&r->u8[8 - sizeof(r->element)],
&b->u8[index], \
+ sizeof(r->element[0])); \
Again, you must consider R == B. I made this same comment wrt v2,
when you still had a memcpy here.
This is trivial:
(1) Use memmove to set first sizeof(r->element[0]) bytes,
(2) Use memset 0 to clean last (16 - sizeof(r->element[0]) bytes.
Ack. So I have to call memset twice to clean initial and last bytes.
#if defined(HOST_WORDS_BIGENDIAN)
#define VEXTRACT(suffix,
element) \
void helper_vextract##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t
index) \
{ \
uint32_t es =
sizeof(r->element[0]); \
memmove(&r->u8[8 - es], &b->u8[index],
es); \
memset(&r->u8[8], 0,
8); \
memset(&r->u8[0], 0, 8 -
es); \
}
#else
#define VEXTRACT(suffix,
element) \
void helper_vextract##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t
index) \
{ \
uint32_t es =
sizeof(r->element[0]); \
uint32_t s = (16 - index) -
es; \
memmove(&r->u8[8], &b->u8[s],
es); \
memset(&r->u8[0], 0,
8); \
memset(&r->u8[8 + es], 0, 8 -
es); \
}
#endif
You have some test cases for these insns, don't you?
r~
--
Thanks
Rajalakshmi S