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] S/390: Define TARGET_SHIFT_TRUNCATION_MASK


Hi,

the attached patch defines the TARGET_SHIFT_TRUNCATION_MASK macro for S/390.
The shift operations on S/390 only use the 6 least significant bits from a
shift count operand on 31 and 64bit.

Bootstrapped and regtested on s390 and s390x.

OK?

Bye,

-Andreas-


2005-03-03  Andreas Krebbel  <krebbel1@de.ibm.com>

	* config/s390/s390.c (TARGET_SHIFT_TRUNCATION_MASK): Target macro 
	defined.
	(s390_shift_truncation_mask): New function.


Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.216
diff -p -c -r1.216 s390.c
*** gcc/config/s390/s390.c	23 Jan 2005 15:05:47 -0000	1.216
--- gcc/config/s390/s390.c	28 Jan 2005 14:50:03 -0000
*************** static bool s390_pass_by_reference (CUMU
*** 84,89 ****
--- 84,90 ----
  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);
+ static unsigned HOST_WIDE_INT  s390_shift_truncation_mask (enum machine_mode);
  
  
  /* Define the specific costs for a given cpu.  */
*************** struct processor_costs z990_cost = 
*** 267,272 ****
--- 268,276 ----
  #undef TARGET_CC_MODES_COMPATIBLE
  #define TARGET_CC_MODES_COMPATIBLE s390_cc_modes_compatible
  
+ #undef TARGET_SHIFT_TRUNCATION_MASK
+ #define TARGET_SHIFT_TRUNCATION_MASK s390_shift_truncation_mask
+ 
  struct gcc_target targetm = TARGET_INITIALIZER;
  
  extern int reload_completed;
*************** s390_cc_modes_compatible (enum machine_m
*** 8629,8634 ****
--- 8633,8647 ----
    return VOIDmode;
  }
  
+ /* This function describes how the standard shift patterns for mode deal 
+    with shifts by negative amounts or by more than the width of the MODE.
+    On S/390 all shift instructions truncate to 6 bits.  */
+ static unsigned HOST_WIDE_INT
+ s390_shift_truncation_mask (enum machine_mode mode ATTRIBUTE_UNUSED)
+ {
+   return 63;
+ }
+ 
  /* 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]