On Wed, Aug 17, 2011 at 12:28 PM, Joseph S. Myers
<jos...@codesourcery.com> wrote:
> On Sun, 7 Aug 2011, H.J. Lu wrote:
>
>> HOST_BITS_PER_WIDE_INT isn't defined in target library.
>> I need to check if HOST_BITS_PER_WIDE_INT is defined
>> first.  Here is the updated patch.
>
> As I said in <http://gcc.gnu.org/ml/gcc/2011-07/msg00488.html>, you need
> to check all CLVC_* uses for cases that need updating for HOST_WIDE_INT
> fields.  This patch fails to update option_enabled and get_option_state.
>

Here is the additional patch.

Thanks.


H.J.
---
diff --git a/gcc/ChangeLog.isa b/gcc/ChangeLog.isa
index a8f7d0e..fe52888 100644
--- a/gcc/ChangeLog.isa
+++ b/gcc/ChangeLog.isa
@@ -1,3 +1,15 @@
+2011-08-17  H.J. Lu  <hongjiu...@intel.com>
+
+       * opts-common.c (get_option_state): Check cl_host_wide_int
+       for CLVC_EQUAL size.
+
+2011-08-17  H.J. Lu  <hongjiu...@intel.com>
+
+       * opts-common.c (set_option): Check cl_host_wide_int for
+       CLVC_EQUAL.
+       (option_enabled): Check cl_host_wide_int for CLVC_EQUAL,
+       CLVC_BIT_CLEAR and CLVC_BIT_SET.
+
 2011-08-07  H.J. Lu  <hongjiu...@intel.com>

        * opth-gen.awk: Check number of mask bits only if
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 1c2138f..0b86764 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -1088,9 +1088,14 @@ set_option (struct gcc_options *opts, struct
gcc_options *opts_set,
        break;

     case CLVC_EQUAL:
-       *(int *) flag_var = (value
-                            ? option->var_value
-                            : !option->var_value);
+       if (option->cl_host_wide_int)
+         *(HOST_WIDE_INT *) flag_var = (value
+                                        ? option->var_value
+                                        : !option->var_value);
+       else
+         *(int *) flag_var = (value
+                              ? option->var_value
+                              : !option->var_value);
        if (set_flag_var)
          *(int *) set_flag_var = 1;
        break;
@@ -1188,13 +1193,22 @@ option_enabled (int opt_idx, void *opts)
        return *(int *) flag_var != 0;

       case CLVC_EQUAL:
-       return *(int *) flag_var == option->var_value;
+       if (option->cl_host_wide_int)
+         return *(HOST_WIDE_INT *) flag_var == option->var_value;
+       else
+         return *(int *) flag_var == option->var_value;

       case CLVC_BIT_CLEAR:
-       return (*(int *) flag_var & option->var_value) == 0;
+       if (option->cl_host_wide_int)
+         return (*(HOST_WIDE_INT *) flag_var & option->var_value) == 0;
+       else
+         return (*(int *) flag_var & option->var_value) == 0;

       case CLVC_BIT_SET:
-       return (*(int *) flag_var & option->var_value) != 0;
+       if (option->cl_host_wide_int)
+         return (*(HOST_WIDE_INT *) flag_var & option->var_value) != 0;
+       else
+         return (*(int *) flag_var & option->var_value) != 0;

       case CLVC_STRING:
       case CLVC_ENUM:
@@ -1221,7 +1235,9 @@ get_option_state (struct gcc_options *opts, int option,
     case CLVC_BOOLEAN:
     case CLVC_EQUAL:
       state->data = flag_var;
-      state->size = sizeof (int);
+      state->size = (cl_options[option].cl_host_wide_int
+                    ? sizeof (HOST_WIDE_INT)
+                    : sizeof (int));
       break;

     case CLVC_BIT_CLEAR:

Reply via email to