如何将无符号整数加载到 SIMD 中 [英] How to load unsigned ints into SIMD

查看:29
本文介绍了如何将无符号整数加载到 SIMD 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 C 程序,其中有几个无符号整数数组.我正在使用这个声明 uint32_t.

I have a C program where I have a few arrays of unsigned ints. I'm using this declaration uint32_t.

我想使用 SIMD 对存储在每个数组中的数据执行一些操作.这就是我被卡住的地方,因为看起来大多数 SSE 和 SSE2 函数只支持 float 和 double.

I want to use SIMD to perform some operations on the data stored in each of the arrays. This is where I'm stuck because it looks like most of the SSE and SSE2 functions only support float and double.

我加载 uint32_t 类型数据的最佳方式是什么?

What's the best way for me to load data of type uint32_t?

推荐答案

对于通常使用的任何整数 SSE 类型_mm_load_si128/_mm_loadu_si128:

For any integer SSE type you typically use _mm_load_si128/_mm_loadu_si128:

uint32_t a[N];

__m128i v = _mm_loadu_si128((__m128i *)a);

这篇关于如何将无符号整数加载到 SIMD 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆