将两个32位整数的向量相乘,生成一个32位结果元素的向量

编程入门 行业动态 更新时间:2024-10-24 16:28:41
本文介绍了将两个32位整数的向量相乘,生成一个32位结果元素的向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

将两个_mm256i寄存器的每个32位条目彼此相乘​​的最佳方法是什么?

What is the best way to multiply each 32bit entry of two _mm256i registers with each other?

_mm256_mul_epu32不是我想要的,因为它会产生64位输出.我希望每个32位输入元素都具有32位结果.

_mm256_mul_epu32 is not what I'm looking for because it produces 64bit outputs. I want a 32bit result for every 32bit input element.

此外,我确定两个32位值的乘法不会溢出.

Moreover, I'm sure that the multiplication of two 32bit values will not overflow.

谢谢!

推荐答案

您需要_mm256_mullo_epi32()内在函数.摘自Intel出色的在线内在函数指南:

You want the _mm256_mullo_epi32() intrinsic. From Intel's excellent online intrinsics guide:

简介 __m256i _mm256_mullo_epi32 (__m256i a, __m256i b) #include "immintrin.h" Instruction: vpmulld ymm, ymm, ymm CPUID Flags: AVX2

说明

将a和b中的压缩32位整数相乘, 产生中间的64位整数,并存储低32位的 dst中的中间整数.

Description

Multiply the packed 32-bit integers in a and b, producing intermediate 64-bit integers, and store the low 32 bits of the intermediate integers in dst.

更多推荐

将两个32位整数的向量相乘,生成一个32位结果元素的向量

本文发布于:2023-11-30 01:33:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648277.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:向量   整数   元素   两个

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!