Date: Sun, 4 Jan 1998 14:28:57 -0800 (PST) Message-Id: <199801042228.OAA26965@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: GAMMELJL AT SLU DOT EDU, djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: code which won't compile with -O2 on Precedence: bulk At 07:23 1/3/1998 -0600, GAMMELJL AT SLU DOT EDU wrote: > I do not understand what you mean by ri. I assume that you mean >r1,r2,etc. So I write the input line: > : "r0" (z), "r1" (x), "r2" (y) \ >and leave the output line blank ( : \ ). > The compilation and running goes ok except the compiler issues >warnings "operand 0 has constraint 0", "operand 1 has constraints 1", etc. Are you sure? "ri" works for me. It tells the compiler to either place the value in a register ("r"), or to generate an immediate "i"nteger constant. Do not use the numbers. > While the compiler does not recognize ri, it does recognize rm which >seems to be very similar to g. If I use all g's (not followed by a numeral) >the compiler issues "inconsistent constraints". "rm" is exactly the same as "g". It places the value in either a "r"egister or in "m"emory. > It is quite interesting that you mentioned %%ebx(,%%ecx,4) because >that is exactly what I would like to do, namely, get a register for a >pointer. Brennan mentions that immed32(basepointer,indexpointer,indexscale) >and the formula > address=immediate32+basepointer+indexpointer+indexscale >go together. The indexscale is *multiplied* by indexpointer, not added. Was that a typo? > Now, I suppose ebp can contain a basepointer--can it? Suppose >immediate32=_array--is it? I also suppose that the (, in the form >_array(,%%ecx,4) implies that basepointer=0. Here comes the question: >If there were a null pointer so that immediate32=0, and if one could set >basepointer=_array, then maybe (just maybe), one could write > 0(%%ebp,%%ecx,4) >with "ebp" (array) on the input line. So one would have the x in my >example in a register (ebp). > That might really speed up some codes, but is it obvious nonsense? No, that's perfectly reasonable. The 0 is superfluous, in fact. (Should be $0, anyway). Also, you can use any register you want for the base pointer, not just %ebp. (It may be difficult to use, since GCC uses it as a frame pointer.) Nate Eldredge eldredge AT ap DOT net