diff mbox series

[53/77] Pass a mode to const_scalar_mask_from_tree

Message ID 87shi0emto.fsf@linaro.org
State Accepted
Commit 04d6ea36a7f0b2124d1a102eae3727efddeb5875
Headers show
Series Add wrapper classes for machine_modes | expand

Commit Message

Richard Sandiford July 13, 2017, 8:57 a.m. UTC
The caller of const_scalar_mask_from_tree has proven that
the mode is a MODE_INT, so this patch passes it down as a
scalar_int_mode.  It also expands the comment a little.

2017-07-13  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* expr.c (const_scalar_mask_from_tree): Add a mode argument.
	Expand commentary.
	(expand_expr_real_1): Update call accordingly.

Comments

Jeff Law Aug. 24, 2017, 4:29 a.m. UTC | #1
On 07/13/2017 02:57 AM, Richard Sandiford wrote:
> The caller of const_scalar_mask_from_tree has proven that

> the mode is a MODE_INT, so this patch passes it down as a

> scalar_int_mode.  It also expands the comment a little.

> 

> 2017-07-13  Richard Sandiford  <richard.sandiford@linaro.org>

> 	    Alan Hayward  <alan.hayward@arm.com>

> 	    David Sherwood  <david.sherwood@arm.com>

> 

> gcc/

> 	* expr.c (const_scalar_mask_from_tree): Add a mode argument.

> 	Expand commentary.

> 	(expand_expr_real_1): Update call accordingly.

OK.
jeff
diff mbox series

Patch

Index: gcc/expr.c
===================================================================
--- gcc/expr.c	2017-07-13 09:18:46.702152995 +0100
+++ gcc/expr.c	2017-07-13 09:18:47.609081780 +0100
@@ -99,7 +99,7 @@  static void emit_single_push_insn (machi
 static void do_tablejump (rtx, machine_mode, rtx, rtx, rtx,
 			  profile_probability);
 static rtx const_vector_from_tree (tree);
-static rtx const_scalar_mask_from_tree (tree);
+static rtx const_scalar_mask_from_tree (scalar_int_mode, tree);
 static tree tree_expr_size (const_tree);
 static HOST_WIDE_INT int_expr_size (tree);
 
@@ -9962,7 +9962,7 @@  expand_expr_real_1 (tree exp, rtx target
 	if (is_int_mode (mode, &int_mode))
 	  {
 	    if (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (exp)))
-	      return const_scalar_mask_from_tree (exp);
+	      return const_scalar_mask_from_tree (int_mode, exp);
 	    else
 	      {
 		tree type_for_mode
@@ -11717,12 +11717,12 @@  const_vector_mask_from_tree (tree exp)
   return gen_rtx_CONST_VECTOR (mode, v);
 }
 
-/* Return a CONST_INT rtx representing vector mask for
-   a VECTOR_CST of booleans.  */
+/* EXP is a VECTOR_CST in which each element is either all-zeros or all-ones.
+   Return a constant scalar rtx of mode MODE in which bit X is set if element
+   X of EXP is nonzero.  */
 static rtx
-const_scalar_mask_from_tree (tree exp)
+const_scalar_mask_from_tree (scalar_int_mode mode, tree exp)
 {
-  machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
   wide_int res = wi::zero (GET_MODE_PRECISION (mode));
   tree elt;
   unsigned i;