Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lib/mpi: fix build with clang

Use just @ to denote comments which works with gcc and clang.
Otherwise clang reports an escape sequence error:
error: invalid % escape in inline assembly string

Use %0-%3 as operand references, this avoids:
error: invalid operand in inline asm: 'umull ${1:r}, ${0:r}, ${2:r}, ${3:r}'

Also remove superfluous casts on output operands to avoid warnings
such as:
warning: invalid use of a cast in an inline asm context requiring an l-value

Signed-off-by: Stefan Agner <stefan@agner.ch>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Stefan Agner and committed by
Herbert Xu
dea632ca 67adc432

+12 -12
+12 -12
lib/mpi/longlong.h
··· 176 176 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ 177 177 __asm__ ("adds %1, %4, %5\n" \ 178 178 "adc %0, %2, %3" \ 179 - : "=r" ((USItype)(sh)), \ 180 - "=&r" ((USItype)(sl)) \ 179 + : "=r" (sh), \ 180 + "=&r" (sl) \ 181 181 : "%r" ((USItype)(ah)), \ 182 182 "rI" ((USItype)(bh)), \ 183 183 "%r" ((USItype)(al)), \ ··· 185 185 #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ 186 186 __asm__ ("subs %1, %4, %5\n" \ 187 187 "sbc %0, %2, %3" \ 188 - : "=r" ((USItype)(sh)), \ 189 - "=&r" ((USItype)(sl)) \ 188 + : "=r" (sh), \ 189 + "=&r" (sl) \ 190 190 : "r" ((USItype)(ah)), \ 191 191 "rI" ((USItype)(bh)), \ 192 192 "r" ((USItype)(al)), \ 193 193 "rI" ((USItype)(bl))) 194 194 #if defined __ARM_ARCH_2__ || defined __ARM_ARCH_3__ 195 195 #define umul_ppmm(xh, xl, a, b) \ 196 - __asm__ ("%@ Inlined umul_ppmm\n" \ 196 + __asm__ ("@ Inlined umul_ppmm\n" \ 197 197 "mov %|r0, %2, lsr #16 @ AAAA\n" \ 198 198 "mov %|r2, %3, lsr #16 @ BBBB\n" \ 199 199 "bic %|r1, %2, %|r0, lsl #16 @ aaaa\n" \ ··· 206 206 "addcs %|r2, %|r2, #65536\n" \ 207 207 "adds %1, %|r1, %|r0, lsl #16\n" \ 208 208 "adc %0, %|r2, %|r0, lsr #16" \ 209 - : "=&r" ((USItype)(xh)), \ 210 - "=r" ((USItype)(xl)) \ 209 + : "=&r" (xh), \ 210 + "=r" (xl) \ 211 211 : "r" ((USItype)(a)), \ 212 212 "r" ((USItype)(b)) \ 213 213 : "r0", "r1", "r2") 214 214 #else 215 215 #define umul_ppmm(xh, xl, a, b) \ 216 - __asm__ ("%@ Inlined umul_ppmm\n" \ 217 - "umull %r1, %r0, %r2, %r3" \ 218 - : "=&r" ((USItype)(xh)), \ 219 - "=&r" ((USItype)(xl)) \ 216 + __asm__ ("@ Inlined umul_ppmm\n" \ 217 + "umull %1, %0, %2, %3" \ 218 + : "=&r" (xh), \ 219 + "=&r" (xl) \ 220 220 : "r" ((USItype)(a)), \ 221 - "r" ((USItype)(b)) \ 221 + "r" ((USItype)(b)) \ 222 222 : "r0", "r1") 223 223 #endif 224 224 #define UMUL_TIME 20