[gcc(refs/users/wschmidt/heads/builtins3)] expr: Allow scalar_int_mode target mode when converting a constant

William Schmidt wschmidt@gcc.gnu.org
Tue Aug 18 18:03:11 GMT 2020


https://gcc.gnu.org/g:4821e0aabee57d5b7f955f138a8bee4588240609

commit 4821e0aabee57d5b7f955f138a8bee4588240609
Author: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date:   Wed Jul 22 12:34:30 2020 +0100

    expr: Allow scalar_int_mode target mode when converting a constant
    
    is_int_mode does not allow MODE_PARTIAL_INT modes, so convert_modes was
    not allowing a constant value to be converted to a MODE_PARTIAL_INT for
    use as operand 2 in patterns such as ashlpsi3. The constant had
    to be copied into a register before it could be used, but now can be
    used directly as an operand without any copying.
    
    gcc/ChangeLog:
    
            * expr.c (convert_modes): Allow a constant integer to be converted to
            any scalar int mode.

Diff:
---
 gcc/expr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/expr.c b/gcc/expr.c
index b4bbeffe3ce..5db0a7a8565 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -696,12 +696,12 @@ convert_modes (machine_mode mode, machine_mode oldmode, rtx x, int unsignedp)
     return x;
 
   if (CONST_SCALAR_INT_P (x)
-      && is_int_mode (mode, &int_mode))
+      && is_a <scalar_int_mode> (mode, &int_mode))
     {
       /* If the caller did not tell us the old mode, then there is not
 	 much to do with respect to canonicalization.  We have to
 	 assume that all the bits are significant.  */
-      if (GET_MODE_CLASS (oldmode) != MODE_INT)
+      if (!is_a <scalar_int_mode> (oldmode))
 	oldmode = MAX_MODE_INT;
       wide_int w = wide_int::from (rtx_mode_t (x, oldmode),
 				   GET_MODE_PRECISION (int_mode),


More information about the Gcc-cvs mailing list