Skip to contentSkip to conversation

tcg: Fix tcg gen for vectorized absolute value

PATCH In review Stephen Long 2 participants 2 messages Aug 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tcg: Fix tcg gen for vectorized absolute value

---
 tcg/tcg-op-gvec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Whoops, I forgot to add the signed off line.

tcg/tcg-op-gvec.c +3 -2
index 3707c0effb..793d4ba64c 100644
@@ -2264,12 +2264,13 @@ static void gen_absv_mask(TCGv_i64 d, TCGv_i64 b, unsigned vece)
     tcg_gen_muli_i64(t, t, (1 << nbit) - 1);
 
     /*
-     * Invert (via xor -1) and add one (via sub -1).
+     * Invert (via xor -1) and add one.
      * Because of the ordering the msb is cleared,
      * so we never have carry into the next element.
      */
     tcg_gen_xor_i64(d, b, t);
-    tcg_gen_sub_i64(d, d, t);
+    tcg_gen_andi_i64(t, t, dup_const(vece, 1));
+    tcg_gen_add_i64(d, d, t);
 
     tcg_temp_free_i64(t);
 }
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Stephen Long
---
 tcg/tcg-op-gvec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Whoops, I forgot to add the signed off line.

Queued, copying the patch description from v1.

Which, by the way, should have been above the "---" line there as well, so that it gets included in the commit message.

r~