我如何传递一个直接的4位值到_mm256_blend_pd的最后一个参数
How do I pass an immediate 4 bit value to the last argument of _mm256_blend_pd
我试图使用_mm256_blend_pd,但我一直遇到编译器错误。在这种情况下,错误是gcc希望"最后一个参数必须是4位直接值"。我可以成功地传入一个硬编码的值,但是任何计算出来的值都会产生错误。
下面是一个人为的无用的程序,它演示了这个错误。我在使用gcc 4.6.3和gcc 4.8.3时遇到了错误。
#include <immintrin.h>
#include <stdlib.h>
int main() {
__m256d zeroHit = {0};
int j=rand()%3;
int imm=(0x01);
// This line will compile
_mm256_store_pd(0,_mm256_blend_pd(zeroHit,*reinterpret_cast<__m256d*>(0),imm&0x0F));
imm=(0x01 & (j!=0));
// This line will produce the error
_mm256_store_pd(0,_mm256_blend_pd(zeroHit,*reinterpret_cast<__m256d*>(0),imm&0x0F));
return 0;
}
叫"immediate"是有原因的。它需要是一个编译时常数。——Mysticial
相关文章:
- 最高有效数字侧的第N位
- 如何获取一个数字的前3位
- C / C++ 移位/偏移/向左或向右移动位图?
- 对字符串进行位操作
- 如何在24位SDL_Surface上设置像素的颜色
- 将浮动的heightmap数组导出为16位原始值
- 将尾部调用void(i32,..)位转换为llvm::函数以获取FnAttribute
- C++Union/Struct位域的实现和可移植性
- 为什么C++逐位AND运算符在不同大小的操作数中表现为这样
- 将按位if条件转换为普通if条件
- 对字符数组中的元素执行逐位操作
- 将位字段导出到数组
- 将应用程序从32位移植到64位时出现问题
- 逐位操作的隐式类型转换
- 位阵列上的快速AND运算
- 64位机器上的C++内存对齐
- 一位朋友将模板函数缩写为clang和gcc
- 宽度为奇数的16位纹理为片状
- 如何打印boost多精度128位无符号整数
- 正在解码MSVC 32位版本的程序集(作业).没有手术做什么