From 639712d24587d95fe96935983ad7279d517100c1 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 13 Feb 2025 07:25:29 -0800 Subject: [PATCH] Switch from AVX to SSE in the example --- src/attributes/codegen.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/attributes/codegen.md b/src/attributes/codegen.md index b9a24b8a7..b4a4972e7 100644 --- a/src/attributes/codegen.md +++ b/src/attributes/codegen.md @@ -97,30 +97,30 @@ The following restrictions apply unless otherwise specified by the platform rule Implicitly enabled features are included in this rule. For example an `sse2` function can call ones marked with `sse`. ```rust -# #[cfg(target_feature = "avx2")] { -#[target_feature(enable = "avx")] -fn foo_avx() {} +# #[cfg(target_feature = "sse2")] { +#[target_feature(enable = "sse")] +fn foo_sse() {} fn bar() { - // Calling `foo_avx` here is unsafe, as we must ensure that AVX is - // available first, even if `avx` is enabled by default on the target + // Calling `foo_sse` here is unsafe, as we must ensure that SSE is + // available first, even if `sse` is enabled by default on the target // platform or manually enabled as compiler flags. unsafe { - foo_avx(); + foo_sse(); } } -#[target_feature(enable = "avx")] -fn bar_avx() { - // Calling `foo_avx` here is safe. - foo_avx(); - || foo_avx(); +#[target_feature(enable = "sse")] +fn bar_sse() { + // Calling `foo_sse` here is safe. + foo_sse(); + || foo_sse(); } -#[target_feature(enable = "avx2")] -fn bar_avx2() { - // Calling `foo_avx` here is safe because `avx2` implies `avx`. - foo_avx(); +#[target_feature(enable = "sse2")] +fn bar_sse2() { + // Calling `foo_sse` here is safe because `sse2` implies `sse`. + foo_sse(); } # } ```