diff options
author | Jorge Zapata <jorgeluis.zapata@gmail.com> | 2024-01-22 10:46:08 +0100 |
---|---|---|
committer | Jorge Zapata <jorgeluis.zapata@gmail.com> | 2024-03-12 10:03:58 +0100 |
commit | 7836fba75bb14e1ad39980d1db0fbbcb9ae83a41 (patch) | |
tree | 2b972ccfd989a10d746920778bbbc6cbcc87249f | |
parent | f3c13218a8f5a8be28f0f0ea1d3a761c854673f4 (diff) |
Handle the mmx case to clear emms
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/148>
-rw-r--r-- | orc/orcprogram-avx.c | 1 | ||||
-rw-r--r-- | orc/orcprogram-mmx.c | 6 | ||||
-rw-r--r-- | orc/orcprogram-sse.c | 3 | ||||
-rw-r--r-- | orc/orcprogram-x86.c | 8 | ||||
-rw-r--r-- | orc/orcx86.h | 9 |
5 files changed, 23 insertions, 4 deletions
diff --git a/orc/orcprogram-avx.c b/orc/orcprogram-avx.c index f6b4257..fe64b6a 100644 --- a/orc/orcprogram-avx.c +++ b/orc/orcprogram-avx.c @@ -409,6 +409,7 @@ orc_avx_init (void) avx_get_shift, avx_set_mxcsr, avx_restore_mxcsr, + NULL, ORC_AVX_REG_SIZE, X86_YMM0, ORC_AVX_REG_AMOUNT, diff --git a/orc/orcprogram-mmx.c b/orc/orcprogram-mmx.c index 0893996..ebaf698 100644 --- a/orc/orcprogram-mmx.c +++ b/orc/orcprogram-mmx.c @@ -65,7 +65,7 @@ mmx_is_executable (void) /* initializes cache information */ const int flags = orc_mmx_get_cpu_flags (); - if (orc_x86_mmx_flags & ORC_TARGET_MMX_MMX) { + if (flags & ORC_TARGET_MMX_MMX) { return TRUE; } #endif @@ -331,9 +331,8 @@ mmx_get_shift (int size) } static void -mmx_restore_mxcsr(OrcCompiler *c) +mmx_clear_emms(OrcCompiler *c) { - /* FIXME */ orc_x86_emit_emms (c); } @@ -361,6 +360,7 @@ orc_mmx_init (void) mmx_get_shift, NULL, NULL, + mmx_clear_emms, 8, X86_MM0, ORC_REG_SIZE, diff --git a/orc/orcprogram-sse.c b/orc/orcprogram-sse.c index 2d89cad..507f6d4 100644 --- a/orc/orcprogram-sse.c +++ b/orc/orcprogram-sse.c @@ -64,7 +64,7 @@ sse_is_executable (void) /* initializes cache information */ const int flags = orc_sse_get_cpu_flags (); - if (orc_x86_sse_flags & ORC_TARGET_SSE_SSE2) { + if (flags & ORC_TARGET_SSE_SSE2) { return TRUE; } #endif @@ -374,6 +374,7 @@ orc_sse_init (void) sse_get_shift, sse_set_mxcsr, sse_restore_mxcsr, + NULL, 16, X86_XMM0, 16, diff --git a/orc/orcprogram-x86.c b/orc/orcprogram-x86.c index 64fc7a0..aa2baef 100644 --- a/orc/orcprogram-x86.c +++ b/orc/orcprogram-x86.c @@ -623,6 +623,13 @@ orc_x86_restore_mxcsr (OrcX86Target *t, OrcCompiler *c) t->restore_mxcsr (c); } +static void +orc_x86_clear_emms (OrcX86Target *t, OrcCompiler *c) +{ + if (t->clear_emms) + t->clear_emms (c); +} + static void orc_x86_adjust_alignment (OrcX86Target *t, OrcCompiler *compiler) @@ -864,6 +871,7 @@ orc_x86_compile (OrcCompiler *compiler) if (set_mxcsr) { orc_x86_restore_mxcsr (t, compiler); } + orc_x86_clear_emms (t, compiler); orc_x86_restore_registers (t, compiler); diff --git a/orc/orcx86.h b/orc/orcx86.h index 62b4743..23faa20 100644 --- a/orc/orcx86.h +++ b/orc/orcx86.h @@ -9,6 +9,10 @@ ORC_BEGIN_DECLS #ifdef ORC_ENABLE_UNSTABLE_API +/* This struct is a naive wrapper of on top of the common + * code found on MMX, SSE and AVX. This is could be + * abstracted even more, but as an initial step is fine. + */ typedef struct _OrcX86Target { /* Same as OrcTarget */ @@ -31,8 +35,13 @@ typedef struct _OrcX86Target void (*move_register_to_memoffset)(OrcCompiler *compiler, int size, int reg1, int offset, int reg2, int aligned, int uncached); void (*move_memoffset_to_register)(OrcCompiler *compiler, int size, int offset, int reg1, int reg2, int is_aligned); int (*get_shift)(int size); + /* These are specific to the implementation. We need to keep private data + * and proceed accordingly with a generic prologue, epilogue instead of + * a function pointer for each case + */ void (*set_mxcsr)(OrcCompiler *c); void (*restore_mxcsr)(OrcCompiler *c); + void (*clear_emms)(OrcCompiler *c); int register_size; int register_start; int n_registers; |