On Wed, Jan 11, 2017 at 12:02:40PM -0600, Segher Boessenkool wrote:
> On Thu, Jan 05, 2017 at 05:46:51PM +0100, Dominik Vogt wrote:
> > The attached patch deals with another type of zero_extend that is
> > not yet handled in change_zero_ext, i.e. (zero_extend
> > (pseudoreg)), without a "subreg" in between.  What do you think?
> > (Mostly untested yet.)
> 
> My main question is: where is this useful?  Can you show some example
> please?

With this test program:

  int foo (int *b)
  {
    int i;
    int r;
    for (i = 0; i < 77; i++)
    {
      r |= b[0] > 0;
      r |= b[i] > 0;
    }
    return r;
  }

before combine we have

  (insn 47 45 48 7 (set (reg:SI 104)
          (zero_extend:SI (reg:QI 103)))
  (insn 48 47 49 7 (parallel [
              (set (reg/v:SI 88 [ r ])
                  (ior:SI (reg/v:SI 88 [ r ])
                      (reg:SI 104)))
              (clobber (reg:CC 33 %cc))
          ])

combine tries

  (set (reg/v:SI 88 [ r ])
      (ior:SI (zero_extend:SI (reg:QI 103))
          (reg/v:SI 88 [ r ])))

With the patch it also tries

(set (reg/v:SI 88 [ r ])
    (ior:SI (and:SI (subreg:SI (reg:QI 103) 0)
            (const_int -1 [0xffffffffffffffff]))
        (reg/v:SI 88 [ r ])))

which is just one of the standard patterns for rosbg.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

Reply via email to