This is the mail archive of the gcc-bugs@gcc.gnu.org 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: label reference missed


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Zack Weinberg wrote:
 asm volatile ("jmp %0"::"m" (*&&fff));

This is just the classic "you can't jump out of an asm()" issue.
Yes, I know, but I tell the compiler about the additional code path from the asm to the beginning of the basic block introduced by fff. If the asm is put in a basic block by itself it should not be too much of a problem to generate and represent this edge, should it?


   if (({ __builtin_flags_t __r;
	  asm ("cmpxchgl %3, %0"
	       : "=m" (mem), "=C" (__r)
	       : "0" (mem), "r" (oldval));
	  __r; }))

should be practical: where __builtin_flags_t is a magic type that maps
to CCmode, and the "C" constraint allows only (reg:CC 17).  (We might
need __builtin_cc_t, _ccz_t, _ccno_t, etc.)
If this is easier it is even more welcome since it's a more general solution. The interface needs some thoughts, though. The __builtin_flags_t type would represent the whole set of conditional flags. While on x86 something like __builtin_cflag_p (__r) to test for the carray flag might be sufficient, how would you do this on IA-64 with its scores of conditional registers? Invent a special notation for each architecture? This might indeed be a possibility.

I've been thinking about the conditional register use for a long time. Never was I able to come up with a reasonably portable solution.


This seems both easier to
implement, and cleaner notation to boot.  Bonus points for permitting

 if (asm ("cmpxchgl %3, %0"
	  : "=m" (mem), "=C"
	  : "0" (mem), "r" (oldval)))
Well, the problem described above remains. Yes, one could define the return value of an asm() statement (now asm() expression) to be the conditional flags, but how to access the values?

- -- - ---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9ZcGI2ijCOnn/RHQRAt8pAJ9uMAEwBLIKVWPTMylYCNqXe2Rt8ACguS3A
6Xt4rpqsEkWBYdRNeTlGF7o=
=P9YV
-----END PGP SIGNATURE-----


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