------- Comment #5 from dje at watson dot ibm dot com  2005-11-16 17:45 -------
Subject: Re:  Python miscompilation - TOC reload 

        Appended is a proposed patch to backport the easy_fp_constant
change to 4.0.  Can you check if this fixes the problem?  This patch may
hurt performance because the float extend functionality is not in 4.0.

        PR target/24779
        * config/rs6000/rs6000.c (easy_fp_constant): SFmode constant
        0.0f is easy.  Return 0 for SFmode and DFmode before reload when
        flag_unsafe_math_optimizations not enabled.
        * config/rs6000/rs6000.md (movdf splitter): Use
        const_double_operand predicate for TARGET_POWERPC64.

Index: rs6000.c
===================================================================
*** rs6000.c    (revision 106255)
--- rs6000.c    (working copy)
*************** easy_fp_constant (rtx op, enum machine_m
*** 2277,2283 ****
        long k[2];
        REAL_VALUE_TYPE rv;

!       if (TARGET_E500_DOUBLE)
        return 0;

        REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
--- 2277,2290 ----
        long k[2];
        REAL_VALUE_TYPE rv;

!       /* Force constants to memory before reload to utilize
!        compress_float_constant.
!        Avoid this when flag_unsafe_math_optimizations is enabled
!        because RDIV division to reciprocal optimization is not able
!        to regenerate the division.  */
!       if (TARGET_E500_DOUBLE
!         || (!reload_in_progress && !reload_completed
!             && !flag_unsafe_math_optimizations))
        return 0;

        REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
*************** easy_fp_constant (rtx op, enum machine_m
*** 2291,2296 ****
--- 2298,2316 ----
      {
        long l;
        REAL_VALUE_TYPE rv;
+ 
+       /* The constant 0.f is easy.  */
+       if (op == CONST0_RTX (SFmode))
+       return 1;
+ 
+       /* Force constants to memory before reload to utilize
+        compress_float_constant.
+        Avoid this when flag_unsafe_math_optimizations is enabled
+        because RDIV division to reciprocal optimization is not able
+        to regenerate the division.  */
+       if (!reload_in_progress && !reload_completed
+         && !flag_unsafe_math_optimizations)
+       return 0;

        REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
        REAL_VALUE_TO_TARGET_SINGLE (rv, l);
Index: rs6000.md
===================================================================
*** rs6000.md   (revision 106255)
--- rs6000.md   (working copy)
***************
*** 8043,8049 ****

  (define_split
    [(set (match_operand:DF 0 "gpc_reg_operand" "")
!       (match_operand:DF 1 "easy_fp_constant" ""))]
    "TARGET_POWERPC64 && reload_completed
     && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
         || (GET_CODE (operands[0]) == SUBREG
--- 8043,8049 ----

  (define_split
    [(set (match_operand:DF 0 "gpc_reg_operand" "")
!       (match_operand:DF 1 "const_double_operand" ""))]
    "TARGET_POWERPC64 && reload_completed
     && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
         || (GET_CODE (operands[0]) == SUBREG


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24779

Reply via email to