This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
GCC can't count operands.
- To: gcc-bugs at gcc dot gnu dot org
- Subject: GCC can't count operands.
- From: Tony Mantler <eek at escape dot ca>
- Date: Thu, 23 Mar 2000 22:15:17 -0600
- Organisation: Judean People's Front; Department of Whips, Chains, Thumb-Screws, Six Tons of Whipping Cream, the Entire Soprano Section of the Mormon Tabernacle Choir and Guest Apperances of Eva Peron aka Eric Conspiracy Secret Laboratories
The attached ASM macro is giving me grief. GCC complains about there being
more than 10 operands, and refuses to compile. In reality, there are only 6
operands, since the input and output operands are overlayed.
Anyways, it's perfectly valid code, and deserves to be compiled without
protest, especially since the only reason there's that many operands in the
first place (x1,x2,x3,x4) is because GCC was optimizing away too many
registers and broke the code. :P
For the record, this code is used to very quickly paint a certain range of
memory with a constant value. (ie: 0 or -1)
ubb:~$ m68k-linux-gcc test.c
test.c: In function `main':
test.c:23: more than 10 operands in `asm'
ubb:~$ m68k-linux-gcc -v
Reading specs from /usr/local/lib/gcc-lib/m68k-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
int main(void) {
long t;
void *s = &t;
long count = sizeof(long);
int x1,x2,x3,x4;
if (!count)
return(0);
__asm__ __volatile__(
"lsrl #1,%1 ; jcc 1f ; moveb %2,%0@-\n\t"
"1: lsrl #1,%1 ; jcc 1f ; movew %2,%0@-\n\t"
"1: lsrl #1,%1 ; jcc 1f ; movel %2,%0@-\n\t"
"1: lsrl #1,%1 ; jcc 1f ; movel %2,%0@- ; movel %2,%0@-\n\t"
"1: subql #1,%1 ; jcs 3f\n\t"
"2: moveml %2/%3/%4/%5,%0@-\n\t"
"dbra %1,2b\n\t"
"3:"
: "=a" (s), "=d" (count), "=d" (x1), "=d" (x2), "=d" (x3), "=d" (x4)
: "2" (0), "3" (0), "4" (0), "5" (0),
"0" ((char *)s+count), "1" (count)
);
return(0);
}
Cheers - Tony :)
--
Tony Mantler Renaissance Nerd Extraordinaire eek@escape.ca
Winnipeg, Manitoba, Canada http://www.escape.ca/~eek