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]

Fix problem with constant modulus


I checked in the following, which fixes the problem I reported a couple
of days ago.  OP1 is mostly used in WIDER_MODE, so should be valid for that
mode and then made valid for MODE in the few cases where it's used there.

Tested on x86_64-linux.

I have a C testcase for this, but it was motivated by the ACATS test C450001,
so there's no point in adding the C tested.

2004-04-19  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* expmed.c (expand_mult_highpart_adjust): Make OP1 valid for MODE.
	(expand_mult_highpart_optab): Likewise.
	(expand_mult_highpart): Make OP1 valid for WIDER_MODE, not MODE.

*** expmed.c	1 Apr 2004 03:50:28 -0000	1.155
--- expmed.c	19 Apr 2004 11:52:25 -0000
*************** expand_mult_highpart_adjust (enum machin
*** 2842,2845 ****
--- 2842,2846 ----
    enum rtx_code adj_code = unsignedp ? PLUS : MINUS;
  
+   op1 = gen_int_mode (INTVAL (op1), mode);
    tem = expand_shift (RSHIFT_EXPR, mode, op0,
  		      build_int_2 (GET_MODE_BITSIZE (mode) - 1, 0),
*************** expand_mult_highpart_optab (enum machine
*** 2896,2900 ****
      {
        moptab = unsignedp ? umul_highpart_optab : smul_highpart_optab;
!       tem = expand_binop (mode, moptab, op0, op1, target,
  			  unsignedp, OPTAB_DIRECT);
        if (tem)
--- 2897,2902 ----
      {
        moptab = unsignedp ? umul_highpart_optab : smul_highpart_optab;
!       tem = expand_binop (mode, moptab, op0,
! 			  gen_int_mode (INTVAL (op1), mode), target,
  			  unsignedp, OPTAB_DIRECT);
        if (tem)
*************** expand_mult_highpart_optab (enum machine
*** 2909,2913 ****
      {
        moptab = unsignedp ? smul_highpart_optab : umul_highpart_optab;
!       tem = expand_binop (mode, moptab, op0, op1, target,
  			  unsignedp, OPTAB_DIRECT);
        if (tem)
--- 2911,2916 ----
      {
        moptab = unsignedp ? smul_highpart_optab : umul_highpart_optab;
!       tem = expand_binop (mode, moptab, op0,
! 			  gen_int_mode (INTVAL (op1), mode), target,
  			  unsignedp, OPTAB_DIRECT);
        if (tem)
*************** expand_mult_highpart (enum machine_mode 
*** 2988,2992 ****
      abort ();
  
!   op1 = gen_int_mode (cnst1, mode);
    cnst1 &= GET_MODE_MASK (mode);
  
--- 2991,2995 ----
      abort ();
  
!   op1 = gen_int_mode (cnst1, wider_mode);
    cnst1 &= GET_MODE_MASK (mode);
  


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