1 // { dg-do compile { target i?86-*-* x86_64-*-* } }
2 // { dg-options "-std=c++11 -O3 -msse2 -mno-avx -fno-exceptions -fno-rtti -fdump-rtl-final" }
4 typedef unsigned int size_type;
6 #define _GLIBCXX_BITSET_BITS_PER_WORD (__CHAR_BIT__ * __SIZEOF_INT__)
7 #define _GLIBCXX_BITSET_WORDS(__n) \
8 ((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \
9 ((__n) % _GLIBCXX_BITSET_BITS_PER_WORD == 0 ? 0 : 1))
13 template<size_type _Nw>
16 typedef unsigned int _WordT;
21 { return _M_w[_Nw - 1]; }
24 _M_do_and(const _Base_bitset<_Nw>& __x)
26 for (size_type __i = 0; __i < _Nw; __i++)
27 _M_w[__i] &= __x._M_w[__i];
33 for (size_type __i = 0; __i < _Nw; __i++)
34 _M_w[__i] = ~_M_w[__i];
38 _M_is_equal(const _Base_bitset<_Nw>& __x) const
40 for (size_type __i = 0; __i < _Nw; ++__i)
41 if (_M_w[__i] != __x._M_w[__i])
49 for (size_type __i = 0; __i < _Nw; __i++)
50 if (_M_w[__i] != static_cast<_WordT>(0))
56 template<size_type _Extrabits>
59 typedef unsigned int _WordT;
62 _S_do_sanitize(_WordT& __val)
63 { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); }
66 template<size_type _Nb>
68 : private _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)>
71 typedef _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> _Base;
72 typedef unsigned int _WordT;
77 typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type;
78 __sanitize_type::_S_do_sanitize(this->_M_hiword());
93 *_M_wp ^= _Base::_S_maskbit(_M_bpos);
99 operator&=(const bitset<_Nb>& __rhs)
101 this->_M_do_and(__rhs);
109 this->_M_do_sanitize();
115 { return bitset<_Nb>(*this).flip(); }
118 operator==(const bitset<_Nb>& __rhs) const
119 { return this->_M_is_equal(__rhs); }
123 { return this->_M_is_any(); }
126 template<size_type _Nb>
128 operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
130 bitset<_Nb> __result(__x);
138 typedef const T *iterator;
145 iterator begin() const { return Data; }
146 iterator end() const { return Data + Length; }
149 const unsigned MAX_SUBTARGET_FEATURES = 128;
150 class FeatureBitset : public std::bitset<MAX_SUBTARGET_FEATURES> {
153 struct SubtargetFeatureKV {
155 FeatureBitset Implies;
158 struct SubtargetInfoKV {
161 class SubtargetFeatures {
163 FeatureBitset ToggleFeature(FeatureBitset Bits,
164 const SubtargetFeatureKV *,
165 ArrayRef<SubtargetFeatureKV> FeatureTable);
169 void ClearImpliedBits(FeatureBitset &Bits,
170 const SubtargetFeatureKV *FeatureEntry,
171 ArrayRef<SubtargetFeatureKV> FeatureTable) {
172 for (auto &FE : FeatureTable) {
173 if ((FE.Implies & FeatureEntry->Value).any()) {
175 ClearImpliedBits(Bits, &FE, FeatureTable);
181 SubtargetFeatures::ToggleFeature(FeatureBitset Bits,
182 const SubtargetFeatureKV *FeatureEntry,
183 ArrayRef<SubtargetFeatureKV> FeatureTable) {
184 if ((Bits & FeatureEntry->Value) == FeatureEntry->Value) {
185 Bits &= ~FeatureEntry->Value;
186 ClearImpliedBits(Bits, FeatureEntry, FeatureTable);
191 // { dg-final { scan-rtl-dump-not "S16 A32\[^\n\]*\\\*xorv4si3" "final" } }