Nick Desaulniers <ndesau...@google.com> wrote on 22.08.2020 03:13:13:
> > In file included from drivers/tty/tty_buffer.c:8:
> > In file included from include/linux/tty.h:5:
> > In file included from include/linux/fs.h:6:
> > In file included from include/linux/wait_bit.h:8:
> > In file included from include/linux/wait.h:7:
> > In file included from include/linux/list.h:9:
> > In file included from include/linux/kernel.h:12:
> > In file included from include/linux/bitops.h:29:
> > In file included from arch/s390/include/asm/bitops.h:39:
> > >> arch/s390/include/asm/atomic_ops.h:56:45: error: invalid
> operand for inline asm constraint 'i'
> > __ATOMIC_CONST_OPS(__atomic_add_const, int, "asi")
> > ^
>
> It might be interesting to dissect this one. Likely will break the
> build otherwise.
Do you have a standalone test case? This seems to work fine for me
with current clang:
define __always_inline inline __attribute__((__always_inline__))
#define __ATOMIC_CONST_OP(op_name, op_type, op_string, op_barrier) \
static __always_inline void op_name(op_type val, op_type *ptr) \
{ \
asm volatile( \
op_string " %[ptr],%[val]\n" \
op_barrier \
: [ptr] "+Q" (*ptr) : [val] "i" (val) : "cc", "memory");\
}
#define __ATOMIC_CONST_OPS(op_name, op_type, op_string) \
__ATOMIC_CONST_OP(op_name, op_type, op_string, "\n") \
__ATOMIC_CONST_OP(op_name##_barrier, op_type, op_string, "bcr 14,0\n")
__ATOMIC_CONST_OPS(__atomic_add_const, int, "asi")
__ATOMIC_CONST_OPS(__atomic64_add_const, long, "agsi")
void test (int *x)
{
__atomic_add_const(123, x);
}
Bye,
Ulrich