re PR target/84912 (__builtin_divde* produce Internal Compiler Error when compiled...
authorPeter Bergner <bergner@gcc.gnu.org>
Thu, 29 Mar 2018 00:06:31 +0000 (19:06 -0500)
committerPeter Bergner <bergner@gcc.gnu.org>
Thu, 29 Mar 2018 00:06:31 +0000 (19:06 -0500)
PR target/84912
* config/rs6000/rs6000.h (RS6000_BTM_POWERPC64): New define.
(RS6000_BTM_COMMON): Add RS6000_BTM_POWERPC64.
* config/rs6000/rs6000.c (rs6000_builtin_mask_calculate): Add support
for RS6000_BTM_POWERPC64.
(rs6000_invalid_builtin): Add handling for RS6000_BTM_POWERPC64
(rs6000_builtin_mask_names): Add RS6000_BTM_POWERPC64.
* config/rs6000/rs6000-builtin.def (BU_P7_POWERPC64_MISC_2): New macro
definition.
(DIVDE): Use it.
(DIVDEU): Likewise.

From-SVN: r258943

gcc/ChangeLog
gcc/config/rs6000/rs6000-builtin.def
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.h

index e4d006048ecd2d4b76d3d0a3e13645c0791b4ecd..828916d1cf881e88e2d2066d1fb0448211504726 100644 (file)
@@ -1,4 +1,18 @@
-2018-03-20 Carl Love  <cel@us.ibm.com>
+2018-03-28  Peter Bergner  <bergner@vnet.ibm.com>
+
+       PR target/84912
+       * config/rs6000/rs6000.h (RS6000_BTM_POWERPC64): New define.
+       (RS6000_BTM_COMMON): Add RS6000_BTM_POWERPC64.
+       * config/rs6000/rs6000.c (rs6000_builtin_mask_calculate): Add support
+       for RS6000_BTM_POWERPC64.
+       (rs6000_invalid_builtin): Add handling for RS6000_BTM_POWERPC64
+       (rs6000_builtin_mask_names): Add RS6000_BTM_POWERPC64.
+       * config/rs6000/rs6000-builtin.def (BU_P7_POWERPC64_MISC_2): New macro
+       definition.
+       (DIVDE): Use it.
+       (DIVDEU): Likewise.
+
+2018-03-28 Carl Love  <cel@us.ibm.com>
 
        Revert
        2017-09-27  Carl Love  <cel@us.ibm.com>
index 5bb30aa0a2a639f0488ba3820db9ba85c5268784..37f170d233f77e7d663613dc874582db2170c863 100644 (file)
                     | RS6000_BTC_BINARY),                              \
                    CODE_FOR_ ## ICODE)                 /* ICODE */
 
+#define BU_P7_POWERPC64_MISC_2(ENUM, NAME, ATTR, ICODE)                        \
+  RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM,             /* ENUM */      \
+                   "__builtin_" NAME,                  /* NAME */      \
+                   RS6000_BTM_POPCNTD                                  \
+                   | RS6000_BTM_POWERPC64,             /* MASK */      \
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
+                    | RS6000_BTC_BINARY),                              \
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
+
 #define BU_P7_MISC_X(ENUM, NAME, ATTR)                                 \
   RS6000_BUILTIN_X (MISC_BUILTIN_ ## ENUM,             /* ENUM */      \
                    "__builtin_" NAME,                  /* NAME */      \
@@ -2297,8 +2306,8 @@ BU_P9V_OVERLOAD_1 (VCTZLSBB,      "vctzlsbb")
 /* 2 argument extended divide functions added in ISA 2.06.  */
 BU_P7_MISC_2 (DIVWE,           "divwe",        CONST,  dive_si)
 BU_P7_MISC_2 (DIVWEU,          "divweu",       CONST,  diveu_si)
-BU_P7_MISC_2 (DIVDE,           "divde",        CONST,  dive_di)
-BU_P7_MISC_2 (DIVDEU,          "divdeu",       CONST,  diveu_di)
+BU_P7_POWERPC64_MISC_2 (DIVDE, "divde",        CONST,  dive_di)
+BU_P7_POWERPC64_MISC_2 (DIVDEU,        "divdeu",       CONST,  diveu_di)
 
 /* 1 argument DFP (decimal floating point) functions added in ISA 2.05.  */
 BU_DFP_MISC_1 (DXEX,           "dxex",         CONST,  dfp_dxex_dd)
index cecf7e31fbd31b9e5d14ae3c62b04b1681ff9f65..49ce4edebc301d01f0aec4ec9f4124250128a486 100644 (file)
@@ -3916,6 +3916,7 @@ rs6000_builtin_mask_calculate (void)
          | ((TARGET_P9_MISC)               ? RS6000_BTM_P9_MISC   : 0)
          | ((TARGET_MODULO)                ? RS6000_BTM_MODULO    : 0)
          | ((TARGET_64BIT)                 ? RS6000_BTM_64BIT     : 0)
+         | ((TARGET_POWERPC64)             ? RS6000_BTM_POWERPC64 : 0)
          | ((TARGET_CRYPTO)                ? RS6000_BTM_CRYPTO    : 0)
          | ((TARGET_HTM)                   ? RS6000_BTM_HTM       : 0)
          | ((TARGET_DFP)                   ? RS6000_BTM_DFP       : 0)
@@ -15952,6 +15953,11 @@ rs6000_invalid_builtin (enum rs6000_builtins fncode)
           name);
   else if ((fnmask & RS6000_BTM_FLOAT128) != 0)
     error ("builtin function %qs requires the %qs option", name, "-mfloat128");
+  else if ((fnmask & (RS6000_BTM_POPCNTD | RS6000_BTM_POWERPC64))
+          == (RS6000_BTM_POPCNTD | RS6000_BTM_POWERPC64))
+    error ("builtin function %qs requires the %qs (or newer), and "
+          "%qs or %qs options",
+          name, "-mcpu=power7", "-m64", "-mpowerpc64");
   else
     error ("builtin function %qs is not supported with the current options",
           name);
@@ -36653,6 +36659,7 @@ static struct rs6000_opt_mask const rs6000_builtin_mask_names[] =
   { "hard-dfp",                 RS6000_BTM_DFP,        false, false },
   { "hard-float",       RS6000_BTM_HARD_FLOAT, false, false },
   { "long-double-128",  RS6000_BTM_LDBL128,    false, false },
+  { "powerpc64",        RS6000_BTM_POWERPC64,  false, false },
   { "float128",                 RS6000_BTM_FLOAT128,   false, false },
   { "float128-hw",      RS6000_BTM_FLOAT128_HW,false, false },
 };
index a218366f658a615469e4a956b2a07187131a319f..d93ba5d8e2c3d1c8efc1b37ebe33e5bd65f5d87f 100644 (file)
@@ -2506,6 +2506,7 @@ extern int frame_pointer_needed;
 #define RS6000_BTM_HARD_FLOAT  MASK_SOFT_FLOAT /* Hardware floating point.  */
 #define RS6000_BTM_LDBL128     MASK_MULTIPLE   /* 128-bit long double.  */
 #define RS6000_BTM_64BIT       MASK_64BIT      /* 64-bit addressing.  */
+#define RS6000_BTM_POWERPC64   MASK_POWERPC64  /* 64-bit registers.  */
 #define RS6000_BTM_FLOAT128    MASK_FLOAT128_KEYWORD /* IEEE 128-bit float.  */
 #define RS6000_BTM_FLOAT128_HW MASK_FLOAT128_HW /* IEEE 128-bit float h/w.  */
 
@@ -2526,6 +2527,7 @@ extern int frame_pointer_needed;
                                 | RS6000_BTM_DFP                       \
                                 | RS6000_BTM_HARD_FLOAT                \
                                 | RS6000_BTM_LDBL128                   \
+                                | RS6000_BTM_POWERPC64                 \
                                 | RS6000_BTM_FLOAT128                  \
                                 | RS6000_BTM_FLOAT128_HW)