This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Merge status

"Joseph S. Myers" <> writes:

> On Wed, 17 Mar 2004, Andreas Jaeger wrote:
>> These two (and similar ones):
>> #define IXDR_GET_INT32(buf)           ((int32_t)ntohl((uint32_t)*(buf)++))
>> #define IXDR_PUT_INT32(buf, v)        (*(buf)++ = (int32_t)htonl((uint32_t)(v)))
> These don't seem to use lvalue casts (and presume that the buf argument
> points to integers of the right width so that they don't need to).
> IXDR_GET_LONG and IXDR_PUT_LONG use such casts, but I don't really see the
> need for them to do so; it looks like they are (apart from being obsolete)  
> meant to have exactly the same interface as IXDR_GET_INT32 and
> IXDR_PUT_INT32, only return long if that differs from int32_t.  In
> particular, all the uses of them in libc/sunrpc have buf of type int32_t
> *, which doesn't need the casts.  If these macros are documented the 
> documentation isn't in glibc, but does anything break if you define
> #define IXDR_GET_LONG(buf) ((long)IXDR_GET_INT32(buf))

If I use this definition, the assembler code on AMD64 looks different:

@@ -148,7 +148,7 @@
  1c0:  8b 00                   mov    (%rax),%eax
  1c2:  31 f6                   xor    %esi,%esi
  1c4:  0f c8                   bswap  %eax
- 1c6:  89 c0                   mov    %eax,%eax
+ 1c6:  48 98                   cltq   
  1c8:  48 89 45 00             mov    %rax,0x0(%rbp)
  1cc:  8b 03                   mov    (%rbx),%eax
  1ce:  48 83 c3 04             add    $0x4,%rbx

 Andreas Jaeger,,
  SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]