]> Git Repo - linux.git/blob - arch/s390/include/asm/asm.h
Linux 6.14-rc3
[linux.git] / arch / s390 / include / asm / asm.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_ASM_H
3 #define _ASM_S390_ASM_H
4
5 #include <linux/stringify.h>
6
7 /*
8  * Helper macros to be used for flag output operand handling.
9  * Inline assemblies must use four of the five supplied macros:
10  *
11  * Use CC_IPM(sym) at the end of the inline assembly; this extracts the
12  * condition code and program mask with the ipm instruction and writes it to
13  * the variable with symbolic name [sym] if the compiler has no support for
14  * flag output operands. If the compiler has support for flag output operands
15  * this generates no code.
16  *
17  * Use CC_OUT(sym, var) at the output operand list of an inline assembly. This
18  * defines an output operand with symbolic name [sym] for the variable
19  * [var]. [var] must be an int variable and [sym] must be identical with [sym]
20  * used with CC_IPM().
21  *
22  * Use either CC_CLOBBER or CC_CLOBBER_LIST() for the clobber list. Use
23  * CC_CLOBBER if the clobber list contains only "cc", otherwise use
24  * CC_CLOBBER_LIST() and add all clobbers as argument to the macro.
25  *
26  * Use CC_TRANSFORM() to convert the variable [var] which contains the
27  * extracted condition code. If the condition code is extracted with ipm, the
28  * [var] also contains the program mask. CC_TRANSFORM() moves the condition
29  * code to the two least significant bits and sets all other bits to zero.
30  */
31 #if defined(__GCC_ASM_FLAG_OUTPUTS__) && !(IS_ENABLED(CONFIG_CC_ASM_FLAG_OUTPUT_BROKEN))
32
33 #define __HAVE_ASM_FLAG_OUTPUTS__
34
35 #define CC_IPM(sym)
36 #define CC_OUT(sym, var)        "=@cc" (var)
37 #define CC_TRANSFORM(cc)        ({ cc; })
38 #define CC_CLOBBER
39 #define CC_CLOBBER_LIST(...)    __VA_ARGS__
40
41 #else
42
43 #define CC_IPM(sym)             "       ipm     %[" __stringify(sym) "]\n"
44 #define CC_OUT(sym, var)        [sym] "=d" (var)
45 #define CC_TRANSFORM(cc)        ({ (cc) >> 28; })
46 #define CC_CLOBBER              "cc"
47 #define CC_CLOBBER_LIST(...)    "cc", __VA_ARGS__
48
49 #endif
50
51 #endif /* _ASM_S390_ASM_H */
This page took 0.034449 seconds and 4 git commands to generate.