]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-common.h (omp_clause_mask::operator !=): New method.
authorJakub Jelinek <jakub@redhat.com>
Fri, 11 Oct 2013 14:34:18 +0000 (16:34 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 11 Oct 2013 14:34:18 +0000 (16:34 +0200)
* c-common.h (omp_clause_mask::operator !=): New method.
* c-omp.c (c_omp_split_clauses): Use if ((mask & something) != 0)
instead of if (mask & something) tests everywhere.

From-SVN: r203447

gcc/c-family/ChangeLog
gcc/c-family/c-common.h
gcc/c-family/c-omp.c

index 5febbe5e7351eff5f33c2b2969d75ae8c2db1fdf..106bfa8c8c857f6fc8c441f641407a6bffd75bb7 100644 (file)
@@ -1,5 +1,9 @@
 2013-10-11  Jakub Jelinek  <jakub@redhat.com>
 
+       * c-common.h (omp_clause_mask::operator !=): New method.
+       * c-omp.c (c_omp_split_clauses): Use if ((mask & something) != 0)
+       instead of if (mask & something) tests everywhere.
+
        * c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to
        201307 instead of 201107.
        * c-common.c (DEF_FUNCTION_TYPE_8): Define.
index 2649248ed95e55a4006ab8202679295dbb8adbc2..1f8333e94a0ed5d37ec7c4b3b4120a3faa1e821a 100644 (file)
@@ -1052,6 +1052,7 @@ struct omp_clause_mask
   inline omp_clause_mask operator >> (int);
   inline omp_clause_mask operator << (int);
   inline bool operator == (omp_clause_mask) const;
+  inline bool operator != (omp_clause_mask) const;
   unsigned HOST_WIDE_INT low, high;
 };
 
@@ -1156,6 +1157,12 @@ omp_clause_mask::operator == (omp_clause_mask b) const
   return low == b.low && high == b.high;
 }
 
+inline bool
+omp_clause_mask::operator != (omp_clause_mask b) const
+{
+  return low != b.low || high != b.high;
+}
+
 # define OMP_CLAUSE_MASK_1 omp_clause_mask (1)
 #endif
 
index dac127ed339960d186bd1f0b736448a7b2d695b8..f001a75cd228dd8a5b271ebc2402e51836e77ccc 100644 (file)
@@ -631,7 +631,7 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
     cclauses[i] = NULL;
   /* Add implicit nowait clause on
      #pragma omp parallel {for,for simd,sections}.  */
-  if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+  if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0)
     switch (code)
       {
       case OMP_FOR:
@@ -691,10 +691,10 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
              OMP_CLAUSE_CHAIN (c) = cclauses[C_OMP_CLAUSE_SPLIT_SIMD];
              cclauses[C_OMP_CLAUSE_SPLIT_SIMD] = c;
            }
-         if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE))
+         if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0)
            {
-             if (mask & (OMP_CLAUSE_MASK_1
-                         << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE))
+             if ((mask & (OMP_CLAUSE_MASK_1
+                          << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0)
                {
                  c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses),
                                        OMP_CLAUSE_COLLAPSE);
@@ -729,19 +729,20 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
           target and simd.  Put it on the outermost of those and
           duplicate on parallel.  */
        case OMP_CLAUSE_FIRSTPRIVATE:
-         if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+         if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+             != 0)
            {
-             if (mask & ((OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS)
-                         | (OMP_CLAUSE_MASK_1
-                            << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)))
+             if ((mask & ((OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS)
+                          | (OMP_CLAUSE_MASK_1
+                             << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE))) != 0)
                {
                  c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses),
                                        OMP_CLAUSE_FIRSTPRIVATE);
                  OMP_CLAUSE_DECL (c) = OMP_CLAUSE_DECL (clauses);
                  OMP_CLAUSE_CHAIN (c) = cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL];
                  cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL] = c;
-                 if (mask & (OMP_CLAUSE_MASK_1
-                             << PRAGMA_OMP_CLAUSE_NUM_TEAMS))
+                 if ((mask & (OMP_CLAUSE_MASK_1
+                              << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) != 0)
                    s = C_OMP_CLAUSE_SPLIT_TEAMS;
                  else
                    s = C_OMP_CLAUSE_SPLIT_DISTRIBUTE;
@@ -751,14 +752,15 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
                   #pragma omp parallel{, for{, simd}, sections}.  */
                s = C_OMP_CLAUSE_SPLIT_PARALLEL;
            }
-         else if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS))
+         else if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS))
+                  != 0)
            {
              /* This must be #pragma omp {,target }teams distribute.  */
              gcc_assert (code == OMP_DISTRIBUTE);
              s = C_OMP_CLAUSE_SPLIT_TEAMS;
            }
-         else if (mask & (OMP_CLAUSE_MASK_1
-                          << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE))
+         else if ((mask & (OMP_CLAUSE_MASK_1
+                           << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0)
            {
              /* This must be #pragma omp distribute simd.  */
              gcc_assert (code == OMP_SIMD);
@@ -777,19 +779,21 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
        case OMP_CLAUSE_LASTPRIVATE:
          if (code == OMP_FOR || code == OMP_SECTIONS)
            {
-             if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+             if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+                 != 0)
                s = C_OMP_CLAUSE_SPLIT_PARALLEL;
              else
                s = C_OMP_CLAUSE_SPLIT_FOR;
              break;
            }
          gcc_assert (code == OMP_SIMD);
-         if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE))
+         if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0)
            {
              c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses),
                                    OMP_CLAUSE_LASTPRIVATE);
              OMP_CLAUSE_DECL (c) = OMP_CLAUSE_DECL (clauses);
-             if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+             if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+                 != 0)
                s = C_OMP_CLAUSE_SPLIT_PARALLEL;
              else
                s = C_OMP_CLAUSE_SPLIT_FOR;
@@ -806,7 +810,8 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
              s = C_OMP_CLAUSE_SPLIT_TEAMS;
              break;
            }
-         if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS))
+         if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS))
+             != 0)
            {
              c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses),
                                    OMP_CLAUSE_CODE (clauses));
@@ -837,9 +842,10 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
              OMP_CLAUSE_CHAIN (c) = cclauses[C_OMP_CLAUSE_SPLIT_SIMD];
              cclauses[C_OMP_CLAUSE_SPLIT_SIMD] = c;
            }
-         if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE))
+         if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0)
            {
-             if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS))
+             if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS))
+                 != 0)
                {
                  c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses),
                                        OMP_CLAUSE_REDUCTION);
@@ -852,8 +858,8 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
                  cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL] = c;
                  s = C_OMP_CLAUSE_SPLIT_TEAMS;
                }
-             else if (mask & (OMP_CLAUSE_MASK_1
-                              << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+             else if ((mask & (OMP_CLAUSE_MASK_1
+                               << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0)
                s = C_OMP_CLAUSE_SPLIT_PARALLEL;
              else
                s = C_OMP_CLAUSE_SPLIT_FOR;
@@ -865,7 +871,8 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
          break;
        case OMP_CLAUSE_IF:
          /* FIXME: This is currently being discussed.  */
-         if (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+         if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS))
+             != 0)
            s = C_OMP_CLAUSE_SPLIT_PARALLEL;
          else
            s = C_OMP_CLAUSE_SPLIT_TARGET;