Ticket #9766: add_target_attribs.patch
File add_target_attribs.patch, 7.2 KB (added by , 8 years ago) |
---|
-
libs/log/src/dump_avx2.cpp
old new 22 22 #include <boost/log/detail/config.hpp> 23 23 #include <boost/log/detail/header.hpp> 24 24 25 #if ((BOOST_GCC + 0) / 100) >= 407 26 #define BOOST_LOG_AUX_TARGET_ATTRIB __attribute__((target("avx2,arch=core-avx2"))) 27 #else 28 #define BOOST_LOG_AUX_TARGET_ATTRIB 29 #endif 30 25 31 namespace boost { 26 32 27 33 BOOST_LOG_OPEN_NAMESPACE … … 59 65 * 60 66 * The composed string is placed as follows (in Intel notation): mm_output1[127:0], mm_output2[127:0], mm_output3[127:0], mm_output1[255:128], mm_output2[255:128], mm_output3[255:128]. 61 67 */ 62 static BOOST_FORCEINLINE void dump_pack(__m256i mm_char_10_to_a, __m256i mm_input, __m256i& mm_output1, __m256i& mm_output2, __m256i& mm_output3)68 static BOOST_FORCEINLINE BOOST_LOG_AUX_TARGET_ATTRIB void dump_pack(__m256i mm_char_10_to_a, __m256i mm_input, __m256i& mm_output1, __m256i& mm_output2, __m256i& mm_output3) 63 69 { 64 70 // Split half-bytes 65 71 const __m256i mm_15 = _mm256_set1_epi8(0x0F); … … 100 106 } 101 107 102 108 //! Dumps a pack of input data into a string of 8 bit ASCII characters 103 static BOOST_FORCEINLINE void dump_pack(__m256i mm_char_10_to_a, __m128i mm_input, __m128i& mm_output1, __m128i& mm_output2, __m128i& mm_output3)109 static BOOST_FORCEINLINE BOOST_LOG_AUX_TARGET_ATTRIB void dump_pack(__m256i mm_char_10_to_a, __m128i mm_input, __m128i& mm_output1, __m128i& mm_output2, __m128i& mm_output3) 104 110 { 105 111 // Split half-bytes 106 112 __m128i mm_input_hi = _mm_srli_epi16(mm_input, 4); … … 127 133 } 128 134 129 135 template< typename CharT > 130 BOOST_FORCEINLINE void store_characters(__m128i mm_chars, CharT* buf)136 BOOST_FORCEINLINE BOOST_LOG_AUX_TARGET_ATTRIB void store_characters(__m128i mm_chars, CharT* buf) 131 137 { 132 138 switch (sizeof(CharT)) 133 139 { … … 150 156 } 151 157 152 158 template< typename CharT > 153 BOOST_FORCEINLINE void store_characters_x3(__m256i mm_chars1, __m256i mm_chars2, __m256i mm_chars3, CharT* buf)159 BOOST_FORCEINLINE BOOST_LOG_AUX_TARGET_ATTRIB void store_characters_x3(__m256i mm_chars1, __m256i mm_chars2, __m256i mm_chars3, CharT* buf) 154 160 { 155 161 store_characters(_mm256_castsi256_si128(mm_chars1), buf); 156 162 store_characters(_mm256_castsi256_si128(mm_chars2), buf + 16); … … 161 167 } 162 168 163 169 template< typename CharT > 164 BOOST_FORCEINLINE void dump_data_avx2(const void* data, std::size_t size, std::basic_ostream< CharT >& strm)170 BOOST_FORCEINLINE BOOST_LOG_AUX_TARGET_ATTRIB void dump_data_avx2(const void* data, std::size_t size, std::basic_ostream< CharT >& strm) 165 171 { 166 172 typedef CharT char_type; 167 173 … … 205 211 __m256i mm_input = _mm256_load_si256(reinterpret_cast< const __m256i* >(p)); 206 212 __m256i mm_output1, mm_output2, mm_output3; 207 213 dump_pack(mm_char_10_to_a, mm_input, mm_output1, mm_output2, mm_output3); 208 store_characters_x3(mm_output1, mm_output2, mm_output3, b uf);214 store_characters_x3(mm_output1, mm_output2, mm_output3, b); 209 215 } 210 216 211 217 _mm256_zeroall(); // need to zero all ymm registers to avoid register spills/restores the compler generates around the function call … … 245 251 246 252 } // namespace 247 253 248 void dump_data_char_avx2(const void* data, std::size_t size, std::basic_ostream< char >& strm)254 BOOST_LOG_AUX_TARGET_ATTRIB void dump_data_char_avx2(const void* data, std::size_t size, std::basic_ostream< char >& strm) 249 255 { 250 256 if (size >= 32) 251 257 { … … 257 263 } 258 264 } 259 265 260 void dump_data_wchar_avx2(const void* data, std::size_t size, std::basic_ostream< wchar_t >& strm)266 BOOST_LOG_AUX_TARGET_ATTRIB void dump_data_wchar_avx2(const void* data, std::size_t size, std::basic_ostream< wchar_t >& strm) 261 267 { 262 268 if (size >= 32) 263 269 { … … 270 276 } 271 277 272 278 #if !defined(BOOST_NO_CXX11_CHAR16_T) 273 void dump_data_char16_avx2(const void* data, std::size_t size, std::basic_ostream< char16_t >& strm)279 BOOST_LOG_AUX_TARGET_ATTRIB void dump_data_char16_avx2(const void* data, std::size_t size, std::basic_ostream< char16_t >& strm) 274 280 { 275 281 if (size >= 32) 276 282 { … … 284 290 #endif 285 291 286 292 #if !defined(BOOST_NO_CXX11_CHAR32_T) 287 void dump_data_char32_avx2(const void* data, std::size_t size, std::basic_ostream< char32_t >& strm)293 BOOST_LOG_AUX_TARGET_ATTRIB void dump_data_char32_avx2(const void* data, std::size_t size, std::basic_ostream< char32_t >& strm) 288 294 { 289 295 if (size >= 32) 290 296 { -
libs/log/src/dump_ssse3.cpp
old new 22 22 #include <boost/log/detail/config.hpp> 23 23 #include <boost/log/detail/header.hpp> 24 24 25 #if ((BOOST_GCC + 0) / 100) >= 405 26 #define BOOST_LOG_AUX_TARGET_ATTRIB __attribute__((target("ssse3,arch=core2"))) 27 #else 28 #define BOOST_LOG_AUX_TARGET_ATTRIB 29 #endif 30 25 31 namespace boost { 26 32 27 33 BOOST_LOG_OPEN_NAMESPACE … … 57 63 static const xmm_constant mm_shuffle_pattern3 = {{ 5, 0x80, 6, 7, 0x80, 8, 9, 0x80, 10, 11, 0x80, 12, 13, 0x80, 14, 15 }}; 58 64 59 65 //! Dumps a pack of input data into a string of 8 bit ASCII characters 60 static BOOST_FORCEINLINE void dump_pack(__m128i mm_char_10_to_a, __m128i mm_input, __m128i& mm_output1, __m128i& mm_output2, __m128i& mm_output3)66 static BOOST_FORCEINLINE BOOST_LOG_AUX_TARGET_ATTRIB void dump_pack(__m128i mm_char_10_to_a, __m128i mm_input, __m128i& mm_output1, __m128i& mm_output2, __m128i& mm_output3) 61 67 { 62 68 // Split half-bytes 63 69 __m128i mm_input_hi = _mm_and_si128(_mm_srli_epi16(mm_input, 4), mm_15.as_mm); … … 95 101 } 96 102 97 103 template< typename CharT > 98 BOOST_FORCEINLINE void store_characters(__m128i mm_chars, CharT* buf)104 BOOST_FORCEINLINE BOOST_LOG_AUX_TARGET_ATTRIB void store_characters(__m128i mm_chars, CharT* buf) 99 105 { 100 106 switch (sizeof(CharT)) 101 107 { … … 126 132 } 127 133 128 134 template< typename CharT > 129 BOOST_FORCEINLINE void dump_data_ssse3(const void* data, std::size_t size, std::basic_ostream< CharT >& strm)135 BOOST_FORCEINLINE BOOST_LOG_AUX_TARGET_ATTRIB void dump_data_ssse3(const void* data, std::size_t size, std::basic_ostream< CharT >& strm) 130 136 { 131 137 typedef CharT char_type; 132 138 … … 210 216 211 217 } // namespace 212 218 213 void dump_data_char_ssse3(const void* data, std::size_t size, std::basic_ostream< char >& strm)219 BOOST_LOG_AUX_TARGET_ATTRIB void dump_data_char_ssse3(const void* data, std::size_t size, std::basic_ostream< char >& strm) 214 220 { 215 221 if (size >= 16) 216 222 { … … 222 228 } 223 229 } 224 230 225 void dump_data_wchar_ssse3(const void* data, std::size_t size, std::basic_ostream< wchar_t >& strm)231 BOOST_LOG_AUX_TARGET_ATTRIB void dump_data_wchar_ssse3(const void* data, std::size_t size, std::basic_ostream< wchar_t >& strm) 226 232 { 227 233 if (size >= 16) 228 234 { … … 235 241 } 236 242 237 243 #if !defined(BOOST_NO_CXX11_CHAR16_T) 238 void dump_data_char16_ssse3(const void* data, std::size_t size, std::basic_ostream< char16_t >& strm)244 BOOST_LOG_AUX_TARGET_ATTRIB void dump_data_char16_ssse3(const void* data, std::size_t size, std::basic_ostream< char16_t >& strm) 239 245 { 240 246 if (size >= 16) 241 247 { … … 249 255 #endif 250 256 251 257 #if !defined(BOOST_NO_CXX11_CHAR32_T) 252 void dump_data_char32_ssse3(const void* data, std::size_t size, std::basic_ostream< char32_t >& strm)258 BOOST_LOG_AUX_TARGET_ATTRIB void dump_data_char32_ssse3(const void* data, std::size_t size, std::basic_ostream< char32_t >& strm) 253 259 { 254 260 if (size >= 16) 255 261 {