Re: extended asm - what does this option do?

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

 



dw <limegreensocks@xxxxxxxxx> writes:

> Q1: So what's the difference between %k1 and just %1?

"k" and other codes are documented in comments above
gcc/gcc/final.c (output_asm_insn) and gcc/gcc/config/i386/i386.c
(ix86_print_operand).  On i386, "k" means use a SImode (32-bit
integer) register.  So if you have...

#define __cpuid(level, a, b, c, d)            \
  __asm__ __volatile__ ("xchg{l}\t{%%}ebx, %k1\n\t"            \
       "cpuid\n\t"                    \
       "xchg{l}\t{%%}ebx, %1\n\t"            \
       : "=a" (a), "=&r" (b), "=c" (c), "=d" (d)    \
       : "0" (level))

int
fun (void)
{
  long long a, b, c, d;
  __cpuid(0, a, b, c, d);
  return a;
}

... then the "%k1" might expand to "%r13d" but the "%1" to "%r13".

> Q2: And while I'm asking, what's with the {braces} in the asm?

Apparently, "{foo|bar}" becomes "foo" with -masm=att but "bar"
with -masm=intel.  I didn't find this in the documentation.
It's implemented in gcc/gcc/final.c (do_assembler_dialects).




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux