;;- Machine description for the Hitachi SH.
-;; Copyright (C) 1993 - 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1993 - 2000 Free Software Foundation, Inc.
;; Contributed by Steve Chamberlain (sac@cygnus.com).
;; Improved by Jim Wilson (wilson@cygnus.com).
(const (if_then_else (symbol_ref "TARGET_LITTLE_ENDIAN")
(const_string "little") (const_string "big"))))
+;; Indicate if the default fpu mode is single precision.
+(define_attr "fpu_single" "yes,no"
+ (const (if_then_else (symbol_ref "TARGET_FPU_SINGLE")
+ (const_string "yes") (const_string "no"))))
+
(define_attr "fmovd" "yes,no"
(const (if_then_else (symbol_ref "TARGET_FMOVD")
(const_string "yes") (const_string "no"))))
"cbranch,jump,jump_ind,arith,arith3,arith3b,dyn_shift,other,load,load_si,store,move,fmove,smpy,dmpy,return,pload,pstore,pcload,pcload_si,rte,sfunc,call,fp,fdiv,dfp_arith,dfp_cmp,dfp_conv,dfdiv,gp_fpul,nil"
(const_string "other"))
+;; Indicate what precision must be selected in fpscr for this insn, if any.
+
+(define_attr "fp_mode" "single,double,none" (const_string "none"))
+
; If a conditional branch destination is within -252..258 bytes away
; from the instruction it can be 2 bytes long. Something in the
; range -4090..4100 bytes can be 6 bytes long. All other conditional
"TARGET_SH4 && ! TARGET_FPU_SINGLE"
"jsr @%1%#"
[(set_attr "type" "sfunc")
+ (set_attr "fp_mode" "double")
(set_attr "needs_delay_slot" "yes")])
(define_insn "udivsi3_i4_single"
"TARGET_SH4 && ! TARGET_FPU_SINGLE"
"jsr @%1%#"
[(set_attr "type" "sfunc")
+ (set_attr "fp_mode" "double")
(set_attr "needs_delay_slot" "yes")])
(define_insn "divsi3_i4_single"
(const_int 4)
(const_int 8) (const_int 8) ;; these need only 8 bytes for @(r0,rn)
(const_int 8) (const_int 8)])
- (set_attr "type" "fmove,move,pcload,load,store,pcload,load,store,load,load")])
+ (set_attr "type" "fmove,move,pcload,load,store,pcload,load,store,load,load")
+ (set (attr "fp_mode") (if_then_else (eq_attr "fmovd" "yes")
+ (const_string "double")
+ (const_string "none")))])
;; Moving DFmode between fp/general registers through memory
;; (the top of the stack) is faster than moving through fpul even for
lds %1,%0
! move optimized away"
[(set_attr "type" "fmove,move,fmove,fmove,pcload,load,store,pcload,load,store,fmove,fmove,load,*,gp_fpul,gp_fpul,nil")
- (set_attr "length" "*,*,*,*,4,*,*,*,*,*,2,2,2,4,2,2,0")])
-
+ (set_attr "length" "*,*,*,*,4,*,*,*,*,*,2,2,2,4,2,2,0")
+ (set (attr "fp_mode") (if_then_else (eq_attr "fmovd" "yes")
+ (const_string "single")
+ (const_string "none")))])
(define_split
[(set (match_operand:SF 0 "register_operand" "")
(match_operand:SF 1 "register_operand" ""))
""
"jsr @%0%#"
[(set_attr "type" "call")
+ (set (attr "fp_mode")
+ (if_then_else (eq_attr "fpu_single" "yes")
+ (const_string "single") (const_string "double")))
(set_attr "needs_delay_slot" "yes")])
(define_insn "call_valuei"
""
"jsr @%1%#"
[(set_attr "type" "call")
+ (set (attr "fp_mode")
+ (if_then_else (eq_attr "fpu_single" "yes")
+ (const_string "single") (const_string "double")))
(set_attr "needs_delay_slot" "yes")])
(define_expand "call"
(use (match_operand:PSI 3 "fpscr_operand" "c"))]
"TARGET_SH3E"
"fadd %2,%0"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
(define_expand "subsf3"
[(match_operand:SF 0 "fp_arith_reg_operand" "")
(use (match_operand:PSI 3 "fpscr_operand" "c"))]
"TARGET_SH3E"
"fsub %2,%0"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
;; Unfortunately, the combiner is unable to cope with the USE of the FPSCR
;; register in feeding fp instructions. Thus, we cannot generate fmac for
(use (match_operand:PSI 3 "fpscr_operand" "c"))]
"TARGET_SH3E"
"fmul %2,%0"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
(define_insn "mulsf3_ie"
[(set (match_operand:SF 0 "arith_reg_operand" "=f")
(use (match_operand:PSI 4 "fpscr_operand" "c"))]
"TARGET_SH3E && ! TARGET_SH4"
"fmac fr0,%2,%0"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
(define_expand "divsf3"
[(match_operand:SF 0 "arith_reg_operand" "")
(use (match_operand:PSI 3 "fpscr_operand" "c"))]
"TARGET_SH3E"
"fdiv %2,%0"
- [(set_attr "type" "fdiv")])
+ [(set_attr "type" "fdiv")
+ (set_attr "fp_mode" "single")])
(define_expand "floatsisf2"
[(set (reg:SI 22)
(use (match_operand:PSI 1 "fpscr_operand" "c"))]
"TARGET_SH3E"
"float fpul,%0"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
(define_insn "*floatsisf2_ie"
[(set (match_operand:SF 0 "arith_reg_operand" "=f")
(use (match_operand:PSI 1 "fpscr_operand" "c"))]
"TARGET_SH4"
"ftrc %0,fpul"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
(define_insn "fix_truncsfsi2_i4_2"
[(set (match_operand:SI 0 "arith_reg_operand" "=r")
(clobber (reg:SI 22))]
"TARGET_SH4"
"#"
- [(set_attr "length" "4")])
+ [(set_attr "length" "4")
+ (set_attr "fp_mode" "single")])
(define_split
[(set (match_operand:SI 0 "arith_reg_operand" "=r")
(match_operand:SF 1 "arith_reg_operand" "f")))]
"TARGET_SH3E && ! TARGET_SH4"
"fcmp/gt %1,%0"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
(define_insn "cmpeqsf_t"
[(set (reg:SI 18) (eq:SI (match_operand:SF 0 "arith_reg_operand" "f")
(match_operand:SF 1 "arith_reg_operand" "f")))]
"TARGET_SH3E && ! TARGET_SH4"
"fcmp/eq %1,%0"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
(define_insn "ieee_ccmpeqsf_t"
[(set (reg:SI 18) (ior:SI (reg:SI 18)
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_SH4"
"fcmp/gt %1,%0"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
(define_insn "cmpeqsf_t_i4"
[(set (reg:SI 18) (eq:SI (match_operand:SF 0 "arith_reg_operand" "f")
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_SH4"
"fcmp/eq %1,%0"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "single")])
(define_insn "*ieee_ccmpeqsf_t_4"
[(set (reg:SI 18) (ior:SI (reg:SI 18)
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_IEEE && TARGET_SH4"
"* return output_ieee_ccmpeq (insn, operands);"
- [(set_attr "length" "4")])
+ [(set_attr "length" "4")
+ (set_attr "fp_mode" "single")])
(define_expand "cmpsf"
[(set (reg:SI 18) (compare (match_operand:SF 0 "arith_operand" "")
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_SH3E"
"fneg %0"
- [(set_attr "type" "fmove")])
+ [(set_attr "type" "fmove")
+ (set_attr "fp_mode" "single")])
(define_expand "sqrtsf2"
[(match_operand:SF 0 "arith_reg_operand" "")
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_SH3E"
"fsqrt %0"
- [(set_attr "type" "fdiv")])
+ [(set_attr "type" "fdiv")
+ (set_attr "fp_mode" "single")])
(define_expand "abssf2"
[(match_operand:SF 0 "arith_reg_operand" "")
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_SH3E"
"fabs %0"
- [(set_attr "type" "fmove")])
+ [(set_attr "type" "fmove")
+ (set_attr "fp_mode" "single")])
(define_expand "adddf3"
[(match_operand:DF 0 "arith_reg_operand" "")
(use (match_operand:PSI 3 "fpscr_operand" "c"))]
"TARGET_SH4"
"fadd %2,%0"
- [(set_attr "type" "dfp_arith")])
+ [(set_attr "type" "dfp_arith")
+ (set_attr "fp_mode" "double")])
(define_expand "subdf3"
[(match_operand:DF 0 "arith_reg_operand" "")
(use (match_operand:PSI 3 "fpscr_operand" "c"))]
"TARGET_SH4"
"fsub %2,%0"
- [(set_attr "type" "dfp_arith")])
+ [(set_attr "type" "dfp_arith")
+ (set_attr "fp_mode" "double")])
(define_expand "muldf3"
[(match_operand:DF 0 "arith_reg_operand" "")
(use (match_operand:PSI 3 "fpscr_operand" "c"))]
"TARGET_SH4"
"fmul %2,%0"
- [(set_attr "type" "dfp_arith")])
+ [(set_attr "type" "dfp_arith")
+ (set_attr "fp_mode" "double")])
(define_expand "divdf3"
[(match_operand:DF 0 "arith_reg_operand" "")
(use (match_operand:PSI 3 "fpscr_operand" "c"))]
"TARGET_SH4"
"fdiv %2,%0"
- [(set_attr "type" "dfdiv")])
+ [(set_attr "type" "dfdiv")
+ (set_attr "fp_mode" "double")])
(define_expand "floatsidf2"
[(match_operand:DF 0 "arith_reg_operand" "")
(use (match_operand:PSI 1 "fpscr_operand" "c"))]
"TARGET_SH4"
"float fpul,%0"
- [(set_attr "type" "dfp_conv")])
+ [(set_attr "type" "dfp_conv")
+ (set_attr "fp_mode" "double")])
(define_expand "fix_truncdfsi2"
[(match_operand:SI 0 "arith_reg_operand" "=r")
(use (match_operand:PSI 1 "fpscr_operand" "c"))]
"TARGET_SH4"
"ftrc %0,fpul"
- [(set_attr "type" "dfp_conv")])
+ [(set_attr "type" "dfp_conv")
+ (set_attr "fp_mode" "double")])
(define_insn "fix_truncdfsi2_i4"
[(set (match_operand:SI 0 "arith_reg_operand" "=r")
(clobber (reg:SI 22))]
"TARGET_SH4"
"#"
- [(set_attr "length" "4")])
+ [(set_attr "length" "4")
+ (set_attr "fp_mode" "double")])
(define_split
[(set (match_operand:SI 0 "arith_reg_operand" "=r")
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_SH4"
"fcmp/gt %1,%0"
- [(set_attr "type" "dfp_cmp")])
+ [(set_attr "type" "dfp_cmp")
+ (set_attr "fp_mode" "double")])
(define_insn "cmpeqdf_t"
[(set (reg:SI 18) (eq:SI (match_operand:DF 0 "arith_reg_operand" "f")
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_SH4"
"fcmp/eq %1,%0"
- [(set_attr "type" "dfp_cmp")])
+ [(set_attr "type" "dfp_cmp")
+ (set_attr "fp_mode" "double")])
(define_insn "*ieee_ccmpeqdf_t"
[(set (reg:SI 18) (ior:SI (reg:SI 18)
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_IEEE && TARGET_SH4"
"* return output_ieee_ccmpeq (insn, operands);"
- [(set_attr "length" "4")])
-
+ [(set_attr "length" "4")
+ (set_attr "fp_mode" "double")])
+
(define_expand "cmpdf"
[(set (reg:SI 18) (compare (match_operand:DF 0 "arith_operand" "")
(match_operand:DF 1 "arith_operand" "")))]
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_SH4"
"fneg %0"
- [(set_attr "type" "fmove")])
+ [(set_attr "type" "fmove")
+ (set_attr "fp_mode" "double")])
(define_expand "sqrtdf2"
[(match_operand:DF 0 "arith_reg_operand" "")
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_SH4"
"fsqrt %0"
- [(set_attr "type" "dfdiv")])
+ [(set_attr "type" "dfdiv")
+ (set_attr "fp_mode" "double")])
(define_expand "absdf2"
[(match_operand:DF 0 "arith_reg_operand" "")
(use (match_operand:PSI 2 "fpscr_operand" "c"))]
"TARGET_SH4"
"fabs %0"
- [(set_attr "type" "fmove")])
+ [(set_attr "type" "fmove")
+ (set_attr "fp_mode" "double")])
(define_expand "extendsfdf2"
[(match_operand:DF 0 "arith_reg_operand" "")
(use (match_operand:PSI 1 "fpscr_operand" "c"))]
"TARGET_SH4"
"fcnvsd fpul,%0"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "double")])
(define_expand "truncdfsf2"
[(match_operand:SF 0 "arith_reg_operand" "")
(use (match_operand:PSI 1 "fpscr_operand" "c"))]
"TARGET_SH4"
"fcnvds %0,fpul"
- [(set_attr "type" "fp")])
+ [(set_attr "type" "fp")
+ (set_attr "fp_mode" "double")])
\f
;; Bit field extract patterns. These give better code for packed bitfields,
;; because they allow auto-increment addresses to be generated.