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]

Re: [PATCH] PowerPC extendsfdf2 MEM alternative


	Changing easy_fp_constant predicate so that FP constants are
forced to memory early allows compress_float_constant() to work for
constants that are not emitted during expand_assignment().

	I am going to test the effect on performance.

David


	* config/rs6000/predicates.md: (easy_fp_constant): Return 0 for
	SFmode, DFmode, and TFmode before reload.
	(reg_or_none500mem_operand): New predicate.
	* config/rs6000/rs6000.md (extendsfdf2): Change operand1 predicate
	to reg_or_none500mem_operand.
	(extendsfdf2_fpr): Add MEM alternative.

Index: predicates.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/predicates.md,v
retrieving revision 1.6
diff -c -p -r1.6 predicates.md
*** predicates.md	7 Mar 2005 00:21:27 -0000	1.6
--- predicates.md	12 Mar 2005 20:52:21 -0000
***************
*** 205,210 ****
--- 205,213 ----
        long k[4];
        REAL_VALUE_TYPE rv;
  
+       if (!reload_in_progress && !reload_completed)
+         return 0;
+ 
        REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
        REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, k);
  
***************
*** 219,225 ****
        long k[2];
        REAL_VALUE_TYPE rv;
  
!       if (TARGET_E500_DOUBLE)
  	return 0;
  
        REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
--- 222,229 ----
        long k[2];
        REAL_VALUE_TYPE rv;
  
!       if (TARGET_E500_DOUBLE
!           || (!reload_in_progress && !reload_completed))
  	return 0;
  
        REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
***************
*** 234,239 ****
--- 238,246 ----
        long l;
        REAL_VALUE_TYPE rv;
  
+       if (!reload_in_progress && !reload_completed)
+         return 0;
+ 
        REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
        REAL_VALUE_TO_TARGET_SINGLE (rv, l);
  
***************
*** 537,542 ****
--- 544,558 ----
  	       (match_operand 0 "volatile_mem_operand")))
       (match_operand 0 "gpc_reg_operand")))
  
+ ;; Return 1 if the operand is either an easy FP constant or memory or reg.
+ (define_predicate "reg_or_none500mem_operand"
+   (if_then_else (match_code "mem")
+      (and (match_test "!TARGET_E500_DOUBLE")
+ 	  (ior (match_operand 0 "memory_operand")
+ 	       (ior (match_test "macho_lo_sum_memory_operand (op, mode)")
+ 		    (match_operand 0 "volatile_mem_operand"))))
+      (match_operand 0 "gpc_reg_operand")))
+ 
  ;; Return 1 if the operand is a general register or memory operand without
  ;; pre_inc or pre_dec, which produces invalid form of PowerPC lwa
  ;; instruction.
Index: rs6000.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.353
diff -c -p -r1.353 rs6000.md
*** rs6000.md	8 Mar 2005 00:28:32 -0000	1.353
--- rs6000.md	12 Mar 2005 20:52:21 -0000
***************
*** 4410,4433 ****
  
  (define_expand "extendsfdf2"
    [(set (match_operand:DF 0 "gpc_reg_operand" "")
! 	(float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "")))]
    "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
    "")
  
  (define_insn_and_split "*extendsfdf2_fpr"
!   [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
! 	(float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "0,f")))]
    "TARGET_HARD_FLOAT && TARGET_FPRS"
    "@
     #
!    fmr %0,%1"
    "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
    [(const_int 0)]
  {
    emit_note (NOTE_INSN_DELETED);
    DONE;
  }
!   [(set_attr "type" "fp")])
  
  (define_expand "truncdfsf2"
    [(set (match_operand:SF 0 "gpc_reg_operand" "")
--- 4410,4434 ----
  
  (define_expand "extendsfdf2"
    [(set (match_operand:DF 0 "gpc_reg_operand" "")
! 	(float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
    "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
    "")
  
  (define_insn_and_split "*extendsfdf2_fpr"
!   [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
! 	(float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
    "TARGET_HARD_FLOAT && TARGET_FPRS"
    "@
     #
!    fmr %0,%1
!    lfs%U1%X1 %0,%1"
    "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
    [(const_int 0)]
  {
    emit_note (NOTE_INSN_DELETED);
    DONE;
  }
!   [(set_attr "type" "fp,fp,fpload")])
  
  (define_expand "truncdfsf2"
    [(set (match_operand:SF 0 "gpc_reg_operand" "")


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