Home | History | Annotate | Download | only in s390x
      1 #include <stdio.h>
      2 #include "../../../none/tests/s390x/opcodes.h"
      3 int main()
      4 {
      5 	int field1, field2;
      6 	int result;
      7 
      8 	/*
      9          * gcc does some tricks for checking the highest bit. It seems
     10          * to load a full word/double word.
     11          * By using mask=10 for brc (jhe) only the msb is influencing
     12          * the code flow. This test was inspired by 308427
     13          */
     14 	asm volatile(	"oi %1,128\n\t"
     15 			"la 1,%1\n\t"
     16 			LTG(0,0,1,000,00)
     17 			"jhe 1f\n\t"
     18 			"lghi %0,0\n\t"
     19 			"j 2f\n\t"
     20 			"1:lghi %0,1\n\t"
     21 			"2:\n\t"
     22 			:"=d" (result)
     23 			:"Q" (field1)
     24 			:"0","cc");
     25 
     26 	if (result)
     27 		printf("Error\n");
     28 
     29 	asm volatile(	"oi %1,128\n\t"
     30 			"la 1,%1\n\t"
     31 			LT(0,0,1,000,00)
     32 			"jhe 1f\n\t"
     33 			"lghi %0,0\n\t"
     34 			"j 2f\n\t"
     35 			"1:lghi %0,1\n\t"
     36 			"2:\n\t"
     37 			:"=d" (result)
     38 			:"Q" (field2)
     39 			:"0","cc");
     40 
     41 	if (result)
     42 		printf("Error\n");
     43 
     44 	asm volatile(	"oi %1,128\n\t"
     45 			"la 1,%1\n\t"
     46 			LTG(0,0,1,000,00)
     47 			"jl 1f\n\t"
     48 			"lghi %0,1\n\t"
     49 			"j 2f\n\t"
     50 			"1:lghi %0,0\n\t"
     51 			"2:\n\t"
     52 			:"=d" (result)
     53 			:"Q" (field1)
     54 			:"0","cc");
     55 
     56 	if (result)
     57 		printf("Error\n");
     58 
     59 	asm volatile(	"oi %1,128\n\t"
     60 			"la 1,%1\n\t"
     61 			LT(0,0,1,000,00)
     62 			"jl 1f\n\t"
     63 			"lghi %0,1\n\t"
     64 			"j 2f\n\t"
     65 			"1:lghi %0,0\n\t"
     66 			"2:\n\t"
     67 			:"=d" (result)
     68 			:"Q" (field2)
     69 			:"0","cc");
     70 
     71 	if (result)
     72 		printf("Error\n");
     73 
     74 	return 0;
     75 }
     76