https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120090

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot 
gnu.org

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
> before:(and:SI (subreg:SI (unspec:QI [
>                 (mem:V8HI (reg/f:SI 98 [ pi128.0_1 ]) [0 *pi128.0_1+0 S16
> A128])
>                 (reg:V8HI 110 [ _16 ])
>                 (const_int 0 [0])
>             ] UNSPEC_UNSIGNED_PCMP) 0)
>     (const_int 255 [0xff]))
> after:(and:DI (clobber:DI (const_int 0 [0]))
>     (const_int 255 [0xff]))
> 
> 
> clobber means we can't do it ...

Instead of rtl_hooks.gen_lowpart_no_emit return NULL, combine's gen_lowpart
returns a clobber. 

This fixes the issue at hand:
```
diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
index 7bcbe11370f..ea730c4d9aa 100644
--- a/gcc/simplify-rtx.cc
+++ b/gcc/simplify-rtx.cc
@@ -1716,7 +1716,7 @@ simplify_context::simplify_unary_operation_1 (rtx_code
code, machine_mode mode,
          && INTVAL (XEXP (op, 1)) > 0)
        {
          rtx tem = rtl_hooks.gen_lowpart_no_emit (mode, XEXP (op, 0));
-         if (tem)
+         if (tem && GET_CODE (tem) != CLOBBER)
            return simplify_gen_binary (AND, mode, tem, XEXP (op, 1));
        }


```

But nowhere in simplify-rtx.cc checks that gen_lowpart_no_emit will return
CLOBBER. Or should we wrap gen_lowpart_for_combine and return NULL when it is a
clobber ...

Still deciding.

Reply via email to