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: c/2804: [*not*] regression from 2.95.3


On 12 Dec 2001 rodrigc@gcc.gnu.org wrote:

> Synopsis: [*not*] regression from 2.95.3
>
> State-Changed-From-To: analyzed->closed
> State-Changed-Why:
>     Fixed in gcc 3.0.3.
>
>     Compiling this testcase results in the compilation error:
>     q.c: In function `EGA_setpixel':
>     q.c:58: invalid `asm': operand is neither a constant nor a condition code, invalid operand code 'c'
>     q.c:66: invalid `asm': operand is neither a constant nor a condition code, invalid operand code 'c'
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=2804&database=gcc
>

  Hello,

 First thanks to the guy who removed the "Internal error: Segmentation
fault" and for your time to re-test it. The main problem is solved.

 One thing I have to say is that what I want to do is still not possible.
The target is to access the content of an address in the %gs segment,
setting a minimum of constraint to the way it is accessed, so:
   movzbl %%gs:(3),%0
   movzbl %%gs:(%%eax),%0
should be possible. My %%gs points to the graphic memory, so sometimes
the compiler can optimise the address up to a know constant.

 First, up to now (I have to recheck with gcc 3.0.3), a "%c1" means
"if it is constant, do not put the constant prefix, if it is not
a constant, treat it like %1". In the gpeekb() inline function,
I do not have a clue whether %1 is constant or not.

 A better way to write the gpeekb would be using:
  asm (" movzbl %%gs:%a1,%0 "
	: "=r" (returned)
	: "g" (offset), "m" (*video_memory)
	);
 But that does not compile neither (not in all cases). This would
enable the compiler to generate:
   movzbl %%gs:(%%eax,%%ecx,2),%0
if he needs to.

 Because I am accessing video memory, I would like to have quite
efficient code... Right now I am using:
  asm (" movzbl %%gs:%a1,%0 "
	: "=r" (returned)
	: "r" (offset), "m" (*video_memory)
	);
so force the offset in a register. I also tried to use
 if(__builtin_constant_p (offset))
but there is warnings at the asm() because the operands will
probably not fit their constraint...

 Note that the perfect solution would probably be:
unsigned char graphic_pixel[640*480] __attribute__ ((segment (gs)));
unsigned *pixel32ptr __attribute__ ((segment (gs)));
 but I understand this is quite complex to implement.

  Thanks for reading,
  Etienne.


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