Skip to content

Commit e9c4405

Browse files
committed
still compile with avx2
1 parent 5c721f8 commit e9c4405

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ For faster parallel builds, you can instead generate [ninja](https://ninja-build
6060

6161
Only the following configurations are supported:
6262

63-
| OS | Compiler | Arch |
64-
|---------|-------------|--------|
65-
| Windows | MSVC 19.37+ | x86_64 |
66-
| Linux | Clang 17+ | x86_64 |
63+
| OS | Compiler | Arch |
64+
|---------|-------------|------|
65+
| Windows | MSVC 19.37+ | AVX2 |
66+
| Linux | Clang 17+ | AVX2 |
6767

6868
Other configurations (macOS, aarch64, GCC, etc.) may be added in the future.
6969

rpp/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ if(MSVC)
8787
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
8888

8989
target_compile_definitions(rpp PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX _HAS_EXCEPTIONS=0)
90-
target_compile_options(rpp PRIVATE /MP /W4 /GR- /GS- /EHa- /wd4201)
90+
target_compile_options(rpp PRIVATE /arch:AVX2 /MP /W4 /GR- /GS- /EHa- /wd4201)
9191
elseif(CLANG)
9292
if(CLANG_VERSION_MAJOR LESS 17)
9393
message(FATAL_ERROR "Unsupported Clang version: only 17+ is supported.")
9494
endif()
9595

96-
target_compile_options(rpp PRIVATE -Wall -Wextra -fno-exceptions -fno-rtti)
96+
target_compile_options(rpp PRIVATE -mavx2 -Wall -Wextra -fno-exceptions -fno-rtti)
9797
else()
9898
message(FATAL_ERROR "Unsupported compiler: only MSVC and Clang are supported.")
9999
endif()

rpp/impl/simd.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
#include <immintrin.h>
55

6+
#ifndef __AVX2__
7+
#error "Unsupported architecture: AVX2 is required".
8+
#endif
9+
610
namespace rpp::SIMD {
711

812
static_assert(sizeof(F32x4) == 16);

rpp/simd.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
#include "base.h"
55

6+
// The implementation of these functions are compiled assuming AVX2 support.
7+
68
namespace rpp::SIMD {
79

810
struct F32x4 {
9-
// Assumes SSE4.2 is supported.
10-
1111
alignas(16) f32 data[4];
1212

1313
[[nodiscard]] static F32x4 set1(f32 v) noexcept;
@@ -29,8 +29,6 @@ struct F32x4 {
2929
};
3030

3131
struct F32x8 {
32-
// Assumes AVX2 is supported.
33-
3432
alignas(32) f32 data[8];
3533

3634
[[nodiscard]] static F32x8 set1(f32 v) noexcept;

0 commit comments

Comments
 (0)