Messages in this thread | | | From | Nick Desaulniers <> | Date | Mon, 11 May 2020 10:22:50 -0700 | Subject | Re: [PATCH v5] x86: bitops: fix build regression |
| |
On Sat, May 9, 2020 at 5:20 AM Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > > On Fri, May 8, 2020 at 9:35 PM Nick Desaulniers <ndesaulniers@google.com> wrote: > > > > This is easily reproducible via CC=clang+CONFIG_STAGING=y+CONFIG_VT6656=m. > > > > It turns out that if your config tickles __builtin_constant_p via > > differences in choices to inline or not, these statements produce > > invalid assembly: > > > > $ cat foo.c > > long a(long b, long c) { > > asm("orb\t%1, %0" : "+q"(c): "r"(b)); > > return c; > > } > > $ gcc foo.c > > foo.c: Assembler messages: > > foo.c:2: Error: `%rax' not allowed with `orb' > > > > Use the `%b` "x86 Operand Modifier" to instead force register allocation > > to select a lower-8-bit GPR operand. > > > > The "q" constraint only has meaning on -m32 otherwise is treated as > > "r". Not all GPRs have low-8-bit aliases for -m32. > > > > Looks very good! > One question though, does it work with minimum supported version of gcc?
Yes; the oldest version of GCC in godbolt.org is GCC 4.1.2 which supports the syntax and generates the expected lower-8-bit register operands. -- Thanks, ~Nick Desaulniers
| |