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]

Better code for SSE FP conversions


Hi,
HImode->float are currently done by converting HImode->XFmode and
XFmode->float.
For SSE it is cheaper to do HImode->SImode->float.

Honza

Index: i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.430
diff -c -3 -p -r1.430 i386.md
*** i386.md	9 Feb 2003 12:35:28 -0000	1.430
--- i386.md	9 Feb 2003 17:31:27 -0000
***************
*** 4842,4851 ****
  ;; Even though we only accept memory inputs, the backend _really_
  ;; wants to be able to do this between registers.
  
! (define_insn "floathisf2"
    [(set (match_operand:SF 0 "register_operand" "=f,f")
  	(float:SF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
!   "TARGET_80387 && !TARGET_SSE"
    "@
     fild%z1\t%1
     #"
--- 4842,4864 ----
  ;; Even though we only accept memory inputs, the backend _really_
  ;; wants to be able to do this between registers.
  
! (define_expand "floathisf2"
!   [(set (match_operand:SF 0 "register_operand" "")
! 	(float:SF (match_operand:HI 1 "nonimmediate_operand" "")))]
!   "TARGET_SSE || TARGET_80387"
! {
!   if (TARGET_SSE && TARGET_SSE_MATH)
!     {
!       emit_insn (gen_floatsisf2 (operands[0],
! 				 convert_to_mode (SImode, operands[1], 0)));
!       DONE;
!     }
! })
! 
! (define_insn "*floathisf2_1"
    [(set (match_operand:SF 0 "register_operand" "=f,f")
  	(float:SF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
!   "TARGET_80387 && (!TARGET_SSE || !TARGET_SSE_MATH)"
    "@
     fild%z1\t%1
     #"
***************
*** 4956,4965 ****
    DONE;
  })
  
! (define_insn "floathidf2"
    [(set (match_operand:DF 0 "register_operand" "=f,f")
  	(float:DF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
!   "TARGET_80387 && !TARGET_SSE2"
    "@
     fild%z1\t%1
     #"
--- 4969,4991 ----
    DONE;
  })
  
! (define_expand "floathidf2"
!   [(set (match_operand:DF 0 "register_operand" "")
! 	(float:DF (match_operand:HI 1 "nonimmediate_operand" "")))]
!   "TARGET_SSE2 || TARGET_80387"
! {
!   if (TARGET_SSE && TARGET_SSE_MATH)
!     {
!       emit_insn (gen_floatsidf2 (operands[0],
! 				 convert_to_mode (SImode, operands[1], 0)));
!       DONE;
!     }
! })
! 
! (define_insn "*floathidf2_1"
    [(set (match_operand:DF 0 "register_operand" "=f,f")
  	(float:DF (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
!   "TARGET_80387 && (!TARGET_SSE2 || !TARGET_SSE_MATH)"
    "@
     fild%z1\t%1
     #"


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