"Inconsistent Operand Constraints" with Inline ASM using GCC

1.6k views Asked by At

Getting this error when trying to compile this source file using GCC: https://github.com/wolf9466/cpuminer-multi/blob/master/cryptonight_aesni.c

"cryptonight_aesni.c:162:4: error: inconsistent operand constraints"

Specifically:

      uint64_t hi, lo;
 // hi,lo = 64bit x 64bit multiply of c[0] and b[0]

  __asm__("mulq %3\n\t"
      : "=d" (hi),
        "=a" (lo)
      : "%a" (c[0]),
        "rm" (b[0])
      : "cc" );

Very difficult to find out what this error even means, yet alone how to fix it

1

There are 1 answers

0
Armali On

The instruction mulq in this code is an x86 64-bit instruction. All the parameters are 64-bit values and can't fit in 32-bit registers (when compiling for a 32-bit x86 platform) – Michael Petch