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 PR 14406 (rs6000 abstf2)


Replaces the bogus abstf2 pattern with one that works.  Details in the
PR.

	PR target/14406
	* config/rs6000/rs6000.md (abstf2, abstf2+1): Delete define_insn.
	(abstf2, abstf2_internal): New define_expand.

powerpc64-linux bootstrap and regression test in progress.

Index: gcc/config/rs6000/rs6000.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.296
diff -c -p -r1.296 rs6000.md
*** gcc/config/rs6000/rs6000.md	27 Feb 2004 02:13:59 -0000	1.296
--- gcc/config/rs6000/rs6000.md	3 Mar 2004 15:04:29 -0000
***************
*** 8375,8409 ****
    [(set_attr "type" "fp")
     (set_attr "length" "8")])
  
! (define_insn "abstf2"
    [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
  	(abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
    "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
     && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
!   "*
  {
!   if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
!     return \"fabs %L0,%L1\;fabs %0,%1\";
!   else
!     return \"fabs %0,%1\;fabs %L0,%L1\";
! }"
!   [(set_attr "type" "fp")
!    (set_attr "length" "8")])
  
! (define_insn ""
    [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
! 	(neg:TF (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f"))))]
    "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
     && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
!   "*
  {
!   if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
!     return \"fnabs %L0,%L1\;fnabs %0,%1\";
!   else
!     return \"fnabs %0,%1\;fnabs %L0,%L1\";
! }"
!   [(set_attr "type" "fp")
!    (set_attr "length" "8")])
  
  ;; Next come the multi-word integer load and store and the load and store
  ;; multiple insns.
--- 8376,8415 ----
    [(set_attr "type" "fp")
     (set_attr "length" "8")])
  
! (define_expand "abstf2"
    [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
  	(abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
    "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
     && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
!   "
  {
!   rtx label = gen_label_rtx ();
!   emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
!   emit_label (label);
!   DONE;
! }")
  
! (define_expand "abstf2_internal"
    [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
! 	(match_operand:TF 1 "gpc_reg_operand" "f"))
!    (set (match_dup 3) (abs:DF (match_dup 5)))
!    (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
!    (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
! 			   (label_ref (match_operand 2 "" ""))
! 			   (pc)))
!    (set (match_dup 5) (abs:DF (match_dup 5)))
!    (set (match_dup 6) (neg:DF (match_dup 6)))]
    "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
     && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
!   "
  {
!   const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
!   const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
!   operands[3] = gen_reg_rtx (DFmode);
!   operands[4] = gen_reg_rtx (CCFPmode);
!   operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
!   operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
! }")
  
  ;; Next come the multi-word integer load and store and the load and store
  ;; multiple insns.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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