From c4d5ab5d0979227a780fb74a2961205e0458d91e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 24 Mar 2017 15:09:33 +0100 Subject: [PATCH] genrecog.c (validate_pattern): Add VEC_SELECT validation. * genrecog.c (validate_pattern): Add VEC_SELECT validation. * genmodes.c (emit_min_insn_modes_c): Call emit_mode_nunits and emit_mode_inner. From-SVN: r246460 --- gcc/ChangeLog | 6 ++++++ gcc/genmodes.c | 2 ++ gcc/genrecog.c | 26 ++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c133ecc6840..f82afbe9ab4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-24 Jakub Jelinek + + * genrecog.c (validate_pattern): Add VEC_SELECT validation. + * genmodes.c (emit_min_insn_modes_c): Call emit_mode_nunits + and emit_mode_inner. + 2017-03-24 Andreas Krebbel * config/s390/s390-builtins.def: Add VXE builtins. Add a flags diff --git a/gcc/genmodes.c b/gcc/genmodes.c index 92079fafc0e..e56c08b4d30 100644 --- a/gcc/genmodes.c +++ b/gcc/genmodes.c @@ -1789,7 +1789,9 @@ emit_min_insn_modes_c (void) emit_min_insn_modes_c_header (); emit_mode_name (); emit_mode_class (); + emit_mode_nunits (); emit_mode_wider (); + emit_mode_inner (); emit_class_narrowest_mode (); } diff --git a/gcc/genrecog.c b/gcc/genrecog.c index f414d5f4f27..6a9e610e7a0 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -737,6 +737,32 @@ validate_pattern (rtx pattern, md_rtx_info *info, rtx set, int set_code) GET_MODE_NAME (GET_MODE (XEXP (pattern, 0)))); break; + case VEC_SELECT: + if (GET_MODE (pattern) != VOIDmode) + { + enum machine_mode mode = GET_MODE (pattern); + enum machine_mode imode = GET_MODE (XEXP (pattern, 0)); + enum machine_mode emode + = VECTOR_MODE_P (mode) ? GET_MODE_INNER (mode) : mode; + if (GET_CODE (XEXP (pattern, 1)) == PARALLEL) + { + int expected = VECTOR_MODE_P (mode) ? GET_MODE_NUNITS (mode) : 1; + if (XVECLEN (XEXP (pattern, 1), 0) != expected) + error_at (info->loc, + "vec_select parallel with %d elements, expected %d", + XVECLEN (XEXP (pattern, 1), 0), expected); + } + if (imode != VOIDmode && !VECTOR_MODE_P (imode)) + error_at (info->loc, "%smode of first vec_select operand is not a " + "vector mode", GET_MODE_NAME (imode)); + else if (imode != VOIDmode && GET_MODE_INNER (imode) != emode) + error_at (info->loc, "element mode mismatch between vec_select " + "%smode and its operand %smode", + GET_MODE_NAME (emode), + GET_MODE_NAME (GET_MODE_INNER (imode))); + } + break; + default: break; } -- 2.30.2