s390.c (s390_cc_modes_compatible): New function.
authorAndreas Krebbel <krebbel1@de.ibm.com>
Tue, 16 Nov 2004 17:37:31 +0000 (17:37 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Tue, 16 Nov 2004 17:37:31 +0000 (17:37 +0000)
2004-11-16  Andreas Krebbel  <krebbel1@de.ibm.com>

* config/s390/s390.c (s390_cc_modes_compatible): New function.
(TARGET_CC_MODES_COMPATIBLE): Target macro defined.

From-SVN: r90745

gcc/ChangeLog
gcc/config/s390/s390.c

index 521c31b09e6c23ba599f21e61a5ea732b17c158a..7ec570dea48365f0998911382a3ec202d1d929e1 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-16  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * config/s390/s390.c (s390_cc_modes_compatible): New function.
+       (TARGET_CC_MODES_COMPATIBLE): Target macro defined.
+
 2004-11-16  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        PR target/18447
index a6f0d64dc7bb53df47b8eb954e84165b2d2fb408..91ee90d282d0ee14ea737e63fa42686ec505d5ae 100644 (file)
@@ -82,6 +82,9 @@ static bool s390_call_saved_register_used (tree);
 static bool s390_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode mode,
                                    tree, bool);
 static bool s390_fixed_condition_code_regs (unsigned int *, unsigned int *);
+static enum machine_mode s390_cc_modes_compatible (enum machine_mode,
+                                                  enum machine_mode);
+
 
 #undef  TARGET_ASM_ALIGNED_HI_OP
 #define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
@@ -160,6 +163,9 @@ static bool s390_fixed_condition_code_regs (unsigned int *, unsigned int *);
 #undef TARGET_FIXED_CONDITION_CODE_REGS
 #define TARGET_FIXED_CONDITION_CODE_REGS s390_fixed_condition_code_regs
 
+#undef TARGET_CC_MODES_COMPATIBLE
+#define TARGET_CC_MODES_COMPATIBLE s390_cc_modes_compatible
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 extern int reload_completed;
@@ -8338,6 +8344,40 @@ s390_fixed_condition_code_regs (unsigned int *p1, unsigned int *p2)
   return true;
 }
 
+/* If two condition code modes are compatible, return a condition code
+   mode which is compatible with both.  Otherwise, return
+   VOIDmode.  */
+
+static enum machine_mode
+s390_cc_modes_compatible (enum machine_mode m1, enum machine_mode m2)
+{
+  if (m1 == m2)
+    return m1;
+
+  switch (m1)
+    {
+    case CCZmode:
+      if (m2 == CCUmode || m2 == CCTmode
+         || m2 == CCSmode || m2 == CCSRmode || m2 == CCURmode)
+        return m2;
+      return VOIDmode;
+
+    case CCSmode:
+    case CCUmode:
+    case CCTmode:
+    case CCSRmode:
+    case CCURmode:
+      if (m2 == CCZmode)
+       return m1;
+      
+      return VOIDmode;
+
+    default:
+      return VOIDmode;
+    }
+  return VOIDmode;
+}
+
 /* This function is used by the call expanders of the machine description.
    It emits the call insn itself together with the necessary operations
    to adjust the target address and returns the emitted insn.