From 99c61ce7e41c0bb0fd81e24ad8f06b2f5fa455e0 Mon Sep 17 00:00:00 2001 From: Alex Voicu Date: Mon, 25 Jun 2018 22:59:07 +0100 Subject: [PATCH] Be nice to GCC, it is old and worthy of respect. --- include/hip/hcc_detail/hip_vector_types.h | 41 +++++++++-------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/include/hip/hcc_detail/hip_vector_types.h b/include/hip/hcc_detail/hip_vector_types.h index 704ff7e550..7c12bda0a5 100644 --- a/include/hip/hcc_detail/hip_vector_types.h +++ b/include/hip/hcc_detail/hip_vector_types.h @@ -55,8 +55,7 @@ THE SOFTWARE. union { Native_vec_ data; struct { - typename std::decay< - decltype(std::declval().x)>::type x; + T x; }; }; }; @@ -68,10 +67,8 @@ THE SOFTWARE. union { Native_vec_ data; struct { - typename std::decay< - decltype(std::declval().x)>::type x; - typename std::decay< - decltype(std::declval().y)>::type y; + T x; + T y; }; }; }; @@ -83,12 +80,9 @@ THE SOFTWARE. union { Native_vec_ data; struct { - typename std::decay< - decltype(std::declval().x)>::type x; - typename std::decay< - decltype(std::declval().y)>::type y; - typename std::decay< - decltype(std::declval().z)>::type z; + T x; + T y; + T z; }; }; }; @@ -100,14 +94,10 @@ THE SOFTWARE. union { Native_vec_ data; struct { - typename std::decay< - decltype(std::declval().x)>::type x; - typename std::decay< - decltype(std::declval().y)>::type y; - typename std::decay< - decltype(std::declval().z)>::type z; - typename std::decay< - decltype(std::declval().w)>::type w; + T x; + T y; + T z; + T w; }; }; }; @@ -125,7 +115,10 @@ THE SOFTWARE. std::is_convertible{}>::type* = nullptr> __host__ __device__ explicit - HIP_vector_type(U x) noexcept { data = Native_vec_(x); } + HIP_vector_type(U x) noexcept + { + for (auto i = 0u; i != rank; ++i) data[i] = x; + } template< // TODO: constrain based on type as well. typename... Us, typename std::enable_if::type* = nullptr> @@ -147,8 +140,7 @@ THE SOFTWARE. __host__ __device__ HIP_vector_type& operator++() noexcept { - data += Native_vec_(1); - return *this; + return *this += HIP_vector_type{1}; } __host__ __device__ HIP_vector_type operator++(int) noexcept @@ -160,8 +152,7 @@ THE SOFTWARE. __host__ __device__ HIP_vector_type& operator--() noexcept { - data -= Native_vec_(1); - return *this; + return *this -= HIP_vector_type{1}; } __host__ __device__ HIP_vector_type operator--(int) noexcept