diff mbox series

[v2,02/29] tcg: Do not recreate INDEX_op_neg_vec unless supported

Message ID 20190501050536.15580-3-richard.henderson@linaro.org
State Superseded
Headers show
Series tcg vector improvements | expand

Commit Message

Richard Henderson May 1, 2019, 5:05 a.m. UTC
Use tcg_can_emit_vec_op instead of just TCG_TARGET_HAS_neg_vec,
so that we check the type and vece for the actual operation.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 tcg/optimize.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

-- 
2.17.1

Comments

Alex Bennée May 1, 2019, 3:26 p.m. UTC | #1
Richard Henderson <richard.henderson@linaro.org> writes:

> Use tcg_can_emit_vec_op instead of just TCG_TARGET_HAS_neg_vec,

> so that we check the type and vece for the actual operation.

>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Reviewed-by: Alex Bennée <alex.bennee@linaro.org>


> ---

>  tcg/optimize.c | 8 ++++++--

>  1 file changed, 6 insertions(+), 2 deletions(-)

>

> diff --git a/tcg/optimize.c b/tcg/optimize.c

> index 5150c38a25..24faa06260 100644

> --- a/tcg/optimize.c

> +++ b/tcg/optimize.c

> @@ -734,9 +734,13 @@ void tcg_optimize(TCGContext *s)

>                  } else if (opc == INDEX_op_sub_i64) {

>                      neg_op = INDEX_op_neg_i64;

>                      have_neg = TCG_TARGET_HAS_neg_i64;

> -                } else {

> +                } else if (TCG_TARGET_HAS_neg_vec) {

> +                    TCGType type = TCGOP_VECL(op) + TCG_TYPE_V64;

> +                    unsigned vece = TCGOP_VECE(op);

>                      neg_op = INDEX_op_neg_vec;

> -                    have_neg = TCG_TARGET_HAS_neg_vec;

> +                    have_neg = tcg_can_emit_vec_op(neg_op, type, vece) > 0;

> +                } else {

> +                    break;

>                  }

>                  if (!have_neg) {

>                      break;



--
Alex Bennée
diff mbox series

Patch

diff --git a/tcg/optimize.c b/tcg/optimize.c
index 5150c38a25..24faa06260 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -734,9 +734,13 @@  void tcg_optimize(TCGContext *s)
                 } else if (opc == INDEX_op_sub_i64) {
                     neg_op = INDEX_op_neg_i64;
                     have_neg = TCG_TARGET_HAS_neg_i64;
-                } else {
+                } else if (TCG_TARGET_HAS_neg_vec) {
+                    TCGType type = TCGOP_VECL(op) + TCG_TYPE_V64;
+                    unsigned vece = TCGOP_VECE(op);
                     neg_op = INDEX_op_neg_vec;
-                    have_neg = TCG_TARGET_HAS_neg_vec;
+                    have_neg = tcg_can_emit_vec_op(neg_op, type, vece) > 0;
+                } else {
+                    break;
                 }
                 if (!have_neg) {
                     break;