[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#202017: gcc-3.3: Unnecessary branching with INET/INET6 port setting



On Sat, Jul 19, 2003 at 01:05:52PM +0200, Martin v. L?wis wrote:
> Falk Hueffner <falk.hueffner@student.uni-tuebingen.de> writes:
> 
> > This is not the problem. gcc assumes the asm will return the same
> > value unless it is explicitely marked "volatile" (or has no oputputs),
> > and will happily merge them.
> 
> I see. Then this would be a glibc bug, for using __asm__ __volatile__
> in __bswap16.

Actually, I just checked my glibc (2.3.1) and it doesn't specify
__bswap16 as volatile:

#if defined __GNUC__ && __GNUC__ >= 2
# define __bswap_16(x) \
     (__extension__                                                           \
      ({ register unsigned short int __v, __x = (x);                          \
         if (__builtin_constant_p (__x))                                      \
           __v = __bswap_constant_16 (__x);                                   \
         else                                                                 \
           __asm__ ("rorw $8, %w0"                                            \
                    : "=r" (__v)                                              \
                    : "0" (__x)                                               \
                    : "cc");                                                  \
         __v; }))
#else
/* This is better than nothing.  */
# define __bswap_16(x) \
     (__extension__                                                           \
      ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
#endif
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Reply to: