diff --git a/README.md b/README.md index 01dac67a..9dd50e3f 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,17 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize") +## cinatra指令集功能使用 + +cinatra支持通过指令集优化其内部逻辑,其通过宏来控制是否使用指令集。使用之前请确保cpu支持。 + +使用如下命令即可编译带simd优化的cinatra。注意只能开启一种simd指令集优化,开启多个会导致编译失败。 + +```shell +cmake -DENABLE_SIMD=SSE42 .. # 启用sse4.2指令集 +cmake -DENABLE_SIMD=AVX2 .. # 启用avx2指令集 +``` + # 快速示例 ## 示例1:一个简单的hello world diff --git a/lang/english/README.md b/lang/english/README.md index 83f248f1..dc2146a0 100644 --- a/lang/english/README.md +++ b/lang/english/README.md @@ -44,6 +44,17 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize" 1. C++20 compiler (gcc 10.2, clang 13, Visual Studio 2022, or later versions) +## Usage:cinatra instruction set optimization + +cinatra supports optimizing its internal logic through the instruction set, which controls whether to use the instruction set through macros. Please make sure the cpu support before use. + +Use the following command to compile cinatra with simd optimization.Note that only one simd instruction set can be opened, and opening multiple instruction sets will cause compilation failure. + +```shell +cmake -DENABLE_SIMD=SSE42 .. # enable sse4.2 instruction set +cmake -DENABLE_SIMD=AVX2 .. # enable avx2 instruction set +``` + ## Examples ### Example 1: A simple "Hello World"