Re: [089/nnn] poly_int: expand_expr_real_1

2017-11-28 Thread Jeff Law
On 10/23/2017 11:35 AM, Richard Sandiford wrote:
> This patch makes the VIEW_CONVERT_EXPR handling in expand_expr_real_1
> cope with polynomial type and mode sizes.
> 
> 
> 2017-10-23  Richard Sandiford  
>   Alan Hayward  
>   David Sherwood  
> 
> gcc/
>   * expr.c (expand_expr_real_1): Use tree_to_poly_uint64
>   instead of int_size_in_bytes when handling VIEW_CONVERT_EXPRs
>   via stack temporaries.  Treat the mode size as polynomial too.
OK.
jeff


[089/nnn] poly_int: expand_expr_real_1

2017-10-23 Thread Richard Sandiford
This patch makes the VIEW_CONVERT_EXPR handling in expand_expr_real_1
cope with polynomial type and mode sizes.


2017-10-23  Richard Sandiford  
Alan Hayward  
David Sherwood  

gcc/
* expr.c (expand_expr_real_1): Use tree_to_poly_uint64
instead of int_size_in_bytes when handling VIEW_CONVERT_EXPRs
via stack temporaries.  Treat the mode size as polynomial too.

Index: gcc/expr.c
===
--- gcc/expr.c  2017-10-23 17:25:34.105013764 +0100
+++ gcc/expr.c  2017-10-23 17:25:35.142976454 +0100
@@ -6,9 +6,10 @@ expand_expr_real_1 (tree exp, rtx target
  else if (STRICT_ALIGNMENT)
{
  tree inner_type = TREE_TYPE (treeop0);
- HOST_WIDE_INT temp_size
-   = MAX (int_size_in_bytes (inner_type),
-  (HOST_WIDE_INT) GET_MODE_SIZE (mode));
+ poly_uint64 mode_size = GET_MODE_SIZE (mode);
+ poly_uint64 op0_size
+   = tree_to_poly_uint64 (TYPE_SIZE_UNIT (inner_type));
+ poly_int64 temp_size = upper_bound (op0_size, mode_size);
  rtx new_rtx
= assign_stack_temp_for_type (mode, temp_size, type);
  rtx new_with_op0_mode