qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v2 1/2] target-i386: Define MMREG_UNION macro
Date: Wed,  2 Dec 2015 13:51:53 -0200	[thread overview]
Message-ID: <1449071514-22867-2-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1449071514-22867-1-git-send-email-ehabkost@redhat.com>

This will simplify the definitions of ZMMReg and MMXReg.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Change MMREG_UNION argument to be number of bits
---
 target-i386/cpu.h | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index e8e99e2..ab3ae5b 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;
-- 
2.1.0

  reply	other threads:[~2015-12-02 15:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-02 15:51 [Qemu-devel] [PATCH v2 0/2] target-i386: MMReg struct cleanup Eduardo Habkost
2015-12-02 15:51 ` Eduardo Habkost [this message]
2015-12-02 15:51 ` [Qemu-devel] [PATCH v2 2/2] target-i386: Add suffixes to MMReg struct fields Eduardo Habkost
2015-12-02 16:45 ` [Qemu-devel] [PATCH v2 0/2] target-i386: MMReg struct cleanup Richard Henderson
2015-12-03 18:20   ` Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449071514-22867-2-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).