On Wed, Oct 03, 2018 at 03:03:00PM +0200, Peter Zijlstra wrote:
> +#define __GEN_RMWcc(fullop, _var, cc, clobbers, ...)                 \
> +({                                                                   \
> +     __label__ cc_label;                                             \
>       asm_volatile_goto (fullop "; j" #cc " %l[cc_label]"             \
> +                     : : [var] "m" (_var), ## __VA_ARGS__            \
>                       : clobbers : cc_label);                         \
> +     0;                                                              \
>  cc_label:                                                            \
> +     1;                                                              \
> +})

That's obviously crap...

This one seems to actually compile and generate identical code:

#define __GEN_RMWcc(fullop, _var, cc, clobbers, ...)                    \
({                                                                      \
        bool c = false;                                                 \
        asm_volatile_goto (fullop "; j" #cc " %l[cc_label]"             \
                        : : [var] "m" (_var), ## __VA_ARGS__            \
                        : clobbers : cc_label);                         \
        if (0) {                                                        \
cc_label:       c = true;                                               \
        }                                                               \
        c;                                                              \
})

Reply via email to