about summary refs log tree commit diff stats
path: root/src/dynarec/dynarec_native.c
diff options
context:
space:
mode:
authorrajdakin <rajdakin@gmail.com>2024-07-10 09:45:57 +0200
committerGitHub <noreply@github.com>2024-07-10 09:45:57 +0200
commitebdbd1767acbb979f06d502ea7972365edf219e2 (patch)
treeb1e6cc18675744275c1ed8549a3c342378516cc2 /src/dynarec/dynarec_native.c
parent4eca49697a35e8b9762f2afec108223d1ec33c07 (diff)
downloadbox64-ebdbd1767acbb979f06d502ea7972365edf219e2.tar.gz
box64-ebdbd1767acbb979f06d502ea7972365edf219e2.zip
[DYNAREC] Fixed `ymm0_purge` for some instructions (#1664)
* [DYNAREC] Fixed `ymm0_purge` for the first instruction of a block

* [DYNAREC] Also consider barriers as having a pred with `ymm0_out = 0`
Diffstat (limited to 'src/dynarec/dynarec_native.c')
-rw-r--r--src/dynarec/dynarec_native.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dynarec/dynarec_native.c b/src/dynarec/dynarec_native.c
index a233c690..1622e981 100644
--- a/src/dynarec/dynarec_native.c
+++ b/src/dynarec/dynarec_native.c
@@ -412,8 +412,12 @@ static void updateYmm0s(dynarec_native_t* dyn, int ninst, int max_ninst_reached)
         //if(box64_dynarec_dump) dynarec_log(LOG_NONE, "update ninst=%d (%d): can_incr=%d\n", ninst, max_ninst_reached, can_incr);
         uint16_t new_purge_ymm, new_ymm0_in, new_ymm0_out;
 
-        if (ninst && dyn->insts[ninst].pred_sz && dyn->insts[ninst].x64.alive) {
-            uint16_t ymm0_union = 0, ymm0_inter = (uint16_t)-1; // The union of the empty set is empty, the intersection is the universe
+        if (dyn->insts[ninst].pred_sz && dyn->insts[ninst].x64.alive) {
+            // The union of the empty set is empty (0), the intersection is the universe (-1)
+            // The first instruction is the entry point, which has a virtual pred with ymm0_out = 0
+            // Similarly, float barriers reset ymm0s
+            uint16_t ymm0_union = 0;
+            uint16_t ymm0_inter = (ninst && !(dyn->insts[ninst].x64.barrier & BARRIER_FLOAT)) ? ((uint16_t)-1) : (uint16_t)0;
             for (int i = 0; i < dyn->insts[ninst].pred_sz; ++i) {
                 int pred = dyn->insts[ninst].pred[i];
                 //if(box64_dynarec_dump) dynarec_log(LOG_NONE, "\twith pred[%d] = %d", i, pred);