This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
alpha tfmode tweeks
- To: gcc-patches at gcc dot gnu dot org
- Subject: alpha tfmode tweeks
- From: Richard Henderson <rth at cygnus dot com>
- Date: Sun, 30 Jan 2000 12:25:51 -0800
* I'd twiddled the wrong word on negtf and abstf
* extendsftf is not synthesized by optabs
* Use alternate method for trunctfsf that doesn't incorrectly round.
r~
* alpha.md (negtf2, abstf2): Fix word order thinko.
(extendsftf2): New.
(trunctfsf2): Avoid intermediate rounding errors.
Index: alpha.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/alpha.md,v
retrieving revision 1.107
diff -c -p -d -r1.107 alpha.md
*** alpha.md 2000/01/28 04:36:43 1.107
--- alpha.md 2000/01/30 20:11:24
***************
*** 1808,1825 ****
move = 1;
if (rtx_equal_p (operands[0], operands[2]))
move = 0;
! else if (rtx_equal_p (operands[0], operands[3]))
move = -1;
if (move < 0)
! emit_move_insn (operands[1], operands[3]);
tmp = gen_rtx_NOT (DImode, operands[4]);
! tmp = gen_rtx_AND (DImode, tmp, operands[2]);
! emit_insn (gen_rtx_SET (VOIDmode, operands[0], tmp));
if (move > 0)
! emit_move_insn (operands[1], operands[3]);
DONE;
}")
--- 1808,1825 ----
move = 1;
if (rtx_equal_p (operands[0], operands[2]))
move = 0;
! else if (rtx_equal_p (operands[1], operands[2]))
move = -1;
if (move < 0)
! emit_move_insn (operands[0], operands[2]);
tmp = gen_rtx_NOT (DImode, operands[4]);
! tmp = gen_rtx_AND (DImode, tmp, operands[3]);
! emit_insn (gen_rtx_SET (VOIDmode, operands[1], tmp));
if (move > 0)
! emit_move_insn (operands[0], operands[2]);
DONE;
}")
***************
*** 1873,1888 ****
move = 1;
if (rtx_equal_p (operands[0], operands[2]))
move = 0;
! else if (rtx_equal_p (operands[0], operands[3]))
move = -1;
if (move < 0)
! emit_move_insn (operands[1], operands[3]);
! emit_insn (gen_xordi3 (operands[0], operands[2], operands[4]));
if (move > 0)
! emit_move_insn (operands[1], operands[3]);
DONE;
}")
--- 1873,1888 ----
move = 1;
if (rtx_equal_p (operands[0], operands[2]))
move = 0;
! else if (rtx_equal_p (operands[1], operands[2]))
move = -1;
if (move < 0)
! emit_move_insn (operands[0], operands[2]);
! emit_insn (gen_xordi3 (operands[1], operands[3], operands[4]));
if (move > 0)
! emit_move_insn (operands[0], operands[2]);
DONE;
}")
***************
*** 2179,2184 ****
--- 2179,2196 ----
st%- %1,%0"
[(set_attr "type" "fcpys,fld,fst")])
+ (define_expand "extendsftf2"
+ [(use (match_operand:TF 0 "register_operand" ""))
+ (use (match_operand:SF 1 "general_operand" ""))]
+ "TARGET_HAS_XFLOATING_LIBS"
+ "
+ {
+ rtx tmp = gen_reg_rtx (DFmode);
+ emit_insn (gen_extendsfdf2 (tmp, operands[1]));
+ emit_insn (gen_extenddftf2 (operands[0], tmp));
+ DONE;
+ }")
+
(define_expand "extenddftf2"
[(use (match_operand:TF 0 "register_operand" ""))
(use (match_operand:DF 1 "general_operand" ""))]
***************
*** 2207,2225 ****
"TARGET_HAS_XFLOATING_LIBS"
"alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
- ;; ??? This isn't quite right, as rounding isn't correct. But it's
- ;; extremely tortureous to do this correctly with the functionality
- ;; availible in the library.
-
(define_expand "trunctfsf2"
[(use (match_operand:SF 0 "register_operand" ""))
(use (match_operand:TF 1 "general_operand" ""))]
"TARGET_HAS_XFLOATING_LIBS"
"
{
! rtx tmp = gen_reg_rtx (DFmode);
! emit_insn (gen_trunctfdf2 (tmp, operands[1]));
! emit_insn (gen_truncdfsf2 (operands[0], tmp));
DONE;
}")
--- 2219,2248 ----
"TARGET_HAS_XFLOATING_LIBS"
"alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
(define_expand "trunctfsf2"
[(use (match_operand:SF 0 "register_operand" ""))
(use (match_operand:TF 1 "general_operand" ""))]
"TARGET_HAS_XFLOATING_LIBS"
"
{
! rtx tmpf, sticky, arg, lo, hi;
!
! tmpf = gen_reg_rtx (DFmode);
! sticky = gen_reg_rtx (DImode);
! arg = copy_to_mode_reg (TFmode, operands[1]);
! lo = gen_lowpart (DImode, arg);
! hi = gen_highpart (DImode, arg);
!
! /* Convert the low word of the TFmode value into a sticky rounding bit,
! then or it into the low bit of the high word. This leaves the sticky
! bit at bit 48 of the fraction, which is representable in DFmode,
! which prevents rounding error in the final conversion to SFmode. */
!
! emit_insn (gen_rtx_SET (VOIDmode, sticky,
! gen_rtx_LTU (DImode, const0_rtx, lo)));
! emit_insn (gen_iordi3 (hi, hi, sticky));
! emit_insn (gen_trunctfdf2 (tmpf, arg));
! emit_insn (gen_truncdfsf2 (operands[0], tmpf));
DONE;
}")