This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] s390: implement cc_modes_compatible function


Hi,

the attached patch implements the cc_modes_compatible function for
the s390 back end.

Bootstrapped without regressions on s390 and s390x.

OK?

Bye,

-Andreas-


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.


Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.201
diff -p -c -r1.201 s390.c
*** gcc/config/s390/s390.c	9 Nov 2004 20:46:13 -0000	1.201
--- gcc/config/s390/s390.c	16 Nov 2004 15:01:10 -0000
*************** static bool s390_call_saved_register_use
*** 82,87 ****
--- 82,90 ----
  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"
*************** static bool s390_fixed_condition_code_re
*** 160,165 ****
--- 163,171 ----
  #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;
*************** s390_fixed_condition_code_regs (unsigned
*** 8338,8343 ****
--- 8344,8383 ----
    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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]