Add a few testcases that exercise the s390_calculate_icc helper.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12561 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am
index 6f5b95a..ddb4f4e 100644
--- a/none/tests/s390x/Makefile.am
+++ b/none/tests/s390x/Makefile.am
@@ -6,7 +6,7 @@
              and or xor insert div srst fold_And16 flogr sub_EI add_EI \
              and_EI or_EI xor_EI insert_EI mul_GE add_GE condloadstore \
              op_exception fgx stck stckf stcke stfle cksm mvcl clcl troo \
-             trto trot trtt tr tre
+             trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj
 
 check_PROGRAMS = $(INSN_TESTS) \
 		 allexec \
diff --git a/none/tests/s390x/cgij.c b/none/tests/s390x/cgij.c
new file mode 100644
index 0000000..d760a5d
--- /dev/null
+++ b/none/tests/s390x/cgij.c
@@ -0,0 +1,167 @@
+#include <stdio.h>
+#include <stdint.h>
+#include "opcodes.h"
+
+#define BRASLCLOBBER "0","1","2","3","4","5","14", \
+		     "f0","f1","f2","f3","f4","f5","f6","f7"
+
+void if_eq(void)        { printf("equal\n");   }
+void if_ne(void)        { printf("not equal\n");   }
+void if_gt(void)        { printf("greater than\n");   }
+void if_le(void)        { printf("less or equal\n");   }
+void if_lt(void)        { printf("less than\n");   }
+void if_ge(void)        { printf("greater or equal\n");   }
+void if_taken(void)     { printf("taken\n");   }
+void if_not_taken(void) { printf("not taken\n");   }
+
+#undef LT
+#define NEVER 0
+#define GT 2
+#define LT 4
+#define NE 6
+#define EQ 8
+#define LE C
+#define GE A
+#define ALWAYS E
+
+
+void compare_never(int64_t value)
+{
+   register int64_t val asm("r7") = value;
+
+   asm volatile(
+                CGIJ(7,NEVER,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_always(int64_t value)
+{
+   register int64_t val asm("r7") = value;
+
+   asm volatile(
+                CGIJ(7,ALWAYS,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_le42(int64_t value)
+{
+   register int64_t val asm("r7") = value;
+
+   asm volatile(
+                CGIJ(7,LE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_gt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_le\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ge42(int64_t value)
+{
+   register int64_t val asm("r7") = value;
+
+   asm volatile(
+                CGIJ(7,GE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_lt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ge\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_gt42(int64_t value)
+{
+   register int64_t val asm("r7") = value;
+
+   asm volatile(
+                CGIJ(7,GT,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_le\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_gt\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_lt42(int64_t value)
+{
+   register int64_t val asm("r7") = value;
+
+   asm volatile(
+                CGIJ(7,LT,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_ge\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_lt\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_eq42(int64_t value)
+{
+   register int64_t val asm("r7") = value;
+
+   asm volatile(
+                CGIJ(7,EQ,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_ne\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_eq\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ne42(int64_t value)
+{
+   register int64_t val asm("r7") = value;
+
+   asm volatile(
+                CGIJ(7,NE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_eq\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ne\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+int main()
+{
+   compare_eq42(-12);
+   compare_eq42(42);
+   compare_eq42(100);
+
+   compare_ne42(-12);
+   compare_ne42(42);
+   compare_ne42(100);
+
+   compare_gt42(-12);
+   compare_gt42(42);
+   compare_gt42(100);
+
+   compare_lt42(-12);
+   compare_lt42(42);
+   compare_lt42(100);
+
+   compare_le42(-12);
+   compare_le42(42);
+   compare_le42(100);
+
+   compare_ge42(-12);
+   compare_ge42(42);
+   compare_ge42(100);
+
+   compare_never(-12);
+   compare_never(42);
+   compare_never(100);
+
+   compare_always(-12);
+   compare_always(42);
+   compare_always(100);
+
+   return 0;
+}
diff --git a/none/tests/s390x/cgij.stderr.exp b/none/tests/s390x/cgij.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/cgij.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/cgij.stdout.exp b/none/tests/s390x/cgij.stdout.exp
new file mode 100644
index 0000000..bd98295
--- /dev/null
+++ b/none/tests/s390x/cgij.stdout.exp
@@ -0,0 +1,24 @@
+not equal
+equal
+not equal
+not equal
+equal
+not equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+not taken
+not taken
+not taken
+taken
+taken
+taken
diff --git a/none/tests/s390x/cgij.vgtest b/none/tests/s390x/cgij.vgtest
new file mode 100644
index 0000000..1a75de9
--- /dev/null
+++ b/none/tests/s390x/cgij.vgtest
@@ -0,0 +1 @@
+prog: cgij
diff --git a/none/tests/s390x/cgrj.c b/none/tests/s390x/cgrj.c
new file mode 100644
index 0000000..84d4f2f
--- /dev/null
+++ b/none/tests/s390x/cgrj.c
@@ -0,0 +1,175 @@
+#include <stdio.h>
+#include <stdint.h>
+#include "opcodes.h"
+
+#define BRASLCLOBBER "0","1","2","3","4","5","14", \
+		     "f0","f1","f2","f3","f4","f5","f6","f7"
+
+void if_eq(void)        { printf("equal\n");   }
+void if_ne(void)        { printf("not equal\n");   }
+void if_gt(void)        { printf("greater than\n");   }
+void if_le(void)        { printf("less or equal\n");   }
+void if_lt(void)        { printf("less than\n");   }
+void if_ge(void)        { printf("greater or equal\n");   }
+void if_taken(void)     { printf("taken\n");   }
+void if_not_taken(void) { printf("not taken\n");   }
+
+#undef LT
+#define NEVER 0
+#define GT 2
+#define LT 4
+#define NE 6
+#define EQ 8
+#define LE C
+#define GE A
+#define ALWAYS E
+
+
+void compare_never(int64_t value1, int64_t value2)
+{
+   register int64_t val1 asm("r7") = value1;
+   register int64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CGRJ(7,8,8,NEVER) "\n\t"
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_always(int64_t value1, int64_t value2)
+{
+   register int64_t val1 asm("r7") = value1;
+   register int64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CGRJ(7,8,8,ALWAYS) "\n\t"
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_le(int64_t value1, int64_t value2)
+{
+   register int64_t val1 asm("r7") = value1;
+   register int64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CGRJ(7,8,8,LE) "\n\t"
+                "brasl 14,if_gt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_le\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ge(int64_t value1, int64_t value2)
+{
+   register int64_t val1 asm("r7") = value1;
+   register int64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CGRJ(7,8,8,GE) "\n\t"
+                "brasl 14,if_lt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ge\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_gt(int64_t value1, int64_t value2)
+{
+   register int64_t val1 asm("r7") = value1;
+   register int64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CGRJ(7,8,8,GT) "\n\t"
+                "brasl 14,if_le\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_gt\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_lt(int64_t value1, int64_t value2)
+{
+   register int64_t val1 asm("r7") = value1;
+   register int64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CGRJ(7,8,8,LT) "\n\t"
+                "brasl 14,if_ge\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_lt\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_eq(int64_t value1, int64_t value2)
+{
+   register int64_t val1 asm("r7") = value1;
+   register int64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CGRJ(7,8,8,EQ) "\n\t"
+                "brasl 14,if_ne\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_eq\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ne(int64_t value1, int64_t value2)
+{
+   register int64_t val1 asm("r7") = value1;
+   register int64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CGRJ(7,8,8,NE) "\n\t"
+                "brasl 14,if_eq\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ne\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+int main()
+{
+   compare_eq(-12, 42);
+   compare_eq(42, 42);
+   compare_eq(100, 42);
+
+   compare_ne(-12, 42);
+   compare_ne(42, 42);
+   compare_ne(100, 42);
+
+   compare_gt(-12, 42);
+   compare_gt(42, 42);
+   compare_gt(100, 42);
+
+   compare_lt(-12, 42);
+   compare_lt(42, 42);
+   compare_lt(100, 42);
+
+   compare_le(-12, 42);
+   compare_le(42, 42);
+   compare_le(100, 42);
+
+   compare_ge(-12, 42);
+   compare_ge(42, 42);
+   compare_ge(100, 42);
+
+   compare_never(-12, 42);
+   compare_never(42, 42);
+   compare_never(100, 42);
+
+   compare_always(-12, 42);
+   compare_always(42, 42);
+   compare_always(100, 42);
+
+   return 0;
+}
diff --git a/none/tests/s390x/cgrj.stderr.exp b/none/tests/s390x/cgrj.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/cgrj.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/cgrj.stdout.exp b/none/tests/s390x/cgrj.stdout.exp
new file mode 100644
index 0000000..bd98295
--- /dev/null
+++ b/none/tests/s390x/cgrj.stdout.exp
@@ -0,0 +1,24 @@
+not equal
+equal
+not equal
+not equal
+equal
+not equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+not taken
+not taken
+not taken
+taken
+taken
+taken
diff --git a/none/tests/s390x/cgrj.vgtest b/none/tests/s390x/cgrj.vgtest
new file mode 100644
index 0000000..f61e06e
--- /dev/null
+++ b/none/tests/s390x/cgrj.vgtest
@@ -0,0 +1 @@
+prog: cgrj
diff --git a/none/tests/s390x/cij.c b/none/tests/s390x/cij.c
new file mode 100644
index 0000000..4e47d98
--- /dev/null
+++ b/none/tests/s390x/cij.c
@@ -0,0 +1,167 @@
+#include <stdio.h>
+#include <stdint.h>
+#include "opcodes.h"
+
+#define BRASLCLOBBER "0","1","2","3","4","5","14", \
+		     "f0","f1","f2","f3","f4","f5","f6","f7"
+
+void if_eq(void)        { printf("equal\n");   }
+void if_ne(void)        { printf("not equal\n");   }
+void if_gt(void)        { printf("greater than\n");   }
+void if_le(void)        { printf("less or equal\n");   }
+void if_lt(void)        { printf("less than\n");   }
+void if_ge(void)        { printf("greater or equal\n");   }
+void if_taken(void)     { printf("taken\n");   }
+void if_not_taken(void) { printf("not taken\n");   }
+
+#undef LT
+#define NEVER 0
+#define GT 2
+#define LT 4
+#define NE 6
+#define EQ 8
+#define LE C
+#define GE A
+#define ALWAYS E
+
+
+void compare_never(int32_t value)
+{
+   register int32_t val asm("r7") = value;
+
+   asm volatile(
+                CIJ(7,NEVER,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_always(int32_t value)
+{
+   register int32_t val asm("r7") = value;
+
+   asm volatile(
+                CIJ(7,ALWAYS,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_le42(int32_t value)
+{
+   register int32_t val asm("r7") = value;
+
+   asm volatile(
+                CIJ(7,LE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_gt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_le\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ge42(int32_t value)
+{
+   register int32_t val asm("r7") = value;
+
+   asm volatile(
+                CIJ(7,GE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_lt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ge\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_gt42(int32_t value)
+{
+   register int32_t val asm("r7") = value;
+
+   asm volatile(
+                CIJ(7,GT,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_le\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_gt\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_lt42(int32_t value)
+{
+   register int32_t val asm("r7") = value;
+
+   asm volatile(
+                CIJ(7,LT,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_ge\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_lt\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_eq42(int32_t value)
+{
+   register int32_t val asm("r7") = value;
+
+   asm volatile(
+                CIJ(7,EQ,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_ne\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_eq\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ne42(int32_t value)
+{
+   register int32_t val asm("r7") = value;
+
+   asm volatile(
+                CIJ(7,NE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_eq\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ne\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+int main()
+{
+   compare_eq42(-12);
+   compare_eq42(42);
+   compare_eq42(100);
+
+   compare_ne42(-12);
+   compare_ne42(42);
+   compare_ne42(100);
+
+   compare_gt42(-12);
+   compare_gt42(42);
+   compare_gt42(100);
+
+   compare_lt42(-12);
+   compare_lt42(42);
+   compare_lt42(100);
+
+   compare_le42(-12);
+   compare_le42(42);
+   compare_le42(100);
+
+   compare_ge42(-12);
+   compare_ge42(42);
+   compare_ge42(100);
+
+   compare_never(-12);
+   compare_never(42);
+   compare_never(100);
+
+   compare_always(-12);
+   compare_always(42);
+   compare_always(100);
+
+   return 0;
+}
diff --git a/none/tests/s390x/cij.stderr.exp b/none/tests/s390x/cij.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/cij.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/cij.stdout.exp b/none/tests/s390x/cij.stdout.exp
new file mode 100644
index 0000000..bd98295
--- /dev/null
+++ b/none/tests/s390x/cij.stdout.exp
@@ -0,0 +1,24 @@
+not equal
+equal
+not equal
+not equal
+equal
+not equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+not taken
+not taken
+not taken
+taken
+taken
+taken
diff --git a/none/tests/s390x/cij.vgtest b/none/tests/s390x/cij.vgtest
new file mode 100644
index 0000000..959413f
--- /dev/null
+++ b/none/tests/s390x/cij.vgtest
@@ -0,0 +1 @@
+prog: cij
diff --git a/none/tests/s390x/clgij.c b/none/tests/s390x/clgij.c
new file mode 100644
index 0000000..11a8bf5
--- /dev/null
+++ b/none/tests/s390x/clgij.c
@@ -0,0 +1,167 @@
+#include <stdio.h>
+#include <stdint.h>
+#include "opcodes.h"
+
+#define BRASLCLOBBER "0","1","2","3","4","5","14", \
+		     "f0","f1","f2","f3","f4","f5","f6","f7"
+
+void if_eq(void)        { printf("equal\n");   }
+void if_ne(void)        { printf("not equal\n");   }
+void if_gt(void)        { printf("greater than\n");   }
+void if_le(void)        { printf("less or equal\n");   }
+void if_lt(void)        { printf("less than\n");   }
+void if_ge(void)        { printf("greater or equal\n");   }
+void if_taken(void)     { printf("taken\n");   }
+void if_not_taken(void) { printf("not taken\n");   }
+
+#undef LT
+#define NEVER 0
+#define GT 2
+#define LT 4
+#define NE 6
+#define EQ 8
+#define LE C
+#define GE A
+#define ALWAYS E
+
+
+void compare_never(uint64_t value)
+{
+   register uint64_t val asm("r7") = value;
+
+   asm volatile(
+                CLGIJ(7,NEVER,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_always(uint64_t value)
+{
+   register uint64_t val asm("r7") = value;
+
+   asm volatile(
+                CLGIJ(7,ALWAYS,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_le42(uint64_t value)
+{
+   register uint64_t val asm("r7") = value;
+
+   asm volatile(
+                CLGIJ(7,LE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_gt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_le\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ge42(uint64_t value)
+{
+   register uint64_t val asm("r7") = value;
+
+   asm volatile(
+                CLGIJ(7,GE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_lt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ge\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_gt42(uint64_t value)
+{
+   register uint64_t val asm("r7") = value;
+
+   asm volatile(
+                CLGIJ(7,GT,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_le\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_gt\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_lt42(uint64_t value)
+{
+   register uint64_t val asm("r7") = value;
+
+   asm volatile(
+                CLGIJ(7,LT,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_ge\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_lt\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_eq42(uint64_t value)
+{
+   register uint64_t val asm("r7") = value;
+
+   asm volatile(
+                CLGIJ(7,EQ,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_ne\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_eq\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ne42(uint64_t value)
+{
+   register uint64_t val asm("r7") = value;
+
+   asm volatile(
+                CLGIJ(7,NE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_eq\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ne\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+int main()
+{
+   compare_eq42(12);
+   compare_eq42(42);
+   compare_eq42(100);
+
+   compare_ne42(12);
+   compare_ne42(42);
+   compare_ne42(100);
+
+   compare_gt42(12);
+   compare_gt42(42);
+   compare_gt42(100);
+
+   compare_lt42(12);
+   compare_lt42(42);
+   compare_lt42(100);
+
+   compare_le42(12);
+   compare_le42(42);
+   compare_le42(100);
+
+   compare_ge42(12);
+   compare_ge42(42);
+   compare_ge42(100);
+
+   compare_never(12);
+   compare_never(42);
+   compare_never(100);
+
+   compare_always(12);
+   compare_always(42);
+   compare_always(100);
+
+   return 0;
+}
diff --git a/none/tests/s390x/clgij.stderr.exp b/none/tests/s390x/clgij.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/clgij.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/clgij.stdout.exp b/none/tests/s390x/clgij.stdout.exp
new file mode 100644
index 0000000..bd98295
--- /dev/null
+++ b/none/tests/s390x/clgij.stdout.exp
@@ -0,0 +1,24 @@
+not equal
+equal
+not equal
+not equal
+equal
+not equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+not taken
+not taken
+not taken
+taken
+taken
+taken
diff --git a/none/tests/s390x/clgij.vgtest b/none/tests/s390x/clgij.vgtest
new file mode 100644
index 0000000..b400a6b
--- /dev/null
+++ b/none/tests/s390x/clgij.vgtest
@@ -0,0 +1 @@
+prog: clgij
diff --git a/none/tests/s390x/clgrj.c b/none/tests/s390x/clgrj.c
new file mode 100644
index 0000000..24c7c76
--- /dev/null
+++ b/none/tests/s390x/clgrj.c
@@ -0,0 +1,175 @@
+#include <stdio.h>
+#include <stdint.h>
+#include "opcodes.h"
+
+#define BRASLCLOBBER "0","1","2","3","4","5","14", \
+		     "f0","f1","f2","f3","f4","f5","f6","f7"
+
+void if_eq(void)        { printf("equal\n");   }
+void if_ne(void)        { printf("not equal\n");   }
+void if_gt(void)        { printf("greater than\n");   }
+void if_le(void)        { printf("less or equal\n");   }
+void if_lt(void)        { printf("less than\n");   }
+void if_ge(void)        { printf("greater or equal\n");   }
+void if_taken(void)     { printf("taken\n");   }
+void if_not_taken(void) { printf("not taken\n");   }
+
+#undef LT
+#define NEVER 0
+#define GT 2
+#define LT 4
+#define NE 6
+#define EQ 8
+#define LE C
+#define GE A
+#define ALWAYS E
+
+
+void compare_never(uint64_t value1, uint64_t value2)
+{
+   register uint64_t val1 asm("r7") = value1;
+   register uint64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLGRJ(7,8,8,NEVER) "\n\t"
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_always(uint64_t value1, uint64_t value2)
+{
+   register uint64_t val1 asm("r7") = value1;
+   register uint64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLGRJ(7,8,8,ALWAYS) "\n\t"
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_le(uint64_t value1, uint64_t value2)
+{
+   register uint64_t val1 asm("r7") = value1;
+   register uint64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLGRJ(7,8,8,LE) "\n\t"
+                "brasl 14,if_gt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_le\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ge(uint64_t value1, uint64_t value2)
+{
+   register uint64_t val1 asm("r7") = value1;
+   register uint64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLGRJ(7,8,8,GE) "\n\t"
+                "brasl 14,if_lt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ge\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_gt(uint64_t value1, uint64_t value2)
+{
+   register uint64_t val1 asm("r7") = value1;
+   register uint64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLGRJ(7,8,8,GT) "\n\t"
+                "brasl 14,if_le\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_gt\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_lt(uint64_t value1, uint64_t value2)
+{
+   register uint64_t val1 asm("r7") = value1;
+   register uint64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLGRJ(7,8,8,LT) "\n\t"
+                "brasl 14,if_ge\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_lt\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_eq(uint64_t value1, uint64_t value2)
+{
+   register uint64_t val1 asm("r7") = value1;
+   register uint64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLGRJ(7,8,8,EQ) "\n\t"
+                "brasl 14,if_ne\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_eq\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ne(uint64_t value1, uint64_t value2)
+{
+   register uint64_t val1 asm("r7") = value1;
+   register uint64_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLGRJ(7,8,8,NE) "\n\t"
+                "brasl 14,if_eq\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ne\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+int main()
+{
+   compare_eq(12, 42);
+   compare_eq(42, 42);
+   compare_eq(100, 42);
+
+   compare_ne(12, 42);
+   compare_ne(42, 42);
+   compare_ne(100, 42);
+
+   compare_gt(12, 42);
+   compare_gt(42, 42);
+   compare_gt(100, 42);
+
+   compare_lt(12, 42);
+   compare_lt(42, 42);
+   compare_lt(100, 42);
+
+   compare_le(12, 42);
+   compare_le(42, 42);
+   compare_le(100, 42);
+
+   compare_ge(12, 42);
+   compare_ge(42, 42);
+   compare_ge(100, 42);
+
+   compare_never(12, 42);
+   compare_never(42, 42);
+   compare_never(100, 42);
+
+   compare_always(12, 42);
+   compare_always(42, 42);
+   compare_always(100, 42);
+
+   return 0;
+}
diff --git a/none/tests/s390x/clgrj.stderr.exp b/none/tests/s390x/clgrj.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/clgrj.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/clgrj.stdout.exp b/none/tests/s390x/clgrj.stdout.exp
new file mode 100644
index 0000000..bd98295
--- /dev/null
+++ b/none/tests/s390x/clgrj.stdout.exp
@@ -0,0 +1,24 @@
+not equal
+equal
+not equal
+not equal
+equal
+not equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+not taken
+not taken
+not taken
+taken
+taken
+taken
diff --git a/none/tests/s390x/clgrj.vgtest b/none/tests/s390x/clgrj.vgtest
new file mode 100644
index 0000000..b0dedcc
--- /dev/null
+++ b/none/tests/s390x/clgrj.vgtest
@@ -0,0 +1 @@
+prog: clgrj
diff --git a/none/tests/s390x/clij.c b/none/tests/s390x/clij.c
new file mode 100644
index 0000000..d898d6f
--- /dev/null
+++ b/none/tests/s390x/clij.c
@@ -0,0 +1,167 @@
+#include <stdio.h>
+#include <stdint.h>
+#include "opcodes.h"
+
+#define BRASLCLOBBER "0","1","2","3","4","5","14", \
+		     "f0","f1","f2","f3","f4","f5","f6","f7"
+
+void if_eq(void)        { printf("equal\n");   }
+void if_ne(void)        { printf("not equal\n");   }
+void if_gt(void)        { printf("greater than\n");   }
+void if_le(void)        { printf("less or equal\n");   }
+void if_lt(void)        { printf("less than\n");   }
+void if_ge(void)        { printf("greater or equal\n");   }
+void if_taken(void)     { printf("taken\n");   }
+void if_not_taken(void) { printf("not taken\n");   }
+
+#undef LT
+#define NEVER 0
+#define GT 2
+#define LT 4
+#define NE 6
+#define EQ 8
+#define LE C
+#define GE A
+#define ALWAYS E
+
+
+void compare_never(uint32_t value)
+{
+   register uint32_t val asm("r7") = value;
+
+   asm volatile(
+                CLIJ(7,NEVER,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_always(uint32_t value)
+{
+   register uint32_t val asm("r7") = value;
+
+   asm volatile(
+                CLIJ(7,ALWAYS,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_le42(uint32_t value)
+{
+   register uint32_t val asm("r7") = value;
+
+   asm volatile(
+                CLIJ(7,LE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_gt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_le\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ge42(uint32_t value)
+{
+   register uint32_t val asm("r7") = value;
+
+   asm volatile(
+                CLIJ(7,GE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_lt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ge\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_gt42(uint32_t value)
+{
+   register uint32_t val asm("r7") = value;
+
+   asm volatile(
+                CLIJ(7,GT,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_le\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_gt\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_lt42(uint32_t value)
+{
+   register uint32_t val asm("r7") = value;
+
+   asm volatile(
+                CLIJ(7,LT,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_ge\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_lt\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_eq42(uint32_t value)
+{
+   register uint32_t val asm("r7") = value;
+
+   asm volatile(
+                CLIJ(7,EQ,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_ne\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_eq\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ne42(uint32_t value)
+{
+   register uint32_t val asm("r7") = value;
+
+   asm volatile(
+                CLIJ(7,NE,8,2a) "\n\t"    /* 0x2a == 42 */
+                "brasl 14,if_eq\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ne\n\t"
+                "0: nopr 0\n\t" : : "d"(val) : BRASLCLOBBER);
+   return;
+}
+
+int main()
+{
+   compare_eq42(12);
+   compare_eq42(42);
+   compare_eq42(100);
+
+   compare_ne42(12);
+   compare_ne42(42);
+   compare_ne42(100);
+
+   compare_gt42(12);
+   compare_gt42(42);
+   compare_gt42(100);
+
+   compare_lt42(12);
+   compare_lt42(42);
+   compare_lt42(100);
+
+   compare_le42(12);
+   compare_le42(42);
+   compare_le42(100);
+
+   compare_ge42(12);
+   compare_ge42(42);
+   compare_ge42(100);
+
+   compare_never(12);
+   compare_never(42);
+   compare_never(100);
+
+   compare_always(12);
+   compare_always(42);
+   compare_always(100);
+
+   return 0;
+}
diff --git a/none/tests/s390x/clij.stderr.exp b/none/tests/s390x/clij.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/clij.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/clij.stdout.exp b/none/tests/s390x/clij.stdout.exp
new file mode 100644
index 0000000..bd98295
--- /dev/null
+++ b/none/tests/s390x/clij.stdout.exp
@@ -0,0 +1,24 @@
+not equal
+equal
+not equal
+not equal
+equal
+not equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+not taken
+not taken
+not taken
+taken
+taken
+taken
diff --git a/none/tests/s390x/clij.vgtest b/none/tests/s390x/clij.vgtest
new file mode 100644
index 0000000..2cc05ad
--- /dev/null
+++ b/none/tests/s390x/clij.vgtest
@@ -0,0 +1 @@
+prog: clij
diff --git a/none/tests/s390x/clrj.c b/none/tests/s390x/clrj.c
new file mode 100644
index 0000000..3c73247
--- /dev/null
+++ b/none/tests/s390x/clrj.c
@@ -0,0 +1,175 @@
+#include <stdio.h>
+#include <stdint.h>
+#include "opcodes.h"
+
+#define BRASLCLOBBER "0","1","2","3","4","5","14", \
+		     "f0","f1","f2","f3","f4","f5","f6","f7"
+
+void if_eq(void)        { printf("equal\n");   }
+void if_ne(void)        { printf("not equal\n");   }
+void if_gt(void)        { printf("greater than\n");   }
+void if_le(void)        { printf("less or equal\n");   }
+void if_lt(void)        { printf("less than\n");   }
+void if_ge(void)        { printf("greater or equal\n");   }
+void if_taken(void)     { printf("taken\n");   }
+void if_not_taken(void) { printf("not taken\n");   }
+
+#undef LT
+#define NEVER 0
+#define GT 2
+#define LT 4
+#define NE 6
+#define EQ 8
+#define LE C
+#define GE A
+#define ALWAYS E
+
+
+void compare_never(uint32_t value1, uint32_t value2)
+{
+   register uint32_t val1 asm("r7") = value1;
+   register uint32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLRJ(7,8,8,NEVER) "\n\t"
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_always(uint32_t value1, uint32_t value2)
+{
+   register uint32_t val1 asm("r7") = value1;
+   register uint32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLRJ(7,8,8,ALWAYS) "\n\t"
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_le(uint32_t value1, uint32_t value2)
+{
+   register uint32_t val1 asm("r7") = value1;
+   register uint32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLRJ(7,8,8,LE) "\n\t"
+                "brasl 14,if_gt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_le\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ge(uint32_t value1, uint32_t value2)
+{
+   register uint32_t val1 asm("r7") = value1;
+   register uint32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLRJ(7,8,8,GE) "\n\t"
+                "brasl 14,if_lt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ge\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_gt(uint32_t value1, uint32_t value2)
+{
+   register uint32_t val1 asm("r7") = value1;
+   register uint32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLRJ(7,8,8,GT) "\n\t"
+                "brasl 14,if_le\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_gt\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_lt(uint32_t value1, uint32_t value2)
+{
+   register uint32_t val1 asm("r7") = value1;
+   register uint32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLRJ(7,8,8,LT) "\n\t"
+                "brasl 14,if_ge\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_lt\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_eq(uint32_t value1, uint32_t value2)
+{
+   register uint32_t val1 asm("r7") = value1;
+   register uint32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLRJ(7,8,8,EQ) "\n\t"
+                "brasl 14,if_ne\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_eq\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ne(uint32_t value1, uint32_t value2)
+{
+   register uint32_t val1 asm("r7") = value1;
+   register uint32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CLRJ(7,8,8,NE) "\n\t"
+                "brasl 14,if_eq\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ne\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+int main()
+{
+   compare_eq(12, 42);
+   compare_eq(42, 42);
+   compare_eq(100, 42);
+
+   compare_ne(12, 42);
+   compare_ne(42, 42);
+   compare_ne(100, 42);
+
+   compare_gt(12, 42);
+   compare_gt(42, 42);
+   compare_gt(100, 42);
+
+   compare_lt(12, 42);
+   compare_lt(42, 42);
+   compare_lt(100, 42);
+
+   compare_le(12, 42);
+   compare_le(42, 42);
+   compare_le(100, 42);
+
+   compare_ge(12, 42);
+   compare_ge(42, 42);
+   compare_ge(100, 42);
+
+   compare_never(12, 42);
+   compare_never(42, 42);
+   compare_never(100, 42);
+
+   compare_always(12, 42);
+   compare_always(42, 42);
+   compare_always(100, 42);
+
+   return 0;
+}
diff --git a/none/tests/s390x/clrj.stderr.exp b/none/tests/s390x/clrj.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/clrj.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/clrj.stdout.exp b/none/tests/s390x/clrj.stdout.exp
new file mode 100644
index 0000000..bd98295
--- /dev/null
+++ b/none/tests/s390x/clrj.stdout.exp
@@ -0,0 +1,24 @@
+not equal
+equal
+not equal
+not equal
+equal
+not equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+not taken
+not taken
+not taken
+taken
+taken
+taken
diff --git a/none/tests/s390x/clrj.vgtest b/none/tests/s390x/clrj.vgtest
new file mode 100644
index 0000000..75fcf1b
--- /dev/null
+++ b/none/tests/s390x/clrj.vgtest
@@ -0,0 +1 @@
+prog: clrj
diff --git a/none/tests/s390x/crj.c b/none/tests/s390x/crj.c
new file mode 100644
index 0000000..97acc85
--- /dev/null
+++ b/none/tests/s390x/crj.c
@@ -0,0 +1,175 @@
+#include <stdio.h>
+#include <stdint.h>
+#include "opcodes.h"
+
+#define BRASLCLOBBER "0","1","2","3","4","5","14", \
+		     "f0","f1","f2","f3","f4","f5","f6","f7"
+
+void if_eq(void)        { printf("equal\n");   }
+void if_ne(void)        { printf("not equal\n");   }
+void if_gt(void)        { printf("greater than\n");   }
+void if_le(void)        { printf("less or equal\n");   }
+void if_lt(void)        { printf("less than\n");   }
+void if_ge(void)        { printf("greater or equal\n");   }
+void if_taken(void)     { printf("taken\n");   }
+void if_not_taken(void) { printf("not taken\n");   }
+
+#undef LT
+#define NEVER 0
+#define GT 2
+#define LT 4
+#define NE 6
+#define EQ 8
+#define LE C
+#define GE A
+#define ALWAYS E
+
+
+void compare_never(int32_t value1, int32_t value2)
+{
+   register int32_t val1 asm("r7") = value1;
+   register int32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CRJ(7,8,8,NEVER) "\n\t"
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_always(int32_t value1, int32_t value2)
+{
+   register int32_t val1 asm("r7") = value1;
+   register int32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CRJ(7,8,8,ALWAYS) "\n\t"
+                "brasl 14,if_not_taken\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_taken\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_le(int32_t value1, int32_t value2)
+{
+   register int32_t val1 asm("r7") = value1;
+   register int32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CRJ(7,8,8,LE) "\n\t"
+                "brasl 14,if_gt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_le\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ge(int32_t value1, int32_t value2)
+{
+   register int32_t val1 asm("r7") = value1;
+   register int32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CRJ(7,8,8,GE) "\n\t"
+                "brasl 14,if_lt\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ge\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_gt(int32_t value1, int32_t value2)
+{
+   register int32_t val1 asm("r7") = value1;
+   register int32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CRJ(7,8,8,GT) "\n\t"
+                "brasl 14,if_le\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_gt\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_lt(int32_t value1, int32_t value2)
+{
+   register int32_t val1 asm("r7") = value1;
+   register int32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CRJ(7,8,8,LT) "\n\t"
+                "brasl 14,if_ge\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_lt\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_eq(int32_t value1, int32_t value2)
+{
+   register int32_t val1 asm("r7") = value1;
+   register int32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CRJ(7,8,8,EQ) "\n\t"
+                "brasl 14,if_ne\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_eq\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+void compare_ne(int32_t value1, int32_t value2)
+{
+   register int32_t val1 asm("r7") = value1;
+   register int32_t val2 asm("r8") = value2;
+
+   asm volatile(
+                CRJ(7,8,8,NE) "\n\t"
+                "brasl 14,if_eq\n\t"
+                "j     0f\n\t"
+                "brasl 14,if_ne\n\t"
+                "0: nopr 0\n\t" : : "d"(val1), "d"(val2) : BRASLCLOBBER);
+   return;
+}
+
+int main()
+{
+   compare_eq(-12, 42);
+   compare_eq(42, 42);
+   compare_eq(100, 42);
+
+   compare_ne(-12, 42);
+   compare_ne(42, 42);
+   compare_ne(100, 42);
+
+   compare_gt(-12, 42);
+   compare_gt(42, 42);
+   compare_gt(100, 42);
+
+   compare_lt(-12, 42);
+   compare_lt(42, 42);
+   compare_lt(100, 42);
+
+   compare_le(-12, 42);
+   compare_le(42, 42);
+   compare_le(100, 42);
+
+   compare_ge(-12, 42);
+   compare_ge(42, 42);
+   compare_ge(100, 42);
+
+   compare_never(-12, 42);
+   compare_never(42, 42);
+   compare_never(100, 42);
+
+   compare_always(-12, 42);
+   compare_always(42, 42);
+   compare_always(100, 42);
+
+   return 0;
+}
diff --git a/none/tests/s390x/crj.stderr.exp b/none/tests/s390x/crj.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/crj.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/crj.stdout.exp b/none/tests/s390x/crj.stdout.exp
new file mode 100644
index 0000000..bd98295
--- /dev/null
+++ b/none/tests/s390x/crj.stdout.exp
@@ -0,0 +1,24 @@
+not equal
+equal
+not equal
+not equal
+equal
+not equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+less or equal
+less or equal
+greater than
+less than
+greater or equal
+greater or equal
+not taken
+not taken
+not taken
+taken
+taken
+taken
diff --git a/none/tests/s390x/crj.vgtest b/none/tests/s390x/crj.vgtest
new file mode 100644
index 0000000..1e1bba6
--- /dev/null
+++ b/none/tests/s390x/crj.vgtest
@@ -0,0 +1 @@
+prog: crj