4 Star 0 Fork 5

OpenCloudOS Stream/libxcrypt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dbcfb0123374d83fbf44fcb80d9282969c702759.patch 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
ocs-bot 提交于 2025-06-05 14:28 +08:00 . - [Type] other
From dbcfb0123374d83fbf44fcb80d9282969c702759 Mon Sep 17 00:00:00 2001
From: Solar Designer <solar@openwall.com>
Date: Sun, 9 Mar 2025 19:53:00 +0100
Subject: [PATCH] yescrypt: Use AVX512VL XOP-like bit rotates for faster
Salsa20
---
lib/alg-yescrypt-opt.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/alg-yescrypt-opt.c b/lib/alg-yescrypt-opt.c
index a33c6e40..fc6e95e5 100644
--- a/lib/alg-yescrypt-opt.c
+++ b/lib/alg-yescrypt-opt.c
@@ -1,6 +1,6 @@
/*-
* Copyright 2009 Colin Percival
- * Copyright 2012-2018 Alexander Peslyak
+ * Copyright 2012-2025 Alexander Peslyak
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,8 @@
#if 0
#ifdef __XOP__
#warning "Note: XOP is enabled. That's great."
+#elif defined(__AVX512VL__)
+#warning "Note: AVX512VL is enabled. That's great."
#elif defined(__AVX__)
#warning "Note: AVX is enabled, which is great for classic scrypt and YESCRYPT_WORM, but is sometimes slightly slower than plain SSE2 for YESCRYPT_RW"
#elif defined(__SSE2__)
@@ -81,6 +83,8 @@
#include <emmintrin.h>
#ifdef __XOP__
#include <x86intrin.h>
+#elif defined(__AVX512VL__)
+#include <immintrin.h>
#endif
#elif defined(__SSE__)
#include <xmmintrin.h>
@@ -179,6 +183,9 @@ static inline void salsa20_simd_unshuffle(const salsa20_blk_t *Bin,
#ifdef __XOP__
#define ARX(out, in1, in2, s) \
out = _mm_xor_si128(out, _mm_roti_epi32(_mm_add_epi32(in1, in2), s));
+#elif defined(__AVX512VL__)
+#define ARX(out, in1, in2, s) \
+ out = _mm_xor_si128(out, _mm_rol_epi32(_mm_add_epi32(in1, in2), s));
#else
#define ARX(out, in1, in2, s) { \
__m128i tmp = _mm_add_epi32(in1, in2); \
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/opencloudos-stream/libxcrypt.git
git@gitee.com:opencloudos-stream/libxcrypt.git
opencloudos-stream
libxcrypt
libxcrypt
master

搜索帮助