This is the mail archive of the gcc@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]

Re: Optimization problem on PPC when casting integers to floats



From: Geoff Keating <geoffk@cygnus.com>
>I think it might help if it instead generated
>  [(set (match_dup 7) (match_dup 2))
>   (parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
>		   (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
>	      (use (match_dup 3))
>	      (use (match_dup 4))
>	      (clobber (match_dup 8))
>	      (clobber (match_dup 5))
>	      (clobber (match_dup 6))])]



  OK, so in the Darwin repository, cc/cc/config/rs6000/rs6000.md has the  
following:

;; Conversions to and from floating-point.
(define_expand "floatsidf2"
  [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
		   (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
	      (use (match_dup 2))
	      (use (match_dup 3))
	      (clobber (match_dup 4))
	      (clobber (match_dup 5))
	      (clobber (reg:DF 76))])]
  "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
  "
{
  operands[2] = force_reg (SImode, GEN_INT (0x43300000));
  operands[3] = force_reg (DFmode, rs6000_float_const  
(\"4503601774854144\", DFmode));
  operands[4] = gen_reg_rtx (SImode);
  operands[5] = gen_reg_rtx (Pmode);
}")


  On the head of the GCC repository, we have:

(define_expand "floatsidf2"
  [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
		   (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
	      (use (match_dup 2))
	      (use (match_dup 3))
	      (clobber (match_dup 4))
	      (clobber (match_dup 5))
	      (clobber (match_dup 6))])]
  "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
  "
{
  operands[2] = force_reg (SImode, GEN_INT (0x43300000));
  operands[3] = force_reg (DFmode, rs6000_float_const  
(\"4503601774854144\", DFmode));
  operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
  operands[5] = gen_reg_rtx (DFmode);
  operands[6] = gen_reg_rtx (SImode);
}")


  I'm not a .md file hacker (I'm not much of a gcc hacker at all), so if  
anyone could suggest a replacement for the section of the .md file that I  
can copy into the _Darwin_ repository version, I'd be happy to test to see  
if this approach works.  Of course, I'm stuck using the Darwin gcc right  
now (2.92.2 based) so if this fix depends upon some newer alias stuff or  
something, it might not work for me even if the fix is valid.

-tim


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