Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-2-0]: src/gnu/dist/gcc/gcc/config/sparc Pull up revision 1.4 (req...



details:   https://anonhg.NetBSD.org/src/rev/8d6d5894d946
branches:  netbsd-2-0
changeset: 560733:8d6d5894d946
user:      tron <tron%NetBSD.org@localhost>
date:      Wed May 05 15:35:14 2004 +0000

description:
Pull up revision 1.4 (requested by martin in ticket #246):
Bring in a change from gcc-current to fix double -> unsigned long
conversions and generally avoid 128 bit (emulated) floats in between.
This fixes heaps of problems in perl >= 5.7.1, where integer values
and unsigned values are separated by the interpreter.
Thu Feb 26 18:40:40 2004 UTC by ebotcazou:
        * config/sparc/sparc-protos.h (sparc_emit_floatunsdi): Add 'mode'.
        (sparc_emit_fixunsdi): New prototype.
        * config/sparc/sparc.c (sparc_emit_floatunsdi): Use 'mode' argument.
        (sparc_emit_fixunsdi): New function.
        * config/sparc/sparc.md (floatunsdisf2): Use 'general_operand' for
        operand 1.  Pass SFmode to sparc_emit_floatunsdi.
        (floatunsdidf2): Use 'general_operand' for operand 1.  Pass DFmode
        to sparc_emit_floatunsdi.
        (fixuns_truncsfdi2): New expander.
        (fixuns_truncdfdi2): Likewise.

diffstat:

 gnu/dist/gcc/gcc/config/sparc/sparc.c |  46 +++++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 4 deletions(-)

diffs (68 lines):

diff -r d8d2a267fdad -r 8d6d5894d946 gnu/dist/gcc/gcc/config/sparc/sparc.c
--- a/gnu/dist/gcc/gcc/config/sparc/sparc.c     Wed May 05 15:34:58 2004 +0000
+++ b/gnu/dist/gcc/gcc/config/sparc/sparc.c     Wed May 05 15:35:14 2004 +0000
@@ -5815,15 +5815,12 @@
    optabs would emit if we didn't have TFmode patterns.  */
 
 void
-sparc_emit_floatunsdi (operands)
-     rtx operands[2];
+sparc_emit_floatunsdi (rtx *operands, enum machine_mode mode)
 {
   rtx neglab, donelab, i0, i1, f0, in, out;
-  enum machine_mode mode;
 
   out = operands[0];
   in = force_reg (DImode, operands[1]);
-  mode = GET_MODE (out);
   neglab = gen_label_rtx ();
   donelab = gen_label_rtx ();
   i0 = gen_reg_rtx (DImode);
@@ -5847,6 +5844,47 @@
   emit_label (donelab);
 }
 
+/* Generate an FP to unsigned DImode conversion.  This is the same code
+   optabs would emit if we didn't have TFmode patterns.  */
+
+void
+sparc_emit_fixunsdi (rtx *operands, enum machine_mode mode)
+{
+  rtx neglab, donelab, i0, i1, f0, in, out, limit;
+
+  out = operands[0];
+  in = force_reg (mode, operands[1]);
+  neglab = gen_label_rtx ();
+  donelab = gen_label_rtx ();
+  i0 = gen_reg_rtx (DImode);
+  i1 = gen_reg_rtx (DImode);
+  limit = gen_reg_rtx (mode);
+  f0 = gen_reg_rtx (mode);
+
+  emit_move_insn (limit,
+                 CONST_DOUBLE_FROM_REAL_VALUE (
+                   REAL_VALUE_ATOF ("9223372036854775808.0", mode), mode));
+  emit_cmp_and_jump_insns (in, limit, GE, NULL_RTX, mode, 0, neglab);
+
+  emit_insn (gen_rtx_SET (VOIDmode,
+                         out,
+                         gen_rtx_FIX (DImode, gen_rtx_FIX (mode, in))));
+  emit_jump_insn (gen_jump (donelab));
+  emit_barrier ();
+
+  emit_label (neglab);
+
+  emit_insn (gen_rtx_SET (VOIDmode, f0, gen_rtx_MINUS (mode, in, limit)));
+  emit_insn (gen_rtx_SET (VOIDmode,
+                         i0,
+                         gen_rtx_FIX (DImode, gen_rtx_FIX (mode, f0))));
+  emit_insn (gen_movdi (i1, const1_rtx));
+  emit_insn (gen_ashldi3 (i1, i1, GEN_INT (63)));
+  emit_insn (gen_xordi3 (out, i0, i1));
+
+  emit_label (donelab);
+}
+
 /* Return the string to output a conditional branch to LABEL, testing
    register REG.  LABEL is the operand number of the label; REG is the
    operand number of the reg.  OP is the conditional expression.  The mode



Home | Main Index | Thread Index | Old Index