Commit eece7fe5 by Julia Koval Committed by Julia Koval

Move omp bitmask to general to use it in x86 backend.

gcc/c-family/
	* c-common.h (omp_clause_mask): Move to wide_int_bitmask.h.

gcc/
	* config/i386/i386.c (ix86_option_override_internal): Change flags type
	to wide_int_bitmask.
	* wide-int-bitmask.h: New.

From-SVN: r257329
parent ce2e6077
2018-02-02 Julia Koval <julia.koval@intel.com>
* config/i386/i386.c (ix86_option_override_internal): Change flags type
to wide_int_bitmask.
* wide-int-bitmask.h: New.
2018-02-02 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
PR target/84066
......
2018-02-02 Julia Koval <julia.koval@intel.com>
* c-common.h (omp_clause_mask): Move to wide_int_bitmask.h.
2018-01-29 Marek Polacek <polacek@redhat.com>
PR c/83966
......
......@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "alias.h"
#include "tree.h"
#include "fold-const.h"
#include "wide-int-bitmask.h"
/* In order for the format checking to accept the C frontend
diagnostic framework extensions, you must include this file before
......@@ -1111,126 +1112,7 @@ extern void pp_dir_change (cpp_reader *, const char *);
extern bool check_missing_format_attribute (tree, tree);
/* In c-omp.c */
struct omp_clause_mask
{
inline omp_clause_mask ();
inline omp_clause_mask (uint64_t l);
inline omp_clause_mask (uint64_t l, uint64_t h);
inline omp_clause_mask &operator &= (omp_clause_mask);
inline omp_clause_mask &operator |= (omp_clause_mask);
inline omp_clause_mask operator ~ () const;
inline omp_clause_mask operator & (omp_clause_mask) const;
inline omp_clause_mask operator | (omp_clause_mask) const;
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;
uint64_t low, high;
};
inline
omp_clause_mask::omp_clause_mask ()
{
}
inline
omp_clause_mask::omp_clause_mask (uint64_t l)
: low (l), high (0)
{
}
inline
omp_clause_mask::omp_clause_mask (uint64_t l, uint64_t h)
: low (l), high (h)
{
}
inline omp_clause_mask &
omp_clause_mask::operator &= (omp_clause_mask b)
{
low &= b.low;
high &= b.high;
return *this;
}
inline omp_clause_mask &
omp_clause_mask::operator |= (omp_clause_mask b)
{
low |= b.low;
high |= b.high;
return *this;
}
inline omp_clause_mask
omp_clause_mask::operator ~ () const
{
omp_clause_mask ret (~low, ~high);
return ret;
}
inline omp_clause_mask
omp_clause_mask::operator | (omp_clause_mask b) const
{
omp_clause_mask ret (low | b.low, high | b.high);
return ret;
}
inline omp_clause_mask
omp_clause_mask::operator & (omp_clause_mask b) const
{
omp_clause_mask ret (low & b.low, high & b.high);
return ret;
}
inline omp_clause_mask
omp_clause_mask::operator << (int amount)
{
omp_clause_mask ret;
if (amount >= 64)
{
ret.low = 0;
ret.high = low << (amount - 64);
}
else if (amount == 0)
ret = *this;
else
{
ret.low = low << amount;
ret.high = (low >> (64 - amount)) | (high << amount);
}
return ret;
}
inline omp_clause_mask
omp_clause_mask::operator >> (int amount)
{
omp_clause_mask ret;
if (amount >= 64)
{
ret.low = high >> (amount - 64);
ret.high = 0;
}
else if (amount == 0)
ret = *this;
else
{
ret.low = (high << (64 - amount)) | (low >> amount);
ret.high = high >> amount;
}
return ret;
}
inline bool
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;
}
typedef wide_int_bitmask omp_clause_mask;
#define OMP_CLAUSE_MASK_1 omp_clause_mask (1)
......
/* Operation with 128 bit bitmask.
Copyright (C) 2013-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_WIDE_INT_BITMASK_H
#define GCC_WIDE_INT_BITMASK_H
struct wide_int_bitmask
{
inline wide_int_bitmask ();
inline wide_int_bitmask (uint64_t l);
inline wide_int_bitmask (uint64_t l, uint64_t h);
inline wide_int_bitmask &operator &= (wide_int_bitmask);
inline wide_int_bitmask &operator |= (wide_int_bitmask);
inline wide_int_bitmask operator ~ () const;
inline wide_int_bitmask operator & (wide_int_bitmask) const;
inline wide_int_bitmask operator | (wide_int_bitmask) const;
inline wide_int_bitmask operator >> (int);
inline wide_int_bitmask operator << (int);
inline bool operator == (wide_int_bitmask) const;
inline bool operator != (wide_int_bitmask) const;
uint64_t low, high;
};
inline
wide_int_bitmask::wide_int_bitmask ()
: low (0), high (0)
{
}
inline
wide_int_bitmask::wide_int_bitmask (uint64_t l)
: low (l), high (0)
{
}
inline
wide_int_bitmask::wide_int_bitmask (uint64_t l, uint64_t h)
: low (l), high (h)
{
}
inline wide_int_bitmask &
wide_int_bitmask::operator &= (wide_int_bitmask b)
{
low &= b.low;
high &= b.high;
return *this;
}
inline wide_int_bitmask &
wide_int_bitmask::operator |= (wide_int_bitmask b)
{
low |= b.low;
high |= b.high;
return *this;
}
inline wide_int_bitmask
wide_int_bitmask::operator ~ () const
{
wide_int_bitmask ret (~low, ~high);
return ret;
}
inline wide_int_bitmask
wide_int_bitmask::operator | (wide_int_bitmask b) const
{
wide_int_bitmask ret (low | b.low, high | b.high);
return ret;
}
inline wide_int_bitmask
wide_int_bitmask::operator & (wide_int_bitmask b) const
{
wide_int_bitmask ret (low & b.low, high & b.high);
return ret;
}
inline wide_int_bitmask
wide_int_bitmask::operator << (int amount)
{
wide_int_bitmask ret;
if (amount >= 64)
{
ret.low = 0;
ret.high = low << (amount - 64);
}
else if (amount == 0)
ret = *this;
else
{
ret.low = low << amount;
ret.high = (low >> (64 - amount)) | (high << amount);
}
return ret;
}
inline wide_int_bitmask
wide_int_bitmask::operator >> (int amount)
{
wide_int_bitmask ret;
if (amount >= 64)
{
ret.low = high >> (amount - 64);
ret.high = 0;
}
else if (amount == 0)
ret = *this;
else
{
ret.low = (high << (64 - amount)) | (low >> amount);
ret.high = high >> amount;
}
return ret;
}
inline bool
wide_int_bitmask::operator == (wide_int_bitmask b) const
{
return low == b.low && high == b.high;
}
inline bool
wide_int_bitmask::operator != (wide_int_bitmask b) const
{
return low != b.low || high != b.high;
}
#endif /* ! GCC_WIDE_INT_BITMASK_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment