Richi has asked the we break the wide-int patch so that the individual port and 
front end maintainers can review their parts without have to go through the 
entire patch.    This patch covers the darwin port.

Ok?

        * config/darwin.c
        (darwin_mergeable_constant_section): Use wide-int interfaces.
        (machopic_select_rtx_section): Update to handle CONST_WIDE_INT.


diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 761576d..50fb3f0 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -1289,22 +1289,17 @@ darwin_mergeable_constant_section (tree exp,
     {
       tree size = TYPE_SIZE_UNIT (TREE_TYPE (exp));
 
-      if (TREE_CODE (size) == INTEGER_CST
-         && TREE_INT_CST_LOW (size) == 4
-         && TREE_INT_CST_HIGH (size) == 0)
-        return darwin_sections[literal4_section];
-      else if (TREE_CODE (size) == INTEGER_CST
-              && TREE_INT_CST_LOW (size) == 8
-              && TREE_INT_CST_HIGH (size) == 0)
-        return darwin_sections[literal8_section];
-      else if (HAVE_GAS_LITERAL16
-              && TARGET_64BIT
-               && TREE_CODE (size) == INTEGER_CST
-               && TREE_INT_CST_LOW (size) == 16
-               && TREE_INT_CST_HIGH (size) == 0)
-        return darwin_sections[literal16_section];
-      else
-        return readonly_data_section;
+      if (TREE_CODE (size) == INTEGER_CST)
+       {
+         if (wi::eq_p (size, 4))
+           return darwin_sections[literal4_section];
+         else if (wi::eq_p (size, 8))
+           return darwin_sections[literal8_section];
+         else if (HAVE_GAS_LITERAL16
+                  && TARGET_64BIT
+                  && wi::eq_p (size, 16))
+           return darwin_sections[literal16_section];
+       }
     }
 
   return readonly_data_section;
@@ -1731,16 +1726,19 @@ machopic_select_rtx_section (enum machine_mode mode, 
rtx x,
 {
   if (GET_MODE_SIZE (mode) == 8
       && (GET_CODE (x) == CONST_INT
+         || GET_CODE (x) == CONST_WIDE_INT
          || GET_CODE (x) == CONST_DOUBLE))
     return darwin_sections[literal8_section];
   else if (GET_MODE_SIZE (mode) == 4
           && (GET_CODE (x) == CONST_INT
+              || GET_CODE (x) == CONST_WIDE_INT
               || GET_CODE (x) == CONST_DOUBLE))
     return darwin_sections[literal4_section];
   else if (HAVE_GAS_LITERAL16
           && TARGET_64BIT
           && GET_MODE_SIZE (mode) == 16
           && (GET_CODE (x) == CONST_INT
+              || GET_CODE (x) == CONST_WIDE_INT
               || GET_CODE (x) == CONST_DOUBLE
               || GET_CODE (x) == CONST_VECTOR))
     return darwin_sections[literal16_section];

Reply via email to