Your statement is partial and lacks the definitions of the variables used to populate the input constraints of your assembly instruction.
Up vote -1 down vote favorite share g+ share fb share tw.
I'm learning GCC extended asm options asm goto ( "clc\n" "lo:\t" "lods\t%ax\n\t" "lea\t%wc(%base, %off, %k), %la" "adc\t%ax, (%la)\n\t" "inc\t%off\n\t" "jnz\tlo\n\t" "jnc\t%lnocarry\n" : : base "d" (th), oz "S" (oz), wc "I" (wc*sizeof(uInt)), k "N" (sizeof(uInt)), la "b" (0), ax "a" (0), off "c" (-wc) : : nocarry ); And having in compilation: > impossible constraint in 'asm' Have tried to comment all constraints one-by-one, same result. Please, help! Gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3), i686-linux-gnu (32bit), kernel 3.0.0-14-generic gcc assembly inline-assembly link|improve this question asked Dec 20 '11 at 1:23leventov426 80% accept rate.
Your statement is partial and lacks the definitions of the variables used to populate the input constraints of your assembly instruction. The most likely candidate is the wc "I" (wc * sizeof(uInt)) expression if wc is anything else but a compile-time constant - "I" constraints must be evaluatable to an immediate. Could also be the k "N" (sizeof(uInt)) because that's not a match for lea.
I'd suggest changing the statement to: asm ( "lea (%base, %off, %k), %base\n\t" "neg %off\n\t" "clc\n\t" "lo: " "lods %ax\n\t" "lea (%base, %off, %k), %la\n\t" "adc %ax, (%la)\n\t" "inc %off\n\t" "jnz lo\n\t" "jnc %lnocarry\n" : : k "I"(sizeof(uInt)), base "d" (th), oz "S" (oz), la "b" (0), ax "a" (0), off "c" (wc) : : nocarry ); but you might want to evaluate letting the compiler more freedom to choose (like, saying base "r" (th + wc) assuming th is uInt*). Likewise, with the assembly instructions you have, there's no explicit need to use "a", "b", "c" or "d", so you artificially limit which regs the compiler may choose. If that's what you want, maybe writing the function fully in assembly is better / easier than trying to coerce the compiler.
1 For solid guessing based on a vague und unclear question – drhirsch Dec 20 '11 at 12:18 Thank you for useful advice. Wc is the "length" member of arbitrary precision ariphmetic class, of cause nonstatic. But actually I decided to change the approach, this is current (working :) variant: – leventov Dec 20 '11 at 19:04.
BigInt & BigInt::operator+=(const BigInt &rhs) { this->grow(rhs. Wc); uInt *th = (uInt*)words, *oz = (uInt*)rhs. Words; asm goto ( "clc\n" "l1:\t" "mov\t(%oz), %ax\n\t" "adc\t%ax, (%th)\n\t" "lahf\n\t" "add\t%ws, %th\n\t" "add\t%ws, %oz\n\t" "sahf\n\t" "loop\tl1\n\t" "jnc\t%lnocarry\n" : : th "r" (th), oz "r" (oz), ws "I" (sizeof(uInt)), ax "a" ((uInt)0), "c" (wc) : : nocarry ).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.