Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable /Wall with MSVC #167

Merged
merged 11 commits into from
Sep 22, 2023
29 changes: 28 additions & 1 deletion cmake/CMakeCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ macro(setup_default_compiler_flags _project_name)
if(MSVC) # That's also clang-cl
# Replace some default compiler switches and add new ones
STRING(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Bump warnings to W4
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR BUILD_BENCHMARK_EXE)
STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Enable level 4 warnings
else()
if(MSVC_VERSION GREATER 1920)
# VS2019 and above
STRING(REPLACE "/W3" "/Wall" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Enable all warnings
else()
STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Enable level 4 warnings
endif()
endif()
target_compile_options(${_project_name} PRIVATE /Zi) # Add debug info
target_compile_options(${_project_name} PRIVATE /Oi) # Generate intrinsic functions
target_compile_options(${_project_name} PRIVATE /WX) # Treat warnings as errors
Expand All @@ -27,6 +36,21 @@ macro(setup_default_compiler_flags _project_name)
add_definitions(-DRTM_NO_INTRINSICS)
endif()

# Disable various warnings that are harmless
target_compile_options(${_project_name} PRIVATE /wd4514) # Unreferenced inline function removed
target_compile_options(${_project_name} PRIVATE /wd4619) # No warning with specified number
target_compile_options(${_project_name} PRIVATE /wd4820) # Padding added after data member
target_compile_options(${_project_name} PRIVATE /wd4710) # Function not inlined
target_compile_options(${_project_name} PRIVATE /wd4711) # Function selected for automatic inlining
target_compile_options(${_project_name} PRIVATE /wd4738) # Storing 32-bit float in memory leads to rounding (x86)
target_compile_options(${_project_name} PRIVATE /wd4746) # Volatile access
target_compile_options(${_project_name} PRIVATE /wd5045) # Spectre mitigation for memory load

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(${_project_name} PRIVATE -Wno-c++98-compat) # No need to support C++98
target_compile_options(${_project_name} PRIVATE -Wno-c++98-compat-pedantic) # No need to support C++98
endif()

# Add linker flags
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG")
else()
Expand Down Expand Up @@ -65,6 +89,9 @@ macro(setup_default_compiler_flags _project_name)
target_compile_options(${_project_name} PRIVATE -Wshadow) # Enable shadowing warnings
target_compile_options(${_project_name} PRIVATE -Werror) # Treat warnings as errors

# Disable various warnings that are harmless
target_compile_options(${_project_name} PRIVATE -Wno-c++98-compat) # No need to support C++98

target_compile_options(${_project_name} PRIVATE -g) # Enable debug symbols
endif()
endmacro()
4 changes: 3 additions & 1 deletion includes/rtm/impl/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ RTM_IMPL_FILE_PRAGMA_PUSH

class runtime_assert final : public std::runtime_error
{
runtime_assert() = delete; // Default constructor not needed

using std::runtime_error::runtime_error; // Inherit constructors
};

Expand All @@ -137,7 +139,7 @@ RTM_IMPL_FILE_PRAGMA_PUSH
va_end(args);

if (count >= 0 && count < buffer_size)
throw runtime_assert(std::string(&buffer[0], count));
throw runtime_assert(std::string(&buffer[0], static_cast<std::string::size_type>(count)));
else
throw runtime_assert("Failed to format assert message!\n");
}
Expand Down
18 changes: 18 additions & 0 deletions includes/rtm/impl/macros.vector4.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,22 @@ RTM_IMPL_FILE_PRAGMA_PUSH
// Macros not defined for scalar code path
#endif

#if defined(RTM_SSE2_INTRINSICS)
#if defined(RTM_COMPILER_MSVC)
//////////////////////////////////////////////////////////////////////////
// Creates a vector constant from its 4 components
//////////////////////////////////////////////////////////////////////////
#define RTM_VECTOR4F_MAKE(x, y, z, w) { { x, y, z, w } }
#else
//////////////////////////////////////////////////////////////////////////
// Creates a vector constant from its 4 components
//////////////////////////////////////////////////////////////////////////
#define RTM_VECTOR4F_MAKE(x, y, z, w) { x, y, z, w }
#endif
#elif defined(RTM_NEON_INTRINSICS)
// RTM_VECTOR2D_SELECT not defined for NEON yet, TODO
#else
// Macros not defined for scalar code path
#endif

RTM_IMPL_FILE_PRAGMA_POP
20 changes: 10 additions & 10 deletions includes/rtm/impl/mask_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace rtm
const uint64_t z_mask = z ? 0xFFFFFFFFFFFFFFFFULL : 0;
const uint64_t w_mask = w ? 0xFFFFFFFFFFFFFFFFULL : 0;

return mask4d{ _mm_castsi128_pd(_mm_set_epi64x(y_mask, x_mask)), _mm_castsi128_pd(_mm_set_epi64x(w_mask, z_mask)) };
return mask4d{ _mm_castsi128_pd(_mm_set_epi64x(static_cast<int64_t>(y_mask), static_cast<int64_t>(x_mask))), _mm_castsi128_pd(_mm_set_epi64x(static_cast<int64_t>(w_mask), static_cast<int64_t>(z_mask))) };
#else
const uint64_t x_mask = x ? 0xFFFFFFFFFFFFFFFFULL : 0;
const uint64_t y_mask = y ? 0xFFFFFFFFFFFFFFFFULL : 0;
Expand All @@ -71,7 +71,7 @@ namespace rtm
const uint64_t z_mask = z ? 0xFFFFFFFFFFFFFFFFULL : 0;
const uint64_t w_mask = w ? 0xFFFFFFFFFFFFFFFFULL : 0;

return mask4q{ _mm_set_epi64x(y_mask, x_mask), _mm_set_epi64x(w_mask, z_mask) };
return mask4q{ _mm_set_epi64x(static_cast<int64_t>(y_mask), static_cast<int64_t>(x_mask)), _mm_set_epi64x(static_cast<int64_t>(w_mask), static_cast<int64_t>(z_mask)) };
#else
const uint64_t x_mask = x ? 0xFFFFFFFFFFFFFFFFULL : 0;
const uint64_t y_mask = y ? 0xFFFFFFFFFFFFFFFFULL : 0;
Expand All @@ -90,7 +90,7 @@ namespace rtm
const uint32_t w_mask = w ? 0xFFFFFFFFU : 0;

#if defined(RTM_SSE2_INTRINSICS)
return _mm_castsi128_ps(_mm_set_epi32(w_mask, z_mask, y_mask, x_mask));
return _mm_castsi128_ps(_mm_set_epi32(static_cast<int32_t>(w_mask), static_cast<int32_t>(z_mask), static_cast<int32_t>(y_mask), static_cast<int32_t>(x_mask)));
#elif defined(RTM_NEON_INTRINSICS)
float32x2_t V0 = vcreate_f32(((uint64_t)x_mask) | ((uint64_t)(y_mask) << 32));
float32x2_t V1 = vcreate_f32(((uint64_t)z_mask) | ((uint64_t)(w_mask) << 32));
Expand All @@ -108,7 +108,7 @@ namespace rtm
const uint32_t w_mask = w ? 0xFFFFFFFFU : 0;

#if defined(RTM_SSE2_INTRINSICS)
return _mm_set_epi32(w_mask, z_mask, y_mask, x_mask);
return _mm_set_epi32(static_cast<int32_t>(w_mask), static_cast<int32_t>(z_mask), static_cast<int32_t>(y_mask), static_cast<int32_t>(x_mask));
#elif defined(RTM_NEON_INTRINSICS)
uint32x2_t V0 = vcreate_u32(((uint64_t)x_mask) | ((uint64_t)(y_mask) << 32));
uint32x2_t V1 = vcreate_u32(((uint64_t)z_mask) | ((uint64_t)(w_mask) << 32));
Expand Down Expand Up @@ -146,7 +146,7 @@ namespace rtm
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator mask4f() const RTM_NO_EXCEPT
{
#if defined(RTM_SSE2_INTRINSICS)
return _mm_castsi128_ps(_mm_set_epi32(w, z, y, x));
return _mm_castsi128_ps(_mm_set_epi32(static_cast<int32_t>(w), static_cast<int32_t>(z), static_cast<int32_t>(y), static_cast<int32_t>(x)));
#elif defined(RTM_NEON_INTRINSICS)
float32x2_t V0 = vcreate_f32(((uint64_t)x) | ((uint64_t)(y) << 32));
float32x2_t V1 = vcreate_f32(((uint64_t)z) | ((uint64_t)(w) << 32));
Expand All @@ -159,7 +159,7 @@ namespace rtm
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator mask4i() const RTM_NO_EXCEPT
{
#if defined(RTM_SSE2_INTRINSICS)
return _mm_set_epi32(w, z, y, x);
return _mm_set_epi32(static_cast<int32_t>(w), static_cast<int32_t>(z), static_cast<int32_t>(y), static_cast<int32_t>(x));
#elif defined(RTM_NEON_INTRINSICS)
uint32x2_t V0 = vcreate_u32(((uint64_t)x) | ((uint64_t)(y) << 32));
uint32x2_t V1 = vcreate_u32(((uint64_t)z) | ((uint64_t)(w) << 32));
Expand Down Expand Up @@ -210,9 +210,9 @@ namespace rtm
const uint32_t z_mask = z ? 0xFFFFFFFFU : 0;
const uint32_t w_mask = w ? 0xFFFFFFFFU : 0;

return mask4d{ _mm_castsi128_pd(_mm_set_epi32(y_mask, y_mask, x_mask, x_mask)), _mm_castsi128_pd(_mm_set_epi32(w_mask, w_mask, z_mask, z_mask)) };
return mask4d{ _mm_castsi128_pd(_mm_set_epi32(static_cast<int32_t>(y_mask), static_cast<int32_t>(y_mask), static_cast<int32_t>(x_mask), static_cast<int32_t>(x_mask))), _mm_castsi128_pd(_mm_set_epi32(static_cast<int32_t>(w_mask), static_cast<int32_t>(w_mask), static_cast<int32_t>(z_mask), static_cast<int32_t>(z_mask))) };
#else
return mask4d{ _mm_castsi128_pd(_mm_set_epi64x(y, x)), _mm_castsi128_pd(_mm_set_epi64x(w, z)) };
return mask4d{ _mm_castsi128_pd(_mm_set_epi64x(static_cast<int64_t>(y), static_cast<int64_t>(x))), _mm_castsi128_pd(_mm_set_epi64x(static_cast<int64_t>(w), static_cast<int64_t>(z))) };
#endif
#else
return mask4d{ x, y, z, w };
Expand All @@ -235,9 +235,9 @@ namespace rtm
const uint32_t z_mask = z ? 0xFFFFFFFFU : 0;
const uint32_t w_mask = w ? 0xFFFFFFFFU : 0;

return mask4q{ _mm_set_epi32(y_mask, y_mask, x_mask, x_mask), _mm_set_epi32(w_mask, w_mask, z_mask, z_mask) };
return mask4q{ _mm_set_epi32(static_cast<int32_t>(y_mask), static_cast<int32_t>(y_mask), static_cast<int32_t>(x_mask), static_cast<int32_t>(x_mask)), _mm_set_epi32(static_cast<int32_t>(w_mask), static_cast<int32_t>(w_mask), static_cast<int32_t>(z_mask), static_cast<int32_t>(z_mask)) };
#else
return mask4q{ _mm_set_epi64x(y, x), _mm_set_epi64x(w, z) };
return mask4q{ _mm_set_epi64x(static_cast<int64_t>(y), static_cast<int64_t>(x)), _mm_set_epi64x(static_cast<int64_t>(w), static_cast<int64_t>(z)) };
#endif
#else
return mask4q{ x, y, z, w };
Expand Down
28 changes: 26 additions & 2 deletions includes/rtm/impl/matrix_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ namespace rtm
struct matrix_caster<matrix3x3f>
{
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix3x3f& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix3x3f&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}

matrix_caster(const matrix_caster&) = default;
matrix_caster& operator=(const matrix_caster&) = delete;

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT
{
Expand All @@ -61,7 +65,7 @@ namespace rtm

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x4f() const RTM_NO_EXCEPT
{
return matrix3x4f{ mtx.x_axis, mtx.y_axis, mtx.z_axis, vector_zero() };
return matrix3x4f{ mtx.x_axis, mtx.y_axis, mtx.z_axis, (vector4f)vector_zero() };
}

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x4d() const RTM_NO_EXCEPT
Expand All @@ -88,6 +92,10 @@ namespace rtm
struct matrix_caster<matrix3x3d>
{
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix3x3d& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix3x3d&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}

matrix_caster(const matrix_caster&) = default;
matrix_caster& operator=(const matrix_caster&) = delete;

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT
{
Expand All @@ -107,7 +115,7 @@ namespace rtm

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x4d() const RTM_NO_EXCEPT
{
return matrix3x4d{ mtx.x_axis, mtx.y_axis, mtx.z_axis, vector_zero() };
return matrix3x4d{ mtx.x_axis, mtx.y_axis, mtx.z_axis, (vector4d)vector_zero() };
}

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix4x4f() const RTM_NO_EXCEPT
Expand All @@ -128,6 +136,10 @@ namespace rtm
struct matrix_caster<matrix3x4f>
{
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix3x4f& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix3x4f&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}

matrix_caster(const matrix_caster&) = default;
matrix_caster& operator=(const matrix_caster&) = delete;

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT
{
Expand Down Expand Up @@ -170,6 +182,10 @@ namespace rtm
struct matrix_caster<matrix3x4d>
{
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix3x4d& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix3x4d&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}

matrix_caster(const matrix_caster&) = default;
matrix_caster& operator=(const matrix_caster&) = delete;

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT
{
Expand Down Expand Up @@ -212,6 +228,10 @@ namespace rtm
struct matrix_caster<matrix4x4f>
{
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix4x4f& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix4x4f&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}

matrix_caster(const matrix_caster&) = default;
matrix_caster& operator=(const matrix_caster&) = delete;

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT
{
Expand Down Expand Up @@ -250,6 +270,10 @@ namespace rtm
struct matrix_caster<matrix4x4d>
{
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix4x4d& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix4x4d&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {}

matrix_caster(const matrix_caster&) = default;
matrix_caster& operator=(const matrix_caster&) = delete;

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT
{
Expand Down
4 changes: 2 additions & 2 deletions includes/rtm/impl/qvs_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ namespace rtm
{
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator qvsd() const RTM_NO_EXCEPT
{
return qvsd{ quat_identity(), vector_set(0.0, 0.0, 0.0, 1.0) };
return qvsd{ (quatd)quat_identity(), vector_set(0.0, 0.0, 0.0, 1.0) };
}

RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator qvsf() const RTM_NO_EXCEPT
{
return qvsf{ quat_identity(), vector_set(0.0F, 0.0F, 0.0F, 1.0F) };
return qvsf{ (quatf)quat_identity(), vector_set(0.0F, 0.0F, 0.0F, 1.0F) };
}
};
}
Expand Down
16 changes: 8 additions & 8 deletions includes/rtm/mask4d.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ namespace rtm
{
#if defined(RTM_SSE2_INTRINSICS)
#if defined(RTM_ARCH_X64)
return _mm_cvtsi128_si64(_mm_castpd_si128(input.xy));
return static_cast<uint64_t>(_mm_cvtsi128_si64(_mm_castpd_si128(input.xy)));
#else
// Just sign extend on 32bit systems
return (uint64_t)_mm_cvtsi128_si32(_mm_castpd_si128(input.xy));
return static_cast<uint64_t>(_mm_cvtsi128_si32(_mm_castpd_si128(input.xy)));
#endif
#else
return input.x;
Expand All @@ -63,10 +63,10 @@ namespace rtm
{
#if defined(RTM_SSE2_INTRINSICS)
#if defined(RTM_ARCH_X64)
return _mm_cvtsi128_si64(_mm_castpd_si128(_mm_shuffle_pd(input.xy, input.xy, 1)));
return static_cast<uint64_t>(_mm_cvtsi128_si64(_mm_castpd_si128(_mm_shuffle_pd(input.xy, input.xy, 1))));
#else
// Just sign extend on 32bit systems
return (uint64_t)_mm_cvtsi128_si32(_mm_castpd_si128(_mm_shuffle_pd(input.xy, input.xy, 1)));
return static_cast<uint64_t>(_mm_cvtsi128_si32(_mm_castpd_si128(_mm_shuffle_pd(input.xy, input.xy, 1))));
#endif
#else
return input.y;
Expand All @@ -80,10 +80,10 @@ namespace rtm
{
#if defined(RTM_SSE2_INTRINSICS)
#if defined(RTM_ARCH_X64)
return _mm_cvtsi128_si64(_mm_castpd_si128(input.zw));
return static_cast<uint64_t>(_mm_cvtsi128_si64(_mm_castpd_si128(input.zw)));
#else
// Just sign extend on 32bit systems
return (uint64_t)_mm_cvtsi128_si32(_mm_castpd_si128(input.zw));
return static_cast<uint64_t>(_mm_cvtsi128_si32(_mm_castpd_si128(input.zw)));
#endif
#else
return input.z;
Expand All @@ -97,10 +97,10 @@ namespace rtm
{
#if defined(RTM_SSE2_INTRINSICS)
#if defined(RTM_ARCH_X64)
return _mm_cvtsi128_si64(_mm_castpd_si128(_mm_shuffle_pd(input.zw, input.zw, 1)));
return static_cast<uint64_t>(_mm_cvtsi128_si64(_mm_castpd_si128(_mm_shuffle_pd(input.zw, input.zw, 1))));
#else
// Just sign extend on 32bit systems
return (uint64_t)_mm_cvtsi128_si32(_mm_castpd_si128(_mm_shuffle_pd(input.zw, input.zw, 1)));
return static_cast<uint64_t>(_mm_cvtsi128_si32(_mm_castpd_si128(_mm_shuffle_pd(input.zw, input.zw, 1))));
#endif
#else
return input.w;
Expand Down
8 changes: 4 additions & 4 deletions includes/rtm/mask4f.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace rtm
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_x(mask4f_arg0 input) RTM_NO_EXCEPT
{
#if defined(RTM_SSE2_INTRINSICS)
return _mm_cvtsi128_si32(_mm_castps_si128(input));
return static_cast<uint32_t>(_mm_cvtsi128_si32(_mm_castps_si128(input)));
#elif defined(RTM_NEON_INTRINSICS)
return vgetq_lane_u32(vreinterpretq_u32_f32(input), 0);
#else
Expand All @@ -60,7 +60,7 @@ namespace rtm
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_y(mask4f_arg0 input) RTM_NO_EXCEPT
{
#if defined(RTM_SSE2_INTRINSICS)
return _mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(1, 1, 1, 1))));
return static_cast<uint32_t>(_mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(1, 1, 1, 1)))));
#elif defined(RTM_NEON_INTRINSICS)
return vgetq_lane_u32(vreinterpretq_u32_f32(input), 1);
#else
Expand All @@ -74,7 +74,7 @@ namespace rtm
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_z(mask4f_arg0 input) RTM_NO_EXCEPT
{
#if defined(RTM_SSE2_INTRINSICS)
return _mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(2, 2, 2, 2))));
return static_cast<uint32_t>(_mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(2, 2, 2, 2)))));
#elif defined(RTM_NEON_INTRINSICS)
return vgetq_lane_u32(vreinterpretq_u32_f32(input), 2);
#else
Expand All @@ -88,7 +88,7 @@ namespace rtm
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_w(mask4f_arg0 input) RTM_NO_EXCEPT
{
#if defined(RTM_SSE2_INTRINSICS)
return _mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(3, 3, 3, 3))));
return static_cast<uint32_t>(_mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(3, 3, 3, 3)))));
#elif defined(RTM_NEON_INTRINSICS)
return vgetq_lane_u32(vreinterpretq_u32_f32(input), 3);
#else
Expand Down
8 changes: 4 additions & 4 deletions includes/rtm/mask4i.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace rtm
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_x(mask4i_arg0 input) RTM_NO_EXCEPT
{
#if defined(RTM_SSE2_INTRINSICS)
return _mm_cvtsi128_si32(input);
return static_cast<uint32_t>(_mm_cvtsi128_si32(input));
#elif defined(RTM_NEON_INTRINSICS)
return vgetq_lane_u32(RTM_IMPL_MASK4i_GET(input), 0);
#else
Expand All @@ -55,7 +55,7 @@ namespace rtm
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_y(mask4i_arg0 input) RTM_NO_EXCEPT
{
#if defined(RTM_SSE2_INTRINSICS)
return _mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(1, 1, 1, 1)));
return static_cast<uint32_t>(_mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(1, 1, 1, 1))));
#elif defined(RTM_NEON_INTRINSICS)
return vgetq_lane_u32(RTM_IMPL_MASK4i_GET(input), 1);
#else
Expand All @@ -69,7 +69,7 @@ namespace rtm
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_z(mask4i_arg0 input) RTM_NO_EXCEPT
{
#if defined(RTM_SSE2_INTRINSICS)
return _mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(2, 2, 2, 2)));
return static_cast<uint32_t>(_mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(2, 2, 2, 2))));
#elif defined(RTM_NEON_INTRINSICS)
return vgetq_lane_u32(RTM_IMPL_MASK4i_GET(input), 2);
#else
Expand All @@ -83,7 +83,7 @@ namespace rtm
RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_w(mask4i_arg0 input) RTM_NO_EXCEPT
{
#if defined(RTM_SSE2_INTRINSICS)
return _mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(3, 3, 3, 3)));
return static_cast<uint32_t>(_mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(3, 3, 3, 3))));
#elif defined(RTM_NEON_INTRINSICS)
return vgetq_lane_u32(RTM_IMPL_MASK4i_GET(input), 3);
#else
Expand Down
Loading
Loading