jayduhon / inferno-os

Automatically exported from code.google.com/p/inferno-os
2 stars 0 forks source link

FreeBSD/386/include/fpuctl.h:15:6: error: invalid input constraint 'al' in asm #231

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
With LLVM clang as the compiler I got the error in the subject. Googling 
revealed nothing about lowercase L.

Original issue reported on code.google.com by nikolai.saoukh@gmail.com on 5 Apr 2010 at 9:20

GoogleCodeExporter commented 9 years ago
the error is about the last line in this snippet of code:

        __asm__(        "xorb   $0x3f, %%al\n\t"
                        "pushw  %%ax\n\t"
                        "fwait\n\t"
                        "fldcw  (%%esp)\n\t"
                        "popw   %%ax\n\t"
                        : /* no output */
                        : "al" (fcr)

the last line is syntax to set register "al" (the low 8 bit of the eax 
register) to the value of fcr.  it seems gcc on my machine (4.2.1) just treats 
"al" as "eax" there (perhaps because fcr is ulong and other contents of eax are 
unspecified;  if i replace "al" with "eax", the exact same code is generated), 
whereas your version of llvm clang does not.  perhaps the code even intents to 
set more than just "al", because its setting two bytes of fpu control (ax) and 
only masking the lower byte.

so, should the "al" just be replaced with "eax"?

Original comment by mechiel@ueber.net on 23 Feb 2011 at 7:20