aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2015-12-02 13:51:53 -0200
committerEduardo Habkost <ehabkost@redhat.com>2016-01-21 12:47:16 -0200
commit31d414d649b289ff9d1e048c41554298d1094fd3 (patch)
tree80ba3f8a5acd5ad27993ff6f4d24572ebdbaf737
parent9253e1a7923e94598419ac9a7df7b8bc6cba65a5 (diff)
target-i386: Define MMREG_UNION macro
This will simplify the definitions of ZMMReg and MMXReg. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
-rw-r--r--target-i386/cpu.h27
1 files changed, 11 insertions, 16 deletions
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index b41ce821c5..70cf66de39 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -725,23 +725,18 @@ typedef struct SegmentCache {
uint32_t flags;
} SegmentCache;
-typedef union {
- uint8_t _b[64];
- uint16_t _w[32];
- uint32_t _l[16];
- uint64_t _q[8];
- float32 _s[16];
- float64 _d[8];
-} ZMMReg;
+#define MMREG_UNION(bits) \
+ union { \
+ uint8_t _b[(bits)/8]; \
+ uint16_t _w[(bits)/16]; \
+ uint32_t _l[(bits)/32]; \
+ uint64_t _q[(bits)/64]; \
+ float32 _s[(bits)/32]; \
+ float64 _d[(bits)/64]; \
+ }
-typedef union {
- uint8_t _b[8];
- uint16_t _w[4];
- uint32_t _l[2];
- uint64_t _q[1];
- float32 _s[2];
- float64 _d[1];
-} MMXReg;
+typedef MMREG_UNION(512) ZMMReg;
+typedef MMREG_UNION(64) MMXReg;
typedef struct BNDReg {
uint64_t lb;