This is the mail archive of the gcc@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: MS/CW-style inline assembly for GCC


Andrew Haley <aph@redhat.com> writes:
> Maintaining two totally different assembler syntaxes doesn't seem to
> me like a sensible plan.  Perhaps, with a little thought, we could
> improve what we have at the moment.  "less ugly" might, for example,
> involve replacing operands like "%1" with real names in a slightly
> less evil way than we do at the moment.
> 
> Andrew.

 You mean nicer like [name]?

e.g.
 __asm__ __volatile__("1: ldstub [%[ptr] + 3], %[lock]\n"
                      "\torcc %[lock], 0, %[ignore]\n"
                      "\tbne 1b\n" /* go back until we have the lock */
                      "\tld [%[ptr]], %[inc]\n"
                      "\tsra %[inc], 8, %[inc]\n"
                      "\tadd %[inc], %[val], %[inc]\n"
                      "\tsll %[inc], 8, %[lock]\n"
                      "\tst %[lock],[%[ptr]]\n" /* Release the lock */
                      : [inc] "=&r" (increment), [lock] "=r" (lock),
                        [ignore] "=&r" (ignore)
                      : "0" (increment), [ptr] "r" (ptr), [val] "r" (val)
                      );

Jim


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