From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3ifr-0005Bw-Bm for qemu-devel@nongnu.org; Tue, 01 Dec 2015 06:00:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3ifl-0007QZ-2y for qemu-devel@nongnu.org; Tue, 01 Dec 2015 06:00:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3ifk-0007QL-HL for qemu-devel@nongnu.org; Tue, 01 Dec 2015 06:00:36 -0500 References: <1448907702-24815-1-git-send-email-ehabkost@redhat.com> <1448907702-24815-7-git-send-email-ehabkost@redhat.com> From: Paolo Bonzini Message-ID: <565D7DD1.7030308@redhat.com> Date: Tue, 1 Dec 2015 12:00:33 +0100 MIME-Version: 1.0 In-Reply-To: <1448907702-24815-7-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 6/7] [RFC] target-i386: Define MMREG_UNION macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson On 30/11/2015 19:21, Eduardo Habkost wrote: > This will simplify the definitions of ZMMReg and MMXReg. > > Signed-off-by: Eduardo Habkost > --- > 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 7519023..b189748 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(q) \ > + union { \ > + uint8_t _b[(q)*8]; \ > + uint16_t _w[(q)*4]; \ > + uint32_t _l[(q)*2]; \ > + uint64_t _q[(q)]; \ > + float32 _s[(q)*2]; \ > + float64 _d[(q)]; \ > + } > > -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(8) ZMMReg; > +typedef MMREG_UNION(1) MMXReg; Since you are at it, perhaps the argument to MMREG_UNION can be in bits. Otherwise really no comment, it's a nice improvement in type-safety. Paolo > typedef struct BNDReg { > uint64_t lb; >