/* SPDX-License-Identifier: GPL-2.0 */1#ifndef _ASM_S390_ASM_H2#define _ASM_S390_ASM_H34#include <linux/stringify.h>56/*7* Helper macros to be used for flag output operand handling.8* Inline assemblies must use four of the five supplied macros:9*10* Use CC_IPM(sym) at the end of the inline assembly; this extracts the11* condition code and program mask with the ipm instruction and writes it to12* the variable with symbolic name [sym] if the compiler has no support for13* flag output operands. If the compiler has support for flag output operands14* this generates no code.15*16* Use CC_OUT(sym, var) at the output operand list of an inline assembly. This17* defines an output operand with symbolic name [sym] for the variable18* [var]. [var] must be an int variable and [sym] must be identical with [sym]19* used with CC_IPM().20*21* Use either CC_CLOBBER or CC_CLOBBER_LIST() for the clobber list. Use22* CC_CLOBBER if the clobber list contains only "cc", otherwise use23* CC_CLOBBER_LIST() and add all clobbers as argument to the macro.24*25* Use CC_TRANSFORM() to convert the variable [var] which contains the26* extracted condition code. If the condition code is extracted with ipm, the27* [var] also contains the program mask. CC_TRANSFORM() moves the condition28* code to the two least significant bits and sets all other bits to zero.29*/30#if defined(__GCC_ASM_FLAG_OUTPUTS__) && !(IS_ENABLED(CONFIG_CC_ASM_FLAG_OUTPUT_BROKEN))3132#define __HAVE_ASM_FLAG_OUTPUTS__3334#define CC_IPM(sym)35#define CC_OUT(sym, var) "=@cc" (var)36#define CC_TRANSFORM(cc) ({ cc; })37#define CC_CLOBBER38#define CC_CLOBBER_LIST(...) __VA_ARGS__3940#else4142#define CC_IPM(sym) " ipm %[" __stringify(sym) "]\n"43#define CC_OUT(sym, var) [sym] "=d" (var)44#define CC_TRANSFORM(cc) ({ (cc) >> 28; })45#define CC_CLOBBER "cc"46#define CC_CLOBBER_LIST(...) "cc", __VA_ARGS__4748#endif4950#endif /* _ASM_S390_ASM_H */515253