gte: avoid fno-strict-aliasing
authornotaz <notasas@gmail.com>
Wed, 21 Nov 2012 01:51:26 +0000 (03:51 +0200)
committernotaz <notasas@gmail.com>
Sat, 24 Nov 2012 02:25:25 +0000 (04:25 +0200)
Makefile
libpcsxcore/gte.c
libpcsxcore/r3000a.h

index a2a811f..548d8a0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,6 @@ endif
 ifeq "$(HAVE_NEON)" "1"
 OBJS += libpcsxcore/gte_neon.o
 endif
 ifeq "$(HAVE_NEON)" "1"
 OBJS += libpcsxcore/gte_neon.o
 endif
-libpcsxcore/gte.o libpcsxcore/gte_nf.o: CFLAGS += -fno-strict-aliasing
 libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
 
 # dynarec
 libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
 
 # dynarec
index dc56b7f..62fc7f3 100644 (file)
 #include "gte.h"
 #include "psxmem.h"
 
 #include "gte.h"
 #include "psxmem.h"
 
-typedef struct psxCP2Regs {
-       psxCP2Data CP2D;        /* Cop2 data registers */
-       psxCP2Ctrl CP2C;        /* Cop2 control registers */
-} psxCP2Regs;
-
 #define VX(n) (n < 3 ? regs->CP2D.p[n << 1].sw.l : regs->CP2D.p[9].sw.l)
 #define VY(n) (n < 3 ? regs->CP2D.p[n << 1].sw.h : regs->CP2D.p[10].sw.l)
 #define VZ(n) (n < 3 ? regs->CP2D.p[(n << 1) + 1].sw.l : regs->CP2D.p[11].sw.l)
 #define VX(n) (n < 3 ? regs->CP2D.p[n << 1].sw.l : regs->CP2D.p[9].sw.l)
 #define VY(n) (n < 3 ? regs->CP2D.p[n << 1].sw.h : regs->CP2D.p[10].sw.l)
 #define VZ(n) (n < 3 ? regs->CP2D.p[(n << 1) + 1].sw.l : regs->CP2D.p[11].sw.l)
@@ -264,7 +259,7 @@ static inline u32 limE_(psxCP2Regs *regs, u32 result) {
 #ifndef FLAGLESS
 
 static inline u32 MFC2(int reg) {
 #ifndef FLAGLESS
 
 static inline u32 MFC2(int reg) {
-       psxCP2Regs *regs = (psxCP2Regs *)&psxRegs.CP2D;
+       psxCP2Regs *regs = &psxRegs.CP2;
        switch (reg) {
                case 1:
                case 3:
        switch (reg) {
                case 1:
                case 3:
@@ -299,7 +294,7 @@ static inline u32 MFC2(int reg) {
 }
 
 static inline void MTC2(u32 value, int reg) {
 }
 
 static inline void MTC2(u32 value, int reg) {
-       psxCP2Regs *regs = (psxCP2Regs *)&psxRegs.CP2D;
+       psxCP2Regs *regs = &psxRegs.CP2;
        switch (reg) {
                case 15:
                        gteSXY0 = gteSXY1;
        switch (reg) {
                case 15:
                        gteSXY0 = gteSXY1;
index 76f42bc..13aaa59 100644 (file)
@@ -163,11 +163,21 @@ enum {
        PSXINT_COUNT
 };
 
        PSXINT_COUNT
 };
 
+typedef struct psxCP2Regs {
+       psxCP2Data CP2D;        /* Cop2 data registers */
+       psxCP2Ctrl CP2C;        /* Cop2 control registers */
+} psxCP2Regs;
+
 typedef struct {
        psxGPRRegs GPR;         /* General Purpose Registers */
        psxCP0Regs CP0;         /* Coprocessor0 Registers */
 typedef struct {
        psxGPRRegs GPR;         /* General Purpose Registers */
        psxCP0Regs CP0;         /* Coprocessor0 Registers */
-       psxCP2Data CP2D;        /* Cop2 data registers */
-       psxCP2Ctrl CP2C;        /* Cop2 control registers */
+       union {
+               struct {
+                       psxCP2Data CP2D;        /* Cop2 data registers */
+                       psxCP2Ctrl CP2C;        /* Cop2 control registers */
+               };
+               psxCP2Regs CP2;
+       };
     u32 pc;                            /* Program counter */
     u32 code;                  /* The instruction */
        u32 cycle;
     u32 pc;                            /* Program counter */
     u32 code;                  /* The instruction */
        u32 cycle;