Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Mar 2014 20:20:13 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Jakub Lach <jakub_lach@mailplus.pl>
Cc:        office@FreeBSD.org, freebsd-stable stable <freebsd-stable@freebsd.org>
Subject:   Re: HEADS UP: merged llvm/clang 3.4
Message-ID:  <B63450E2-1C3F-4E24-864B-CC2A113BBB53@FreeBSD.org>
In-Reply-To: <1395500548609-5896580.post@n5.nabble.com>
References:  <0E7E81A1-54E9-4920-A360-005A1C0C4D47@FreeBSD.org> <1395476852973-5896505.post@n5.nabble.com> <76A1AA7F-E526-4481-B04D-0405D3090D93@FreeBSD.org> <1395489997493-5896543.post@n5.nabble.com> <DAFFF16E-367E-4B2F-9710-8C85487C2E19@FreeBSD.org> <1395500548609-5896580.post@n5.nabble.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_B380A56A-FB2C-446F-9693-1680D28BF89D
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_CCDEBEAC-A3A5-4AB2-84DC-E651D4F19DB4"


--Apple-Mail=_CCDEBEAC-A3A5-4AB2-84DC-E651D4F19DB4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

On 22 Mar 2014, at 16:02, Jakub Lach <jakub_lach@mailplus.pl> wrote:
> I'm now testing with CPUTYPE?=3Dcore2 which translates to =
-march=3Dcore2,=20
> however I would like to emphasize, that previously it was set as =
native,=20
> I was not forcing (faulty?) penryn march.=20
>=20
> It should just autodetect CPU features (at least that was how GCC =
worked
> iirc- it used multiple flags for all features detected, not a single =
march)?

Yes, it auto-detects, if you use -march=3Dnative.  If you have a Penryn,
you have SSE4.1 support, which is more than "plain" Core2 does, e.g.
SSSE3.


> ... core2 fails the same way, now I will try sans CPUTYPE.

After some sleuthing, it turns out this is a bug in boost, when 128-bit
types are represented as a struct.  See this upstream commit:

=
https://github.com/boostorg/atomic/commit/e4bde20f2eec0a51be14533871d2123b=
d2ab9cf3

To fix it, drop the attached patch in /usr/ports/devel/boost-libs/files.
I tried this with CPUTYPE=3Dpenryn, and it worked for me.

I have cc'd the boost port maintainers, so I hope they can add this
patch soon. :)

-Dimitry


--Apple-Mail=_CCDEBEAC-A3A5-4AB2-84DC-E651D4F19DB4
Content-Disposition: attachment;
	filename=patch-boost__atomic__detail__gcc-atomic.hpp
Content-Type: application/octet-stream;
	name="patch-boost__atomic__detail__gcc-atomic.hpp"
Content-Transfer-Encoding: 7bit

--- boost/atomic/detail/gcc-atomic.hpp.orig	2013-07-20 20:01:35.000000000 +0200
+++ boost/atomic/detail/gcc-atomic.hpp	2014-03-22 20:05:04.000000000 +0100
@@ -958,14 +958,16 @@
 
 public:
     BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
-    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
     {
+        memset(&v_, 0, sizeof(v_));
         memcpy(&v_, &v, sizeof(value_type));
     }
 
     void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
     {
-        storage_type tmp = 0;
+        storage_type tmp;
+        memset(&tmp, 0, sizeof(tmp));
         memcpy(&tmp, &v, sizeof(value_type));
         __atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
     }
@@ -980,7 +982,8 @@
 
     value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
     {
-        storage_type tmp = 0;
+        storage_type tmp;
+        memset(&tmp, 0, sizeof(tmp));
         memcpy(&tmp, &v, sizeof(value_type));
         tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
         value_type res;
@@ -994,7 +997,9 @@
         memory_order success_order,
         memory_order failure_order) volatile BOOST_NOEXCEPT
     {
-        storage_type expected_s = 0, desired_s = 0;
+        storage_type expected_s, desired_s;
+        memset(&expected_s, 0, sizeof(expected_s));
+        memset(&desired_s, 0, sizeof(desired_s));
         memcpy(&expected_s, &expected, sizeof(value_type));
         memcpy(&desired_s, &desired, sizeof(value_type));
         const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false,
@@ -1010,7 +1015,9 @@
         memory_order success_order,
         memory_order failure_order) volatile BOOST_NOEXCEPT
     {
-        storage_type expected_s = 0, desired_s = 0;
+        storage_type expected_s, desired_s;
+        memset(&expected_s, 0, sizeof(expected_s));
+        memset(&desired_s, 0, sizeof(desired_s));
         memcpy(&expected_s, &expected, sizeof(value_type));
         memcpy(&desired_s, &desired, sizeof(value_type));
         const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true,

--Apple-Mail=_CCDEBEAC-A3A5-4AB2-84DC-E651D4F19DB4
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii



--Apple-Mail=_CCDEBEAC-A3A5-4AB2-84DC-E651D4F19DB4--

--Apple-Mail=_B380A56A-FB2C-446F-9693-1680D28BF89D
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)

iEYEARECAAYFAlMt4noACgkQsF6jCi4glqP9JwCcC+fd+LCAMIKrhaG3ChaonqtX
51MAnRq8kbMLQb7IwI3+g+KbV32HWB/u
=JlzE
-----END PGP SIGNATURE-----

--Apple-Mail=_B380A56A-FB2C-446F-9693-1680D28BF89D--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B63450E2-1C3F-4E24-864B-CC2A113BBB53>