Skip to contentSkip to conversation

tcg: Save/restore vecop_list around minmax fallback

PATCH New Richard Henderson 1 participant 1 message Jul 10, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcg: Save/restore vecop_list around minmax fallback

Forgetting this asserts when tcg_gen_cmp_vec is called from within tcg_gen_cmpsel_vec.

Fixes 72b4c792c7a

---

I found this while testing SVE2 (and the patch is included in the large SVE2 patch set), but it seems like it should be reproducible with master. What's needed is a guest vector minmax operation of a size that is not supported by the host. In the case of x86_64 host, that would be a 64-bit minmax.

r~

---
 tcg/tcg-op-vec.c | 2 ++
 1 file changed, 2 insertions(+)
tcg/tcg-op-vec.c +2 -0
index f784517d84..ed6fb55fe1 100644
@@ -657,7 +657,9 @@ static void do_minmax(unsigned vece, TCGv_vec r, TCGv_vec a,
                       TCGv_vec b, TCGOpcode opc, TCGCond cond)
 {
     if (!do_op3(vece, r, a, b, opc)) {
+        const TCGOpcode *hold_list = tcg_swap_vecop_list(NULL);
         tcg_gen_cmpsel_vec(cond, vece, r, a, b, a, b);
+        tcg_swap_vecop_list(hold_list);
     }
 }
 
Signature · 1 line
2.25.1