diff --git a/gcc/testsuite/gcc.dg/ccmn-w-eq-1.c b/gcc/testsuite/gcc.dg/ccmn-w-eq-1.c
new file mode 100644
index 0000000..446f8d2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmn-w-eq-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 || b OP2 -20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, -25) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, -15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, -25) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, -25) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, -15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, -25) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, -15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, -25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, -25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, -15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, -15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, -25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, -15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, -25) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmn-w-eq.c b/gcc/testsuite/gcc.dg/ccmn-w-eq.c
new file mode 100644
index 0000000..65c6a84
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmn-w-eq.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 && b OP2 -20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, -25) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, -15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, -25) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, -25) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, -15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, -25) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, -20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, -15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, -25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, -25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, -15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, -15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, -25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, -15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, -20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, -25) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-eq-1.c b/gcc/testsuite/gcc.dg/ccmp-l-eq-1.c
new file mode 100644
index 0000000..a9af11c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-eq-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-eq.c b/gcc/testsuite/gcc.dg/ccmp-l-eq.c
new file mode 100644
index 0000000..21a5263
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-eq.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-ge-1.c b/gcc/testsuite/gcc.dg/ccmp-l-ge-1.c
new file mode 100644
index 0000000..ade1efb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-ge-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >=, ==)
+TEST_FUNC(2, >=, !=)
+TEST_FUNC(3, >=, <=)
+TEST_FUNC(4, >=, <)
+TEST_FUNC(5, >=, >=)
+TEST_FUNC(6, >=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-ge.c b/gcc/testsuite/gcc.dg/ccmp-l-ge.c
new file mode 100644
index 0000000..a515868
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-ge.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >=, ==)
+TEST_FUNC(2, >=, !=)
+TEST_FUNC(3, >=, <=)
+TEST_FUNC(4, >=, <)
+TEST_FUNC(5, >=, >=)
+TEST_FUNC(6, >=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >=, ==)  */
+  if (test_1 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >=, !=)  */
+  if (test_2 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >=, <=)  */
+  if (test_3 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >=, <)  */
+  if (test_4 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >=, >=)  */
+  if (test_5 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >=, >)  */
+  if (test_6 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-gt-1.c b/gcc/testsuite/gcc.dg/ccmp-l-gt-1.c
new file mode 100644
index 0000000..3d8d633
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-gt-1.c
@@ -0,0 +1,136 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >, ==)
+TEST_FUNC(2, >, !=)
+TEST_FUNC(3, >, <=)
+TEST_FUNC(4, >, <)
+TEST_FUNC(5, >, >=)
+TEST_FUNC(6, >, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+#if 0
+  /* TEST_FUNC(5, >, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+#endif
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-gt.c b/gcc/testsuite/gcc.dg/ccmp-l-gt.c
new file mode 100644
index 0000000..103e8e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-gt.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >, ==)
+TEST_FUNC(2, >, !=)
+TEST_FUNC(3, >, <=)
+TEST_FUNC(4, >, <)
+TEST_FUNC(5, >, >=)
+TEST_FUNC(6, >, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >, ==)  */
+  if (test_1 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >, !=)  */
+  if (test_2 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >, <=)  */
+  if (test_3 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >, <)  */
+  if (test_4 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >, >=)  */
+  if (test_5 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >, >)  */
+  if (test_6 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-le-1.c b/gcc/testsuite/gcc.dg/ccmp-l-le-1.c
new file mode 100644
index 0000000..738c424
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-le-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <=, ==)
+TEST_FUNC(2, <=, !=)
+TEST_FUNC(3, <=, <=)
+TEST_FUNC(4, <=, <)
+TEST_FUNC(5, <=, >=)
+TEST_FUNC(6, <=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-le.c b/gcc/testsuite/gcc.dg/ccmp-l-le.c
new file mode 100644
index 0000000..3ef2e3f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-le.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <=, ==)
+TEST_FUNC(2, <=, !=)
+TEST_FUNC(3, <=, <=)
+TEST_FUNC(4, <=, <)
+TEST_FUNC(5, <=, >=)
+TEST_FUNC(6, <=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-lt-1.c b/gcc/testsuite/gcc.dg/ccmp-l-lt-1.c
new file mode 100644
index 0000000..918eaaf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-lt-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <, ==)
+TEST_FUNC(2, <, !=)
+TEST_FUNC(3, <, <=)
+TEST_FUNC(4, <, <)
+TEST_FUNC(5, <, >=)
+TEST_FUNC(6, <, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-lt.c b/gcc/testsuite/gcc.dg/ccmp-l-lt.c
new file mode 100644
index 0000000..de2560c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-lt.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <, ==)
+TEST_FUNC(2, <, !=)
+TEST_FUNC(3, <, <=)
+TEST_FUNC(4, <, <)
+TEST_FUNC(5, <, >=)
+TEST_FUNC(6, <, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-ne-1.c b/gcc/testsuite/gcc.dg/ccmp-l-ne-1.c
new file mode 100644
index 0000000..6ec09ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-ne-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, !=, ==)
+TEST_FUNC(2, !=, !=)
+TEST_FUNC(3, !=, <=)
+TEST_FUNC(4, !=, <)
+TEST_FUNC(5, !=, >=)
+TEST_FUNC(6, !=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, !=, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, !=, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, !=, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, !=, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, !=, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, !=, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-l-ne.c b/gcc/testsuite/gcc.dg/ccmp-l-ne.c
new file mode 100644
index 0000000..03d0cfe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-l-ne.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (long a, long b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, !=, ==)
+TEST_FUNC(2, !=, !=)
+TEST_FUNC(3, !=, <=)
+TEST_FUNC(4, !=, <)
+TEST_FUNC(5, !=, >=)
+TEST_FUNC(6, !=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, !=, ==)  */
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, !=, !=)  */
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, !=, <=)  */
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, !=, <)  */
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, !=, >=)  */
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, !=, >)  */
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-eq-1.c b/gcc/testsuite/gcc.dg/ccmp-s-eq-1.c
new file mode 100644
index 0000000..d323d0e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-eq-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-eq.c b/gcc/testsuite/gcc.dg/ccmp-s-eq.c
new file mode 100644
index 0000000..0452823
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-eq.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-ge-1.c b/gcc/testsuite/gcc.dg/ccmp-s-ge-1.c
new file mode 100644
index 0000000..93b1c90
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-ge-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >=, ==)
+TEST_FUNC(2, >=, !=)
+TEST_FUNC(3, >=, <=)
+TEST_FUNC(4, >=, <)
+TEST_FUNC(5, >=, >=)
+TEST_FUNC(6, >=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-ge.c b/gcc/testsuite/gcc.dg/ccmp-s-ge.c
new file mode 100644
index 0000000..f8125f5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-ge.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >=, ==)
+TEST_FUNC(2, >=, !=)
+TEST_FUNC(3, >=, <=)
+TEST_FUNC(4, >=, <)
+TEST_FUNC(5, >=, >=)
+TEST_FUNC(6, >=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >=, ==)  */
+  if (test_1 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >=, !=)  */
+  if (test_2 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >=, <=)  */
+  if (test_3 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >=, <)  */
+  if (test_4 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >=, >=)  */
+  if (test_5 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >=, >)  */
+  if (test_6 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-gt-1.c b/gcc/testsuite/gcc.dg/ccmp-s-gt-1.c
new file mode 100644
index 0000000..c1c01c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-gt-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >, ==)
+TEST_FUNC(2, >, !=)
+TEST_FUNC(3, >, <=)
+TEST_FUNC(4, >, <)
+TEST_FUNC(5, >, >=)
+TEST_FUNC(6, >, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-gt.c b/gcc/testsuite/gcc.dg/ccmp-s-gt.c
new file mode 100644
index 0000000..84276e7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-gt.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >, ==)
+TEST_FUNC(2, >, !=)
+TEST_FUNC(3, >, <=)
+TEST_FUNC(4, >, <)
+TEST_FUNC(5, >, >=)
+TEST_FUNC(6, >, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >, ==)  */
+  if (test_1 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >, !=)  */
+  if (test_2 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >, <=)  */
+  if (test_3 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >, <)  */
+  if (test_4 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >, >=)  */
+  if (test_5 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >, >)  */
+  if (test_6 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-le-1.c b/gcc/testsuite/gcc.dg/ccmp-s-le-1.c
new file mode 100644
index 0000000..202025f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-le-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <=, ==)
+TEST_FUNC(2, <=, !=)
+TEST_FUNC(3, <=, <=)
+TEST_FUNC(4, <=, <)
+TEST_FUNC(5, <=, >=)
+TEST_FUNC(6, <=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-le.c b/gcc/testsuite/gcc.dg/ccmp-s-le.c
new file mode 100644
index 0000000..0f4704b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-le.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <=, ==)
+TEST_FUNC(2, <=, !=)
+TEST_FUNC(3, <=, <=)
+TEST_FUNC(4, <=, <)
+TEST_FUNC(5, <=, >=)
+TEST_FUNC(6, <=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-lt-1.c b/gcc/testsuite/gcc.dg/ccmp-s-lt-1.c
new file mode 100644
index 0000000..daa2657
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-lt-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <, ==)
+TEST_FUNC(2, <, !=)
+TEST_FUNC(3, <, <=)
+TEST_FUNC(4, <, <)
+TEST_FUNC(5, <, >=)
+TEST_FUNC(6, <, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-lt.c b/gcc/testsuite/gcc.dg/ccmp-s-lt.c
new file mode 100644
index 0000000..52ba455
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-lt.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <, ==)
+TEST_FUNC(2, <, !=)
+TEST_FUNC(3, <, <=)
+TEST_FUNC(4, <, <)
+TEST_FUNC(5, <, >=)
+TEST_FUNC(6, <, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-ne-1.c b/gcc/testsuite/gcc.dg/ccmp-s-ne-1.c
new file mode 100644
index 0000000..a14d641
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-ne-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, !=, ==)
+TEST_FUNC(2, !=, !=)
+TEST_FUNC(3, !=, <=)
+TEST_FUNC(4, !=, <)
+TEST_FUNC(5, !=, >=)
+TEST_FUNC(6, !=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, !=, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, !=, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, !=, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, !=, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, !=, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, !=, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-s-ne.c b/gcc/testsuite/gcc.dg/ccmp-s-ne.c
new file mode 100644
index 0000000..271b26d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-s-ne.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (short a, short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, !=, ==)
+TEST_FUNC(2, !=, !=)
+TEST_FUNC(3, !=, <=)
+TEST_FUNC(4, !=, <)
+TEST_FUNC(5, !=, >=)
+TEST_FUNC(6, !=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, !=, ==)  */
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, !=, !=)  */
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, !=, <=)  */
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, !=, <)  */
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, !=, >=)  */
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, !=, >)  */
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-eq-1.c b/gcc/testsuite/gcc.dg/ccmp-us-eq-1.c
new file mode 100644
index 0000000..eeeff6b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-eq-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-eq.c b/gcc/testsuite/gcc.dg/ccmp-us-eq.c
new file mode 100644
index 0000000..92a59df
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-eq.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-ge-1.c b/gcc/testsuite/gcc.dg/ccmp-us-ge-1.c
new file mode 100644
index 0000000..e258619
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-ge-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >=, ==)
+TEST_FUNC(2, >=, !=)
+TEST_FUNC(3, >=, <=)
+TEST_FUNC(4, >=, <)
+TEST_FUNC(5, >=, >=)
+TEST_FUNC(6, >=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-ge.c b/gcc/testsuite/gcc.dg/ccmp-us-ge.c
new file mode 100644
index 0000000..dcdfe91
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-ge.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >=, ==)
+TEST_FUNC(2, >=, !=)
+TEST_FUNC(3, >=, <=)
+TEST_FUNC(4, >=, <)
+TEST_FUNC(5, >=, >=)
+TEST_FUNC(6, >=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >=, ==)  */
+  if (test_1 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >=, !=)  */
+  if (test_2 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >=, <=)  */
+  if (test_3 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >=, <)  */
+  if (test_4 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >=, >=)  */
+  if (test_5 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >=, >)  */
+  if (test_6 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-gt-1.c b/gcc/testsuite/gcc.dg/ccmp-us-gt-1.c
new file mode 100644
index 0000000..b4f650b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-gt-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >, ==)
+TEST_FUNC(2, >, !=)
+TEST_FUNC(3, >, <=)
+TEST_FUNC(4, >, <)
+TEST_FUNC(5, >, >=)
+TEST_FUNC(6, >, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-gt.c b/gcc/testsuite/gcc.dg/ccmp-us-gt.c
new file mode 100644
index 0000000..18ba64a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-gt.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >, ==)
+TEST_FUNC(2, >, !=)
+TEST_FUNC(3, >, <=)
+TEST_FUNC(4, >, <)
+TEST_FUNC(5, >, >=)
+TEST_FUNC(6, >, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >, ==)  */
+  if (test_1 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >, !=)  */
+  if (test_2 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >, <=)  */
+  if (test_3 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >, <)  */
+  if (test_4 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >, >=)  */
+  if (test_5 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >, >)  */
+  if (test_6 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-le-1.c b/gcc/testsuite/gcc.dg/ccmp-us-le-1.c
new file mode 100644
index 0000000..fa8b773
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-le-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <=, ==)
+TEST_FUNC(2, <=, !=)
+TEST_FUNC(3, <=, <=)
+TEST_FUNC(4, <=, <)
+TEST_FUNC(5, <=, >=)
+TEST_FUNC(6, <=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-le.c b/gcc/testsuite/gcc.dg/ccmp-us-le.c
new file mode 100644
index 0000000..0c03f39
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-le.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <=, ==)
+TEST_FUNC(2, <=, !=)
+TEST_FUNC(3, <=, <=)
+TEST_FUNC(4, <=, <)
+TEST_FUNC(5, <=, >=)
+TEST_FUNC(6, <=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-lt-1.c b/gcc/testsuite/gcc.dg/ccmp-us-lt-1.c
new file mode 100644
index 0000000..10ddb5e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-lt-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <, ==)
+TEST_FUNC(2, <, !=)
+TEST_FUNC(3, <, <=)
+TEST_FUNC(4, <, <)
+TEST_FUNC(5, <, >=)
+TEST_FUNC(6, <, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-lt.c b/gcc/testsuite/gcc.dg/ccmp-us-lt.c
new file mode 100644
index 0000000..4ef6b27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-lt.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <, ==)
+TEST_FUNC(2, <, !=)
+TEST_FUNC(3, <, <=)
+TEST_FUNC(4, <, <)
+TEST_FUNC(5, <, >=)
+TEST_FUNC(6, <, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-ne-1.c b/gcc/testsuite/gcc.dg/ccmp-us-ne-1.c
new file mode 100644
index 0000000..ff0c795
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-ne-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, !=, ==)
+TEST_FUNC(2, !=, !=)
+TEST_FUNC(3, !=, <=)
+TEST_FUNC(4, !=, <)
+TEST_FUNC(5, !=, >=)
+TEST_FUNC(6, !=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, !=, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, !=, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, !=, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, !=, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, !=, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, !=, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-us-ne.c b/gcc/testsuite/gcc.dg/ccmp-us-ne.c
new file mode 100644
index 0000000..72c6429
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-us-ne.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned short a, unsigned short b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, !=, ==)
+TEST_FUNC(2, !=, !=)
+TEST_FUNC(3, !=, <=)
+TEST_FUNC(4, !=, <)
+TEST_FUNC(5, !=, >=)
+TEST_FUNC(6, !=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, !=, ==)  */
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, !=, !=)  */
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, !=, <=)  */
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, !=, <)  */
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, !=, >=)  */
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, !=, >)  */
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-eq-1.c b/gcc/testsuite/gcc.dg/ccmp-uw-eq-1.c
new file mode 100644
index 0000000..dd7aaa3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-eq-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-eq.c b/gcc/testsuite/gcc.dg/ccmp-uw-eq.c
new file mode 100644
index 0000000..649aafc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-eq.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-ge-1.c b/gcc/testsuite/gcc.dg/ccmp-uw-ge-1.c
new file mode 100644
index 0000000..fb1da5b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-ge-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >=, ==)
+TEST_FUNC(2, >=, !=)
+TEST_FUNC(3, >=, <=)
+TEST_FUNC(4, >=, <)
+TEST_FUNC(5, >=, >=)
+TEST_FUNC(6, >=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-ge.c b/gcc/testsuite/gcc.dg/ccmp-uw-ge.c
new file mode 100644
index 0000000..f68fe66
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-ge.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >=, ==)
+TEST_FUNC(2, >=, !=)
+TEST_FUNC(3, >=, <=)
+TEST_FUNC(4, >=, <)
+TEST_FUNC(5, >=, >=)
+TEST_FUNC(6, >=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >=, ==)  */
+  if (test_1 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >=, !=)  */
+  if (test_2 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >=, <=)  */
+  if (test_3 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >=, <)  */
+  if (test_4 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >=, >=)  */
+  if (test_5 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >=, >)  */
+  if (test_6 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-gt-1.c b/gcc/testsuite/gcc.dg/ccmp-uw-gt-1.c
new file mode 100644
index 0000000..ea66e69
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-gt-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >, ==)
+TEST_FUNC(2, >, !=)
+TEST_FUNC(3, >, <=)
+TEST_FUNC(4, >, <)
+TEST_FUNC(5, >, >=)
+TEST_FUNC(6, >, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-gt.c b/gcc/testsuite/gcc.dg/ccmp-uw-gt.c
new file mode 100644
index 0000000..c205219
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-gt.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >, ==)
+TEST_FUNC(2, >, !=)
+TEST_FUNC(3, >, <=)
+TEST_FUNC(4, >, <)
+TEST_FUNC(5, >, >=)
+TEST_FUNC(6, >, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >, ==)  */
+  if (test_1 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >, !=)  */
+  if (test_2 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >, <=)  */
+  if (test_3 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >, <)  */
+  if (test_4 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >, >=)  */
+  if (test_5 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >, >)  */
+  if (test_6 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-le-1.c b/gcc/testsuite/gcc.dg/ccmp-uw-le-1.c
new file mode 100644
index 0000000..6a64881
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-le-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <=, ==)
+TEST_FUNC(2, <=, !=)
+TEST_FUNC(3, <=, <=)
+TEST_FUNC(4, <=, <)
+TEST_FUNC(5, <=, >=)
+TEST_FUNC(6, <=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-le.c b/gcc/testsuite/gcc.dg/ccmp-uw-le.c
new file mode 100644
index 0000000..244b604
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-le.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <=, ==)
+TEST_FUNC(2, <=, !=)
+TEST_FUNC(3, <=, <=)
+TEST_FUNC(4, <=, <)
+TEST_FUNC(5, <=, >=)
+TEST_FUNC(6, <=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-lt-1.c b/gcc/testsuite/gcc.dg/ccmp-uw-lt-1.c
new file mode 100644
index 0000000..dcaa633
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-lt-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <, ==)
+TEST_FUNC(2, <, !=)
+TEST_FUNC(3, <, <=)
+TEST_FUNC(4, <, <)
+TEST_FUNC(5, <, >=)
+TEST_FUNC(6, <, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-lt.c b/gcc/testsuite/gcc.dg/ccmp-uw-lt.c
new file mode 100644
index 0000000..4daf4d2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-lt.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <, ==)
+TEST_FUNC(2, <, !=)
+TEST_FUNC(3, <, <=)
+TEST_FUNC(4, <, <)
+TEST_FUNC(5, <, >=)
+TEST_FUNC(6, <, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-ne-1.c b/gcc/testsuite/gcc.dg/ccmp-uw-ne-1.c
new file mode 100644
index 0000000..9d9bf55
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-ne-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, !=, ==)
+TEST_FUNC(2, !=, !=)
+TEST_FUNC(3, !=, <=)
+TEST_FUNC(4, !=, <)
+TEST_FUNC(5, !=, >=)
+TEST_FUNC(6, !=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, !=, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, !=, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, !=, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, !=, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, !=, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, !=, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-uw-ne.c b/gcc/testsuite/gcc.dg/ccmp-uw-ne.c
new file mode 100644
index 0000000..ca82292
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-uw-ne.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (unsigned a, unsigned b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, !=, ==)
+TEST_FUNC(2, !=, !=)
+TEST_FUNC(3, !=, <=)
+TEST_FUNC(4, !=, <)
+TEST_FUNC(5, !=, >=)
+TEST_FUNC(6, !=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, !=, ==)  */
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, !=, !=)  */
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, !=, <=)  */
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, !=, <)  */
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, !=, >=)  */
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, !=, >)  */
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-eq-1.c b/gcc/testsuite/gcc.dg/ccmp-w-eq-1.c
new file mode 100644
index 0000000..7463c3a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-eq-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-eq.c b/gcc/testsuite/gcc.dg/ccmp-w-eq.c
new file mode 100644
index 0000000..7bf39fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-eq.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, ==, ==)
+TEST_FUNC(2, ==, !=)
+TEST_FUNC(3, ==, <=)
+TEST_FUNC(4, ==, <)
+TEST_FUNC(5, ==, >=)
+TEST_FUNC(6, ==, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, ==, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, ==, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, ==, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, ==, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, ==, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, ==, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-ge-1.c b/gcc/testsuite/gcc.dg/ccmp-w-ge-1.c
new file mode 100644
index 0000000..e28b8bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-ge-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >=, ==)
+TEST_FUNC(2, >=, !=)
+TEST_FUNC(3, >=, <=)
+TEST_FUNC(4, >=, <)
+TEST_FUNC(5, >=, >=)
+TEST_FUNC(6, >=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-ge.c b/gcc/testsuite/gcc.dg/ccmp-w-ge.c
new file mode 100644
index 0000000..a11b18b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-ge.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >=, ==)
+TEST_FUNC(2, >=, !=)
+TEST_FUNC(3, >=, <=)
+TEST_FUNC(4, >=, <)
+TEST_FUNC(5, >=, >=)
+TEST_FUNC(6, >=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >=, ==)  */
+  if (test_1 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >=, !=)  */
+  if (test_2 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >=, <=)  */
+  if (test_3 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >=, <)  */
+  if (test_4 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >=, >=)  */
+  if (test_5 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >=, >)  */
+  if (test_6 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-gt-1.c b/gcc/testsuite/gcc.dg/ccmp-w-gt-1.c
new file mode 100644
index 0000000..ef88fcf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-gt-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >, ==)
+TEST_FUNC(2, >, !=)
+TEST_FUNC(3, >, <=)
+TEST_FUNC(4, >, <)
+TEST_FUNC(5, >, >=)
+TEST_FUNC(6, >, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-gt.c b/gcc/testsuite/gcc.dg/ccmp-w-gt.c
new file mode 100644
index 0000000..56480d1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-gt.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, >, ==)
+TEST_FUNC(2, >, !=)
+TEST_FUNC(3, >, <=)
+TEST_FUNC(4, >, <)
+TEST_FUNC(5, >, >=)
+TEST_FUNC(6, >, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, >, ==)  */
+  if (test_1 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, >, !=)  */
+  if (test_2 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, >, <=)  */
+  if (test_3 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, >, <)  */
+  if (test_4 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, >, >=)  */
+  if (test_5 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, >, >)  */
+  if (test_6 (5, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-le-1.c b/gcc/testsuite/gcc.dg/ccmp-w-le-1.c
new file mode 100644
index 0000000..415cc92
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-le-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <=, ==)
+TEST_FUNC(2, <=, !=)
+TEST_FUNC(3, <=, <=)
+TEST_FUNC(4, <=, <)
+TEST_FUNC(5, <=, >=)
+TEST_FUNC(6, <=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-le.c b/gcc/testsuite/gcc.dg/ccmp-w-le.c
new file mode 100644
index 0000000..f8d60d2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-le.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <=, ==)
+TEST_FUNC(2, <=, !=)
+TEST_FUNC(3, <=, <=)
+TEST_FUNC(4, <=, <)
+TEST_FUNC(5, <=, >=)
+TEST_FUNC(6, <=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <=, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <=, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <=, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <=, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <=, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <=, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-lt-1.c b/gcc/testsuite/gcc.dg/ccmp-w-lt-1.c
new file mode 100644
index 0000000..843d8ca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-lt-1.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <, ==)
+TEST_FUNC(2, <, !=)
+TEST_FUNC(3, <, <=)
+TEST_FUNC(4, <, <)
+TEST_FUNC(5, <, >=)
+TEST_FUNC(6, <, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-lt.c b/gcc/testsuite/gcc.dg/ccmp-w-lt.c
new file mode 100644
index 0000000..2059001
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-lt.c
@@ -0,0 +1,134 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, <, ==)
+TEST_FUNC(2, <, !=)
+TEST_FUNC(3, <, <=)
+TEST_FUNC(4, <, <)
+TEST_FUNC(5, <, >=)
+TEST_FUNC(6, <, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, <, ==)  */
+  if (test_1 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, <, !=)  */
+  if (test_2 (5, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, <, <=)  */
+  if (test_3 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, <, <)  */
+  if (test_4 (5, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, <, >=)  */
+  if (test_5 (5, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, <, >)  */
+  if (test_6 (5, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (5, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-ne-1.c b/gcc/testsuite/gcc.dg/ccmp-w-ne-1.c
new file mode 100644
index 0000000..9918946
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-ne-1.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 || b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, !=, ==)
+TEST_FUNC(2, !=, !=)
+TEST_FUNC(3, !=, <=)
+TEST_FUNC(4, !=, <)
+TEST_FUNC(5, !=, >=)
+TEST_FUNC(6, !=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, !=, ==)  */
+  if (test_1 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, !=, !=)  */
+  if (test_2 (10, 30) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, !=, <=)  */
+  if (test_3 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, !=, <)  */
+  if (test_4 (10, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, !=, >=)  */
+  if (test_5 (10, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, !=, >)  */
+  if (test_6 (10, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != T_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ccmp-w-ne.c b/gcc/testsuite/gcc.dg/ccmp-w-ne.c
new file mode 100644
index 0000000..7ab5dd1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ccmp-w-ne.c
@@ -0,0 +1,102 @@
+//* { dg-do run } */
+/* { dg-options "-O2 -fno-inline" } */
+#define T_VAL   8
+#define F_VAL  16
+
+#define TEST_FUNC(i, OP1, OP2)   \
+int test_##i (int a, int b)      \
+{                                \
+  if (a OP1 10 && b OP2 20)      \
+    return T_VAL;             \
+  else                           \
+    return F_VAL;            \
+}
+
+TEST_FUNC(1, !=, ==)
+TEST_FUNC(2, !=, !=)
+TEST_FUNC(3, !=, <=)
+TEST_FUNC(4, !=, <)
+TEST_FUNC(5, !=, >=)
+TEST_FUNC(6, !=, >)
+
+
+int main ()
+{
+  /* TEST_FUNC(1, !=, ==)  */
+  if (test_1 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_1 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(2, !=, !=)  */
+  if (test_2 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_2 (20, 30) != T_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(3, !=, <=)  */
+  if (test_3 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_3 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(4, !=, <)  */
+  if (test_4 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 30) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 15) != T_VAL)
+    __builtin_abort ();
+  if (test_4 (20, 30) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(5, !=, >=)  */
+  if (test_5 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 20) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_5 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  /* TEST_FUNC(6, !=, >)  */
+  if (test_6 (10, 25) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (10, 15) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 25) != T_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 20) != F_VAL)
+    __builtin_abort ();
+  if (test_6 (20, 15) != F_VAL)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/ccmn-assember.c b/gcc/testsuite/gcc.target/aarch64/ccmn-assember.c
new file mode 100644
index 0000000..304b1ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/ccmn-assember.c
@@ -0,0 +1,84 @@
+/* { dg-do compile } */
+/* { dg-options " -O2 " } */
+
+char foo_c (char a, signed char b)
+{
+  if (a > 9 && b > -20)
+    return 4;
+  else
+    return 26;
+}
+
+char foo_c_1 (char a, signed char b, char c)
+{
+  if (a > c && b == -20)
+    return 4;
+  else
+    return 26;
+}
+
+unsigned short foo_us (unsigned short a, short b)
+{
+  if (a > 9 && b < -20)
+    return 4;
+  else
+    return 26;
+}
+
+unsigned short foo_us_1 (unsigned short a, short b, unsigned short c)
+{
+  if (a > c && b == -20)
+    return 4;
+  else
+    return 26;
+}
+
+int foo_w (int a, int b)
+{
+  if (a > 9 && b < -20)
+    return 4;
+  else
+    return 26;
+}
+
+int foo_w_1 (int a, int b, int c)
+{
+  if (a > c && b == -20)
+    return 4;
+  else
+    return 26;
+}
+
+unsigned foo_uw (unsigned a, int b)
+{
+  if (a > 9 && b < -20)
+    return 4;
+  else
+    return 26;
+}
+
+unsigned foo_uw_1 (unsigned a, int b, unsigned c)
+{
+  if (a > c && b == -20)
+    return 4;
+  else
+    return 26;
+}
+
+long foo_l (long a, long b)
+{
+  if (a > 9 && b < -20)
+    return 4;
+  else
+    return 26;
+}
+
+long foo_l_1 (long a, long b, long c)
+{
+  if (a > c && b == -20)
+    return 4;
+  else
+    return 26;
+}
+
+/* { dg-final { scan-assembler-times "ccmn" 11 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/ccmp-assember.c b/gcc/testsuite/gcc.target/aarch64/ccmp-assember.c
new file mode 100644
index 0000000..98dd281
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/ccmp-assember.c
@@ -0,0 +1,124 @@
+/* { dg-do compile } */
+/* { dg-options " -O2 " } */
+
+char foo_c (char a, char b)
+{
+  if (a > 9 && b < 20)
+    return 4;
+  else
+    return 26;
+}
+
+char foo_c_1 (char a, char b, char c)
+{
+  if (a > c && b == 20)
+    return 4;
+  else
+    return 26;
+}
+
+char foo_c_2 (char a, char b, char c)
+{
+  if (a < 9 && b > c)
+    return 4;
+  else
+    return 26;
+}
+
+unsigned short foo_us (unsigned short a, unsigned short b)
+{
+  if (a > 9 && b < 20)
+    return 4;
+  else
+    return 26;
+}
+
+unsigned short foo_us_1 (unsigned short a, unsigned short b, unsigned short c)
+{
+  if (a > c && b == 20)
+    return 4;
+  else
+    return 26;
+}
+
+unsigned short foo_us_2 (unsigned short a, unsigned short b, unsigned short c)
+{
+  if (a < 9 && b > c)
+    return 4;
+  else
+    return 26;
+}
+
+int foo_w (int a, int b)
+{
+  if (a > 9 && b < 20)
+    return 4;
+  else
+    return 26;
+}
+
+int foo_w_1 (int a, int b, int c)
+{
+  if (a > c && b == 20)
+    return 4;
+  else
+    return 26;
+}
+
+int foo_w_2 (int a, int b, int c)
+{
+  if (a < 9 && b > c)
+    return 4;
+  else
+    return 26;
+}
+
+unsigned foo_uw (unsigned a, unsigned b)
+{
+  if (a > 9 && b < 20)
+    return 4;
+  else
+    return 26;
+}
+
+unsigned foo_uw_1 (unsigned a, unsigned b, unsigned c)
+{
+  if (a > c && b == 20)
+    return 4;
+  else
+    return 26;
+}
+
+unsigned foo_uw_2 (unsigned a, unsigned b, unsigned c)
+{
+  if (a < 9 && b > c)
+    return 4;
+  else
+    return 26;
+}
+
+long foo_l (long a, long b)
+{
+  if (a > 9 && b < 20)
+    return 4;
+  else
+    return 26;
+}
+
+long foo_l_1 (long a, long b, long c)
+{
+  if (a > c && b == 20)
+    return 4;
+  else
+    return 26;
+}
+
+long foo_l_2 (long a, long b, long c)
+{
+  if (a < 9 && b > c)
+    return 4;
+  else
+    return 26;
+}
+
+/* { dg-final { scan-assembler-times "ccmp" 16 } } */
