poly_int: expand_expr_real_1
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 3 Jan 2018 07:17:52 +0000 (07:17 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 3 Jan 2018 07:17:52 +0000 (07:17 +0000)
This patch makes the VIEW_CONVERT_EXPR handling in expand_expr_real_1
cope with polynomial type and mode sizes.

2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

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.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r256152

gcc/ChangeLog
gcc/expr.c

index 6cef62278cea152228c00d155177a6f35e06de29..37737bcabd990f8757fb7fe716fc3eb6df51f17b 100644 (file)
@@ -1,3 +1,11 @@
+2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * 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.
+
 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index abab83136d3b47574bf029803b52cf97c8fa06c3..a82d9e41ae22e688c762659012a60a40177342d1 100644 (file)
@@ -11132,9 +11132,10 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
              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