------- Comment #37 from michaelni at gmx dot at 2006-11-08 20:45 ------- (In reply to comment #36) > (In reply to comment #21) > > asm volatile("" > > : "=m" (*(unsigned int*)(src + 0*stride)), > > "=m" (*(unsigned int*)(src + 1*stride)), > > "=m" (*(unsigned int*)(src + 2*stride)), > > "=m" (*(unsigned int*)(src + 3*stride)), > > "=m" (*(unsigned int*)(src + 4*stride)), > > "=m" (*(unsigned int*)(src + 5*stride)), > > "=m" (*(unsigned int*)(src + 6*stride)), > > "=m" (*(unsigned int*)(src + 7*stride)) > > ); > > (In reply to comment #26) > > it might also happen that in some intentionally overconstrained cases it > > ends up > > searching the whole 5040 possible assignments of 7 registers onto 7 non > > memory > > operands but still it wont fail > > The example Martin gave has *8* operands. You can try every possible direct > mapping of those 8 addresses to just 7 registers, but they will obviously all > fail. Except with ia32 addressing modes it _can_ be done, and with only 4 > registers. > > reg1 = src, reg2 = stride, reg3 = src+stride*3, reg4 = src+stride*6 > Then the 8 memory operands are: > (reg1), (reg1,reg2,1), (reg1,reg2,2), (reg3), > (reg1,reg2,4), (reg3,reg2,2), (reg4), (reg3,reg2,4) > > When one considers all the addressing modes, there are not just 7 possible > registers, but (I think) 261 possible addresses. There are not just 5040 > possibilities as Michael said, but over 76 x 10^15 possible ways of assigning > these addresses to 7 operands! Then each register can be loaded not just with > an address but with some sub-expression too, like how I loaded reg2 with > stride.
"m" operands and variations can be copied onto the stack and accessed from there, so no matter how many memory operands there are they can always be accessed over esp on ia32, so whatever you did calculate it is meaningless now if there is a unwritten rule that "m" operands and variations of them cannot be copied anywhere, then it would be very desireable to have a asm constraint like "m" without this restriction this would resolve this and several other bugs also it would be very nice if such a dont copy restriction on "m" if it does exist could be documented -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203