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

--- Comment #9 from Zdenek Sojka <zsojka at seznam dot cz> ---
(In reply to Richard Biener from comment #8)
> (In reply to Zdenek Sojka from comment #7)
> > (In reply to Richard Biener from comment #2)
> > > Maybe sth is wrong with the testcase?  clang also results in an abort.  
> > > Isn't
> > > right-shift of negative values undefined?
> > > 
> > 
> > Thank you for having a look.
> > 
> > I believe the behavior is fully defined. The vectors are unsigned, and the
> > conversion to unsigned is done by adding 2**64; this behaves the same:
> > 
> > $ cat testcase.c
> > typedef unsigned long long __attribute__((__vector_size__ (32))) V;
> > 
> > V
> > foo (V v)
> > {
> >   return -(v >> 1);
> 
> but this is a logical right shift, thus gives 0x7ff...e, ...
> and negating that doesn't yield 1.
> 

Shame on me. You are very right.

Reply via email to