]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000.c (legitimate_lo_sum_address_p): lo_sum addresses are legitimate on Darwin...
authorGeoffrey Keating <geoffk@apple.com>
Thu, 8 Jan 2004 21:51:56 +0000 (21:51 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Thu, 8 Jan 2004 21:51:56 +0000 (21:51 +0000)
* config/rs6000/rs6000.c (legitimate_lo_sum_address_p): lo_sum
addresses are legitimate on Darwin even when flag_pic.
(rs6000_legitimize_reload_address) [TARGET_MACHO]: Don't create
non-offsettable addresses for loads of TFmode constants.

From-SVN: r75558

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index a413b38149d4d2e4cc338363662f0be23b427112..6fa702558570f95f246bf63aca73680ee15b85b8 100644 (file)
@@ -1,3 +1,10 @@
+2004-01-08  Geoffrey Keating  <geoffk@apple.com>
+
+       * config/rs6000/rs6000.c (legitimate_lo_sum_address_p): lo_sum
+       addresses are legitimate on Darwin even when flag_pic.
+       (rs6000_legitimize_reload_address) [TARGET_MACHO]: Don't create
+       non-offsettable addresses for loads of TFmode constants.
+
 2004-01-08  Kazuhiro Inaoka  <inaoka.kazuhiro@renesas.com>
 
        * config/m32r/m32r.h (ASM_OUTPUT_ALIGNED_BSS): Actually emit
index 32f4f2d19d3f79cdfee73694f35b853337cf744c..3887462be6d67cf7ebc76e53f95781fd31742d44 100644 (file)
@@ -2565,7 +2565,7 @@ legitimate_lo_sum_address_p (enum machine_mode mode, rtx x, int strict)
 
   if (TARGET_ELF || TARGET_MACHO)
     {
-      if (DEFAULT_ABI != ABI_AIX && flag_pic)
+      if (DEFAULT_ABI != ABI_AIX && DEFAULT_ABI != ABI_DARWIN && flag_pic)
        return false;
       if (TARGET_TOC)
        return false;
@@ -3056,36 +3056,30 @@ rs6000_legitimize_reload_address (rtx x, enum machine_mode mode,
   if (GET_CODE (x) == SYMBOL_REF
       && DEFAULT_ABI == ABI_DARWIN
       && !ALTIVEC_VECTOR_MODE (mode)
-      && flag_pic)
-    {
-      /* Darwin load of floating point constant.  */
-      rtx offset = gen_rtx (CONST, Pmode,
-                   gen_rtx (MINUS, Pmode, x,
-                   gen_rtx (SYMBOL_REF, Pmode,
-                       machopic_function_base_name ())));
-      x = gen_rtx (LO_SUM, GET_MODE (x),
-           gen_rtx (PLUS, Pmode, pic_offset_table_rtx,
-               gen_rtx (HIGH, Pmode, offset)), offset);
+      && (flag_pic || MACHO_DYNAMIC_NO_PIC_P)
+      /* Don't do this for TFmode, since the result isn't offsettable.  */
+      && mode != TFmode)
+    {
+      if (flag_pic)
+       {
+         rtx offset = gen_rtx_CONST (Pmode,
+                        gen_rtx_MINUS (Pmode, x,
+                          gen_rtx_SYMBOL_REF (Pmode,
+                            machopic_function_base_name ())));
+         x = gen_rtx_LO_SUM (GET_MODE (x),
+               gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
+                 gen_rtx_HIGH (Pmode, offset)), offset);
+       }
+      else
+       x = gen_rtx_LO_SUM (GET_MODE (x),
+              gen_rtx_HIGH (Pmode, x), x);
+
       push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
-               BASE_REG_CLASS, Pmode, VOIDmode, 0, 0,
-               opnum, (enum reload_type)type);
+                  BASE_REG_CLASS, Pmode, VOIDmode, 0, 0,
+                  opnum, (enum reload_type)type);
       *win = 1;
       return x;
     }
-   if (GET_CODE (x) == SYMBOL_REF
-       && DEFAULT_ABI == ABI_DARWIN
-       && !ALTIVEC_VECTOR_MODE (mode)
-       && MACHO_DYNAMIC_NO_PIC_P)
-     {
-       /* Darwin load of floating point constant.  */
-       x = gen_rtx (LO_SUM, GET_MODE (x),
-               gen_rtx (HIGH, Pmode, x), x);
-       push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
-               BASE_REG_CLASS, Pmode, VOIDmode, 0, 0,
-               opnum, (enum reload_type)type);
-       *win = 1;
-       return x;
-     }
 #endif
   if (TARGET_TOC
       && constant_pool_expr_p (x)