summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python/python3-orjson/0001-Guard-avx512-module-with-x86-target-cfg.patch
blob: 604030e062bd98398e1de4251b7e1d64b0b0e88f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From c5c46664a914d3a7f048c51c3b9c2ab13e21ed1b Mon Sep 17 00:00:00 2001
From: Tim Orling <tim.orling@konsulko.com>
Date: Thu, 29 Jan 2026 09:59:55 -0800
Subject: [PATCH] Guard avx512 module with x86 target cfg

The avx512.rs module contains x86_64-specific intrinsics and target
features that are not valid on non-x86 architectures like RISC-V.

Upstream-Status: Inappropriate [Rejected by upstream https://github.com/ijl/orjson/pull/609]

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 src/ffi/pystrref/avx512.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/ffi/pystrref/avx512.rs b/src/ffi/pystrref/avx512.rs
index e4c7697..46450ac 100644
--- a/src/ffi/pystrref/avx512.rs
+++ b/src/ffi/pystrref/avx512.rs
@@ -3,12 +3,14 @@
 
 use super::pyunicode_new::*;
 
+#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
 use core::arch::x86_64::{
     _mm512_and_si512, _mm512_cmpgt_epu8_mask, _mm512_cmpneq_epi8_mask, _mm512_loadu_epi8,
     _mm512_mask_cmpneq_epi8_mask, _mm512_maskz_loadu_epi8, _mm512_max_epu8, _mm512_set1_epi8,
 };
 
 #[inline(never)]
+#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
 #[target_feature(enable = "avx512f,avx512bw,avx512vl,bmi2")]
 pub(crate) unsafe fn create_str_impl_avx512vl(buf: &str) -> *mut crate::ffi::PyObject {
     unsafe {
-- 
2.39.5