a1541628df
When looking at recog.o when working on the recog.[ch] changes to make sure I have not introduced runtime construction of recog_data variable, I have noticed that at least in unoptimized build, every single *.o file that included i386.h has lots of runtime constructors for all the PTA_* variables. As we now require C++11, the following patch makes those constexpr so that they don't need runtime initialization. I've verified that ~ 8276 bytes long _Z41__static_initialization_and_destruction_0ii at -O0 is gone from every *.o that included i386.h (and doesn't really need any global ctors anymore). 2021-02-18 Jakub Jelinek <jakub@redhat.com> * wide-int-bitmask.h (wide_int_bitmask::wide_int_bitmask (), wide_int_bitmask::wide_int_bitmask (uint64_t), wide_int_bitmask::wide_int_bitmask (uint64_t, uint64_t), wide_int_bitmask::operator ~ () const, wide_int_bitmask::operator | (wide_int_bitmask) const, wide_int_bitmask::operator & (wide_int_bitmask) const): Use constexpr instead of inline. * config/i386/i386.h (PTA_3DNOW, PTA_3DNOW_A, PTA_64BIT, PTA_ABM, PTA_AES, PTA_AVX, PTA_BMI, PTA_CX16, PTA_F16C, PTA_FMA, PTA_FMA4, PTA_FSGSBASE, PTA_LWP, PTA_LZCNT, PTA_MMX, PTA_MOVBE, PTA_NO_SAHF, PTA_PCLMUL, PTA_POPCNT, PTA_PREFETCH_SSE, PTA_RDRND, PTA_SSE, PTA_SSE2, PTA_SSE3, PTA_SSE4_1, PTA_SSE4_2, PTA_SSE4A, PTA_SSSE3, PTA_TBM, PTA_XOP, PTA_AVX2, PTA_BMI2, PTA_RTM, PTA_HLE, PTA_PRFCHW, PTA_RDSEED, PTA_ADX, PTA_FXSR, PTA_XSAVE, PTA_XSAVEOPT, PTA_AVX512F, PTA_AVX512ER, PTA_AVX512PF, PTA_AVX512CD, PTA_NO_TUNE, PTA_SHA, PTA_PREFETCHWT1, PTA_CLFLUSHOPT, PTA_XSAVEC, PTA_XSAVES, PTA_AVX512DQ, PTA_AVX512BW, PTA_AVX512VL, PTA_AVX512IFMA, PTA_AVX512VBMI, PTA_CLWB, PTA_MWAITX, PTA_CLZERO, PTA_NO_80387, PTA_PKU, PTA_AVX5124VNNIW, PTA_AVX5124FMAPS, PTA_AVX512VPOPCNTDQ, PTA_SGX, PTA_AVX512VNNI, PTA_GFNI, PTA_VAES, PTA_AVX512VBMI2, PTA_VPCLMULQDQ, PTA_AVX512BITALG, PTA_RDPID, PTA_PCONFIG, PTA_WBNOINVD, PTA_AVX512VP2INTERSECT, PTA_PTWRITE, PTA_AVX512BF16, PTA_WAITPKG, PTA_MOVDIRI, PTA_MOVDIR64B, PTA_ENQCMD, PTA_CLDEMOTE, PTA_SERIALIZE, PTA_TSXLDTRK, PTA_AMX_TILE, PTA_AMX_INT8, PTA_AMX_BF16, PTA_UINTR, PTA_HRESET, PTA_KL, PTA_WIDEKL, PTA_AVXVNNI, PTA_X86_64_BASELINE, PTA_X86_64_V2, PTA_X86_64_V3, PTA_X86_64_V4, PTA_CORE2, PTA_NEHALEM, PTA_WESTMERE, PTA_SANDYBRIDGE, PTA_IVYBRIDGE, PTA_HASWELL, PTA_BROADWELL, PTA_SKYLAKE, PTA_SKYLAKE_AVX512, PTA_CASCADELAKE, PTA_COOPERLAKE, PTA_CANNONLAKE, PTA_ICELAKE_CLIENT, PTA_ICELAKE_SERVER, PTA_TIGERLAKE, PTA_SAPPHIRERAPIDS, PTA_ALDERLAKE, PTA_KNL, PTA_BONNELL, PTA_SILVERMONT, PTA_GOLDMONT, PTA_GOLDMONT_PLUS, PTA_TREMONT, PTA_KNM): Use constexpr instead of const.
144 lines
3.3 KiB
C++
144 lines
3.3 KiB
C++
/* Operation with 128 bit bitmask.
|
|
Copyright (C) 2013-2021 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
|
|
|
|
class wide_int_bitmask
|
|
{
|
|
public:
|
|
constexpr wide_int_bitmask ();
|
|
constexpr wide_int_bitmask (uint64_t l);
|
|
constexpr 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);
|
|
constexpr wide_int_bitmask operator ~ () const;
|
|
constexpr wide_int_bitmask operator & (wide_int_bitmask) const;
|
|
constexpr 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;
|
|
};
|
|
|
|
constexpr
|
|
wide_int_bitmask::wide_int_bitmask ()
|
|
: low (0), high (0)
|
|
{
|
|
}
|
|
|
|
constexpr
|
|
wide_int_bitmask::wide_int_bitmask (uint64_t l)
|
|
: low (l), high (0)
|
|
{
|
|
}
|
|
|
|
constexpr
|
|
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;
|
|
}
|
|
|
|
constexpr wide_int_bitmask
|
|
wide_int_bitmask::operator ~ () const
|
|
{
|
|
return wide_int_bitmask (~low, ~high);
|
|
}
|
|
|
|
constexpr wide_int_bitmask
|
|
wide_int_bitmask::operator | (wide_int_bitmask b) const
|
|
{
|
|
return wide_int_bitmask (low | b.low, high | b.high);
|
|
}
|
|
|
|
constexpr wide_int_bitmask
|
|
wide_int_bitmask::operator & (wide_int_bitmask b) const
|
|
{
|
|
return wide_int_bitmask (low & b.low, high & b.high);
|
|
}
|
|
|
|
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 */
|