Home | History | Annotate | Download | only in s390x
      1 #include <stdio.h>
      2 
      3 #define DIV_REG_MEM(insn, d1_1, d1_2, d2)		\
      4 ({							\
      5 	unsigned long tmp1 = d1_1;			\
      6 	unsigned long tmp2 = d1_2;			\
      7 	asm volatile(	"lgr 2, %0\n"			\
      8 			"lgr 3, %1\n"			\
      9 			#insn " 2, %2\n"		\
     10 			"lgr %0,2\n"			\
     11 			"lgr %1,3\n"			\
     12 			: "+d" (tmp1), "+d" (tmp2)	\
     13 			: "Q" (d2)			\
     14 			: "2","3");			\
     15 	printf(#insn " %16.16lX%16.16lX / %16.16lX = %16.16lX (rem %16.16lX)\n", d1_1, d1_2, d2, tmp2, tmp1); \
     16 })
     17 
     18 #define DIV_REG_REG(insn, d1_1, d1_2, d2)		\
     19 ({							\
     20 	unsigned long tmp1 = d1_1;			\
     21 	unsigned long tmp2 = d1_2;			\
     22 	asm volatile(	"lgr 2, %0\n"			\
     23 			"lgr 3, %1\n"			\
     24 			#insn " 2, %2\n"		\
     25 			"lgr %0,2\n"			\
     26 			"lgr %1,3\n"			\
     27 			: "+d" (tmp1), "+d" (tmp2)	\
     28 			: "d" (d2)			\
     29 			: "2","3");			\
     30 	printf(#insn " %16.16lX%16.16lX / %16.16lX = %16.16lX (rem %16.16lX)\n", d1_1, d1_2, d2, tmp2, tmp1); \
     31 })
     32 
     33 
     34 #define memsweep(i, d2)						\
     35 ({								\
     36 	DIV_REG_MEM(i, 0x0ul, 0ul, d2);				\
     37 	DIV_REG_MEM(i, 0x0ul, 1ul, d2);				\
     38 	DIV_REG_MEM(i, 0x0ul, 0xfffful, d2);			\
     39 	DIV_REG_MEM(i, 0x0ul, 0x7ffful, d2);			\
     40 	DIV_REG_MEM(i, 0x0ul, 0x8000ul, d2);			\
     41 	DIV_REG_MEM(i, 0x0ul, 0xfffffffful, d2);		\
     42 	DIV_REG_MEM(i, 0x0ul, 0x80000000ul, d2);		\
     43 	DIV_REG_MEM(i, 0x0ul, 0x7ffffffful, d2);		\
     44 	DIV_REG_MEM(i, 0x0ul, 0xfffffffffffffffful, d2);	\
     45 	DIV_REG_MEM(i, 0x0ul, 0x8000000000000000ul, d2);	\
     46 	DIV_REG_MEM(i, 0x0ul, 0x7ffffffffffffffful, d2);	\
     47 	DIV_REG_MEM(i, 0x1ul, 0xaffffffful, d2);		\
     48 })
     49 
     50 #define regsweep(i, d2)						\
     51 ({								\
     52 	DIV_REG_REG(i, 0x0ul, 0ul, d2);				\
     53 	DIV_REG_REG(i, 0x0ul, 1ul, d2);				\
     54 	DIV_REG_REG(i, 0x0ul, 0xfffful, d2);			\
     55 	DIV_REG_REG(i, 0x0ul, 0x7ffful, d2);			\
     56 	DIV_REG_REG(i, 0x0ul, 0x8000ul, d2);			\
     57 	DIV_REG_REG(i, 0x0ul, 0xfffffffful, d2);		\
     58 	DIV_REG_REG(i, 0x0ul, 0x80000000ul, d2);		\
     59 	DIV_REG_REG(i, 0x0ul, 0x7ffffffful, d2);		\
     60 	DIV_REG_REG(i, 0x0ul, 0xfffffffffffffffful, d2);	\
     61 	DIV_REG_REG(i, 0x0ul, 0x8000000000000000ul, d2);	\
     62 	DIV_REG_REG(i, 0x0ul, 0x7ffffffffffffffful, d2);	\
     63 	DIV_REG_REG(i, 0x1ul, 0xaffffffful, d2);		\
     64 })
     65 
     66