qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v1 10/22] target/i386: reimplement (V)PXOR, (V)X


From: Jan Bobek
Subject: [Qemu-devel] [RFC PATCH v1 10/22] target/i386: reimplement (V)PXOR, (V)XORPS, (V)XORPD
Date: Wed, 31 Jul 2019 13:56:50 -0400

Use the gvec infrastructure to achieve the desired functionality.

Signed-off-by: Jan Bobek <address@hidden>
---
 target/i386/ops_sse.h        |  2 --
 target/i386/ops_sse_header.h |  1 -
 target/i386/translate.c      | 26 ++++++++++++++++++++++++--
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h
index 8b4ac9115e..68dbeda047 100644
--- a/target/i386/ops_sse.h
+++ b/target/i386/ops_sse.h
@@ -354,7 +354,6 @@ static inline int satsw(int x)
 #define FMAXSW(a, b) ((int16_t)(a) > (int16_t)(b)) ? (a) : (b)
 
 #define FANDN(a, b) ((~(a)) & (b))
-#define FXOR(a, b) ((a) ^ (b))
 
 #define FCMPGTB(a, b) ((int8_t)(a) > (int8_t)(b) ? -1 : 0)
 #define FCMPGTW(a, b) ((int16_t)(a) > (int16_t)(b) ? -1 : 0)
@@ -396,7 +395,6 @@ SSE_HELPER_W(helper_pminsw, FMINSW)
 SSE_HELPER_W(helper_pmaxsw, FMAXSW)
 
 SSE_HELPER_Q(helper_pandn, FANDN)
-SSE_HELPER_Q(helper_pxor, FXOR)
 
 SSE_HELPER_B(helper_pcmpgtb, FCMPGTB)
 SSE_HELPER_W(helper_pcmpgtw, FCMPGTW)
diff --git a/target/i386/ops_sse_header.h b/target/i386/ops_sse_header.h
index 6a732ee489..a98b9f8f3f 100644
--- a/target/i386/ops_sse_header.h
+++ b/target/i386/ops_sse_header.h
@@ -87,7 +87,6 @@ SSE_HELPER_W(pminsw, FMINSW)
 SSE_HELPER_W(pmaxsw, FMAXSW)
 
 SSE_HELPER_Q(pandn, FANDN)
-SSE_HELPER_Q(pxor, FXOR)
 
 SSE_HELPER_B(pcmpgtb, FCMPGTB)
 SSE_HELPER_W(pcmpgtw, FCMPGTW)
diff --git a/target/i386/translate.c b/target/i386/translate.c
index 28cd84432d..cfe285e3e5 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -2759,7 +2759,7 @@ static const SSEFunc_0_epp sse_op_table1[256][4] = {
     [0x54] = { SSE_TOMBSTONE, SSE_TOMBSTONE }, /* andps, andpd */
     [0x55] = { gen_helper_pandn_xmm, gen_helper_pandn_xmm }, /* andnps, andnpd 
*/
     [0x56] = { SSE_TOMBSTONE, SSE_TOMBSTONE }, /* orps, orpd */
-    [0x57] = { gen_helper_pxor_xmm, gen_helper_pxor_xmm }, /* xorps, xorpd */
+    [0x57] = { SSE_TOMBSTONE, SSE_TOMBSTONE }, /* xorps, xorpd */
     [0x58] = SSE_FOP(add),
     [0x59] = SSE_FOP(mul),
     [0x5a] = { gen_helper_cvtps2pd, gen_helper_cvtpd2ps,
@@ -2845,7 +2845,7 @@ static const SSEFunc_0_epp sse_op_table1[256][4] = {
     [0xec] = MMX_OP2(paddsb),
     [0xed] = MMX_OP2(paddsw),
     [0xee] = MMX_OP2(pmaxsw),
-    [0xef] = MMX_OP2(pxor),
+    [0xef] = { SSE_TOMBSTONE, SSE_TOMBSTONE },
     [0xf0] = { NULL, NULL, NULL, SSE_SPECIAL }, /* lddqu */
     [0xf1] = MMX_OP2(psllw),
     [0xf2] = MMX_OP2(pslld),
@@ -3188,6 +3188,17 @@ static inline void gen_gvec_ld_modrm_3(CPUX86State *env, 
DisasContext *s,
 #define gen_vorpd_xmm gen_vpor_xmm
 #define gen_vorpd_ymm gen_vpor_ymm
 
+#define gen_pxor_mm(env, s, modrm)   gen_gvec_ld_modrm_mm  ((env), (s), 
(modrm), MO_64, tcg_gen_gvec_xor, 0112)
+#define gen_pxor_xmm(env, s, modrm)  gen_gvec_ld_modrm_xmm ((env), (s), 
(modrm), MO_64, tcg_gen_gvec_xor, 0112)
+#define gen_vpxor_xmm(env, s, modrm) gen_gvec_ld_modrm_vxmm((env), (s), 
(modrm), MO_64, tcg_gen_gvec_xor, 0123)
+#define gen_vpxor_ymm(env, s, modrm) gen_gvec_ld_modrm_vymm((env), (s), 
(modrm), MO_64, tcg_gen_gvec_xor, 0123)
+#define gen_xorps_xmm  gen_pxor_xmm
+#define gen_vxorps_xmm gen_vpxor_xmm
+#define gen_vxorps_ymm gen_vpxor_ymm
+#define gen_xorpd_xmm  gen_pxor_xmm
+#define gen_vxorpd_xmm gen_vpxor_xmm
+#define gen_vxorpd_ymm gen_vpxor_ymm
+
 static void gen_sse(CPUX86State *env, DisasContext *s, int b)
 {
     int b1, op1_offset, op2_offset, is_xmm, val;
@@ -3301,6 +3312,17 @@ static void gen_sse(CPUX86State *env, DisasContext *s, 
int b)
     case 0x56 | M_0F | P_66 | VEX_128: gen_vorpd_xmm(env, s, modrm); return;
     case 0x56 | M_0F | P_66 | VEX_256: gen_vorpd_ymm(env, s, modrm); return;
 
+    case 0xef | M_0F:                  gen_pxor_mm(env, s, modrm); return;
+    case 0xef | M_0F | P_66:           gen_pxor_xmm(env, s, modrm); return;
+    case 0xef | M_0F | P_66 | VEX_128: gen_vpxor_xmm(env, s, modrm); return;
+    case 0xef | M_0F | P_66 | VEX_256: gen_vpxor_ymm(env, s, modrm); return;
+    case 0x57 | M_0F:                  gen_xorps_xmm(env, s, modrm); return;
+    case 0x57 | M_0F | VEX_128:        gen_vxorps_xmm(env, s, modrm); return;
+    case 0x57 | M_0F | VEX_256:        gen_vxorps_ymm(env, s, modrm); return;
+    case 0x57 | M_0F | P_66:           gen_xorpd_xmm(env, s, modrm); return;
+    case 0x57 | M_0F | P_66 | VEX_128: gen_vxorpd_xmm(env, s, modrm); return;
+    case 0x57 | M_0F | P_66 | VEX_256: gen_vxorpd_ymm(env, s, modrm); return;
+
     default: break;
     }
 
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]