On Tue, Dec 13, 2011 at 02:07:11PM +0100, Richard Guenther wrote:
> > Hi guys,
> > While looking at Spec2006/401.bzip2 I found such a loop:
> >     for (i = 1; i <= alphaSize; i++) {
> >       j = weight[i] >> 8;
> >       j = 1 + (j / 2);
> >       weight[i] = j << 8;
> >     }

It would be helpful to have a self-contained testcase, because we don't know
the types of the variables in question.  Is j signed or unsigned?
Signed divide by 2 is unfortunately not equivalent to >> 1.
If j is signed int, on x86_64 we expand j / 2 as (j + (j >> 31)) >> 1.
Sure, the pattern recognizer could try that if vector division isn't
supported.
If j is unsigned int, then I'd expect it to be already canonicalized into >>
1 by the time we enter the vectorizer.

        Jakub

Reply via email to