$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r84291 - in trunk/libs/log: build config config/message-compiler config/x86-ext
From: andrey.semashev_at_[hidden]
Date: 2013-05-15 15:09:32
Author: andysem
Date: 2013-05-15 15:09:30 EDT (Wed, 15 May 2013)
New Revision: 84291
URL: http://svn.boost.org/trac/boost/changeset/84291
Log:
To resolve problems with some testers that have non-numeric toolset versions compiler checks for SSSE3/AVX2 support have been reworked. The checks now use configure framework instead of relying on compiler version checks.
Added:
   trunk/libs/log/config/message-compiler/
   trunk/libs/log/config/message-compiler/Jamfile.jam
      - copied, changed from r84290, /trunk/libs/log/config/Jamfile.jam
   trunk/libs/log/config/x86-ext/
   trunk/libs/log/config/x86-ext/Jamfile.jam   (contents, props changed)
   trunk/libs/log/config/x86-ext/avx2.cpp   (contents, props changed)
   trunk/libs/log/config/x86-ext/ssse3.cpp   (contents, props changed)
Removed:
   trunk/libs/log/config/Jamfile.jam
Text files modified: 
   trunk/libs/log/build/Jamfile.v2                    |   128 ++++++++++----------------------------- 
   trunk/libs/log/config/message-compiler/Jamfile.jam |     2                                         
   2 files changed, 34 insertions(+), 96 deletions(-)
Modified: trunk/libs/log/build/Jamfile.v2
==============================================================================
--- trunk/libs/log/build/Jamfile.v2	(original)
+++ trunk/libs/log/build/Jamfile.v2	2013-05-15 15:09:30 EDT (Wed, 15 May 2013)
@@ -11,8 +11,6 @@
 import path ;
 import project ;
 import feature ;
-import version ;
-import property ;
 import configure ;
 import log-architecture ;
 using mc ;
@@ -20,7 +18,10 @@
 local here = [ modules.binding $(__name__) ] ;
 
 project.push-current [ project.current ] ;
-project.load [ path.join [ path.make $(here:D) ] ../config ] ;
+project.load [ path.join [ path.make $(here:D) ] ../config/message-compiler ] ;
+project.pop-current ;
+project.push-current [ project.current ] ;
+project.load [ path.join [ path.make $(here:D) ] ../config/x86-ext ] ;
 project.pop-current ;
 
 lib psapi ;
@@ -170,70 +171,32 @@
 
     if <log-architecture>x86 in [ log-architecture.deduce-architecture $(properties) ]
     {
-        if <toolset>gcc in $(properties)
+        local has_ssse3 = [ configure.builds /boost/x86-extensions//ssse3 : $(properties) : compiler-supports-ssse3 ] ;
+        if $(has_ssse3)
         {
-            local string_version = [ feature.get-values "toolset-gcc:version" : $(properties) ] ;
-            local version = [ SPLIT_BY_CHARACTERS $(string_version) : "." ] ;
-
-            if ! [ version.version-less $(version) : 4 3 ]
+            result = ;
+            if <toolset>gcc in $(properties) || <toolset>clang in $(properties)
             {
                 result = <cxxflags>"-march=core2 -msse -msse2 -msse3 -mssse3" ;
             }
-        }
-        else if <toolset>msvc in $(properties)
-        {
-            local string_version = [ feature.get-values "toolset-msvc:version" : $(properties) ] ;
-            local version = [ SPLIT_BY_CHARACTERS $(string_version) : "." ] ;
-
-            if ! [ version.version-less $(version) : 9 0 ]
+            else if <toolset>intel in $(properties)
             {
-                # MSVC doesn't really care about these switches, all SSE intrinsics are always available, but still...
-                # Also 64 bit MSVC doesn't have the /arch:SSE2 switch as it is the default.
-                if <log-address-model>32 in [ log-architecture.deduce-address-model $(properties) ]
+                if <toolset-intel:platform>win in $(properties)
                 {
-                    result = <cxxflags>"/arch:SSE2" ;
+                    result = <cxxflags>"/QxSSSE3" ;
                 }
                 else
                 {
-                    result = ;
+                    result = <cxxflags>"-march=core2 -msse -msse2 -msse3 -mssse3" ;
                 }
             }
-        }
-        else if <toolset>clang in $(properties)
-        {
-            local string_version = [ feature.get-values "toolset-clang:version" : $(properties) ] ;
-            local version = [ SPLIT_BY_CHARACTERS $(string_version) : "." ] ;
-
-            # I don't know which version started to support SSSE3, but we don't support versions before 3.2 anyway and it has support for SSSE3
-            if ! [ version.version-less $(version) : 3 2 ]
-            {
-                result = <cxxflags>"-march=core2 -msse -msse2 -msse3 -mssse3" ;
-            }
-        }
-        else if <toolset>intel in $(properties)
-        {
-            local string_version = [ feature.get-values "toolset-intel:version" : $(properties) ] ;
-            if $(string_version)
+            else if <toolset>msvc in $(properties)
             {
-                local version = [ SPLIT_BY_CHARACTERS $(string_version) : "." ] ;
-
-                if ! [ version.version-less $(version) : 10 0 ]
+                # MSVC doesn't really care about these switches, all SSE intrinsics are always available, but still...
+                # Also 64 bit MSVC doesn't have the /arch:SSE2 switch as it is the default.
+                if <log-address-model>32 in [ log-architecture.deduce-address-model $(properties) ]
                 {
-                    if <toolset-intel:platform>win in $(properties)
-                    {
-                        if ! [ version.version-less $(version) : 11 0 ]
-                        {
-                            result = <cxxflags>"/QxSSSE3" ;
-                        }
-                        else
-                        {
-                            result = <cxxflags>"/QxT" ;
-                        }
-                    }
-                    else
-                    {
-                        result = <cxxflags>"-march=core2 -msse -msse2 -msse3 -mssse3" ;
-                    }
+                    result = <cxxflags>"/arch:SSE2" ;
                 }
             }
         }
@@ -270,58 +233,33 @@
 
     if <log-architecture>x86 in [ log-architecture.deduce-architecture $(properties) ]
     {
-        if <toolset>gcc in $(properties)
+        local has_ssse3 = [ configure.builds /boost/x86-extensions//avx2 : $(properties) : compiler-supports-avx2 ] ;
+        if $(has_ssse3)
         {
-            local string_version = [ feature.get-values "toolset-gcc:version" : $(properties) ] ;
-            local version = [ SPLIT_BY_CHARACTERS $(string_version) : "." ] ;
-
-            if ! [ version.version-less $(version) : 4 7 ]
+            result = ;
+            if <toolset>gcc in $(properties)
             {
                 result = <cxxflags>"-march=core-avx2 -mavx -mavx2 -fabi-version=0" ;
             }
-        }
-        else if <toolset>msvc in $(properties)
-        {
-            local string_version = [ feature.get-values "toolset-msvc:version" : $(properties) ] ;
-            local version = [ SPLIT_BY_CHARACTERS $(string_version) : "." ] ;
-
-            if ! [ version.version-less $(version) : 11 0 ]
-            {
-                result = <cxxflags>"/arch:AVX" ;
-            }
-        }
-        else if <toolset>clang in $(properties)
-        {
-            local string_version = [ feature.get-values "toolset-clang:version" : $(properties) ] ;
-            local version = [ SPLIT_BY_CHARACTERS $(string_version) : "." ] ;
-
-            # I don't know which version started to support AVX2, but we don't support versions before 3.2 anyway and it has support for AVX2
-            if ! [ version.version-less $(version) : 3 2 ]
+            else if <toolset>clang in $(properties)
             {
                 result = <cxxflags>"-march=core-avx2 -mavx -mavx2" ;
             }
-        }
-        else if <toolset>intel in $(properties)
-        {
-            local string_version = [ feature.get-values "toolset-intel:version" : $(properties) ] ;
-            if $(string_version)
+            else if <toolset>intel in $(properties)
             {
-                local version = [ SPLIT_BY_CHARACTERS $(string_version) : "." ] ;
-
-                # AVX2 support added in Composer XE 2011 Update 7, while the original Composer XE 2011 had icc version 12.
-                # I don't know what version Update 7 had, so to be on the safe side enable this optimization since version 13.
-                if ! [ version.version-less $(version) : 13 0 ]
+                if <toolset-intel:platform>win in $(properties)
+                {
+                    result = <cxxflags>"/QxAVX2" ;
+                }
+                else
                 {
-                    if <toolset-intel:platform>win in $(properties)
-                    {
-                        result = <cxxflags>"/QxAVX2" ;
-                    }
-                    else
-                    {
-                        result = <cxxflags>"-march=core-avx2 -mavx -mavx2 -fabi-version=0" ;
-                    }
+                    result = <cxxflags>"-march=core-avx2 -mavx -mavx2 -fabi-version=0" ;
                 }
             }
+            else if <toolset>msvc in $(properties)
+            {
+                result = <cxxflags>"/arch:AVX" ;
+            }
         }
     }
 
Deleted: trunk/libs/log/config/Jamfile.jam
==============================================================================
--- trunk/libs/log/config/Jamfile.jam	2013-05-15 15:09:30 EDT (Wed, 15 May 2013)
+++ (empty file)
@@ -1,20 +0,0 @@
-#
-#          Copyright Andrey Semashev 2007 - 2013.
-# Distributed under the Boost Software License, Version 1.0.
-#    (See accompanying file LICENSE_1_0.txt or copy at
-#          http://www.boost.org/LICENSE_1_0.txt)
-#
-
-import project ;
-using mc ;
-
-project /boost/message-compiler
-    : source-location ../src
-    : requirements
-        <pch>off
-    ;
-
-obj simple_event_log : simple_event_log.mc ;
-
-# This test target verifies that Message Compiler (mc) is available and supported by the current toolset
-alias test-availability : simple_event_log ;
Copied: trunk/libs/log/config/message-compiler/Jamfile.jam (from r84290, /trunk/libs/log/config/Jamfile.jam)
==============================================================================
--- /trunk/libs/log/config/Jamfile.jam	(original)
+++ trunk/libs/log/config/message-compiler/Jamfile.jam	2013-05-15 15:09:30 EDT (Wed, 15 May 2013)
@@ -9,7 +9,7 @@
 using mc ;
 
 project /boost/message-compiler
-    : source-location ../src
+    : source-location ../../src
     : requirements
         <pch>off
     ;
Added: trunk/libs/log/config/x86-ext/Jamfile.jam
==============================================================================
--- (empty file)
+++ trunk/libs/log/config/x86-ext/Jamfile.jam	2013-05-15 15:09:30 EDT (Wed, 15 May 2013)
@@ -0,0 +1,34 @@
+#
+#          Copyright Andrey Semashev 2007 - 2013.
+# Distributed under the Boost Software License, Version 1.0.
+#    (See accompanying file LICENSE_1_0.txt or copy at
+#          http://www.boost.org/LICENSE_1_0.txt)
+#
+
+import project ;
+
+project /boost/x86-extensions
+    : source-location .
+    : requirements
+        <pch>off
+    ;
+
+obj ssse3 : ssse3.cpp
+    :
+        <toolset>gcc:<cxxflags>"-march=core2 -msse -msse2 -msse3 -mssse3"
+        <toolset>clang:<cxxflags>"-march=core2 -msse -msse2 -msse3 -mssse3"
+        <toolset>intel-linux:<cxxflags>"-march=core2 -msse -msse2 -msse3 -mssse3"
+        <toolset>intel-darwin:<cxxflags>"-march=core2 -msse -msse2 -msse3 -mssse3"
+        <toolset>intel-win:<cxxflags>"/QxSSSE3"
+    ;
+
+obj avx2 : avx2.cpp
+    :
+        <toolset>gcc:<cxxflags>"-march=core-avx2 -mavx -mavx2 -fabi-version=0"
+        <toolset>clang:<cxxflags>"-march=core-avx2 -mavx -mavx2"
+        <toolset>intel-linux:<cxxflags>"-march=core-avx2 -mavx -mavx2 -fabi-version=0"
+        <toolset>intel-darwin:<cxxflags>"-march=core-avx2 -mavx -mavx2 -fabi-version=0"
+        <toolset>intel-win:<cxxflags>"/QxAVX2"
+        <toolset>msvc:<cxxflags>"/arch:AVX"
+    ;
+
Added: trunk/libs/log/config/x86-ext/avx2.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/log/config/x86-ext/avx2.cpp	2013-05-15 15:09:30 EDT (Wed, 15 May 2013)
@@ -0,0 +1,16 @@
+/*
+ *          Copyright Andrey Semashev 2007 - 2013.
+ * Distributed under the Boost Software License, Version 1.0.
+ *    (See accompanying file LICENSE_1_0.txt or copy at
+ *          http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#include <immintrin.h>
+
+int main(int, char*[])
+{
+    __m256i mm = _mm256_setzero_si256();
+    mm = _mm256_shuffle_epi8(_mm256_alignr_epi8(mm, mm, 10), mm);
+    _mm256_zeroupper();
+    return 0;
+}
Added: trunk/libs/log/config/x86-ext/ssse3.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/log/config/x86-ext/ssse3.cpp	2013-05-15 15:09:30 EDT (Wed, 15 May 2013)
@@ -0,0 +1,15 @@
+/*
+ *          Copyright Andrey Semashev 2007 - 2013.
+ * Distributed under the Boost Software License, Version 1.0.
+ *    (See accompanying file LICENSE_1_0.txt or copy at
+ *          http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#include <tmmintrin.h>
+
+int main(int, char*[])
+{
+    __m128i mm = _mm_setzero_si128();
+    mm = _mm_shuffle_epi8(_mm_alignr_epi8(mm, mm, 10), mm);
+    return 0;
+}