|
From: | Richard Henderson |
Subject: | Re: [RFC PATCH 01/43] target/loongarch: Add vector data type vec_t |
Date: | Sat, 24 Dec 2022 09:07:49 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
On 12/24/22 00:15, Song Gao wrote:
+#define LSX_LEN (128) +typedef union vec_t vec_t; +union vec_t { + int8_t B[LSX_LEN / 8]; + int16_t H[LSX_LEN / 16]; + int32_t W[LSX_LEN / 32]; + int64_t D[LSX_LEN / 64]; + __int128 Q[LSX_LEN / 128]; +}; + +typedef union fpr_t fpr_t; +union fpr_t { + uint64_t d; + vec_t vec; +};
You need to think about host endianness with this overlap and indexing. There are two different models which can be emulated:(1) target/{arm,s390x}/ has each uint64_t in host-endian order, but the words are indexed little-endian. See, for instance, target/s390x/tcg/vec.h.
(2) target/{ppc,i386}/ has the entire vector in host-endian order. See, for instance, ZMM_* in target/i386/cpu.h.
If you do nothing, I assume this will fail on a big-endian host. r~
[Prev in Thread] | Current Thread | [Next in Thread] |