SSE4.1 : IINSERTPS – 把一个32位整型插入到一个128位参数中,并把某些位置零。内部指令:_mm_insert_ps

来源:互联网 发布:知米英语官网 编辑:程序博客网 时间:2024/04/30 20:07

SSE指令集: http://blog.csdn.net/xieqidong/archive/2008/07/04/2612847.aspx

_mm_insert_ps: http://msdn.microsoft.com/en-us/library/bb514071.aspx

 

 

__m128 a, b
a 1.0  -1.0  1.5  105.5
b -5.0  10  -325.0625 81.125


const int sel = 0xD9

 D

 1101                11(b3)         01(r1)                             // The D means that b3 will be stored in r1
 9
 1001                1(r0)  0(r1)  0(r2)  1(r3)                     // The 9 means that r0 and r3 will be set to 0

 

__m128 res = _mm_insert_ps(a, b, sel);

 

                 r0                  r1                          r2                         r3

res            0.000000      81.125000            1.500000              0.000000
                 0                   b.m128_f32[3]      a.m128_f32[2]      0

 

 

_MM_MK_INSERTPS_NDX(3,0,0)
c                     11 00                      b3 -> r0
0                     0 0 0 0                     r: b3, a2, a3, a4

_MM_MK_INSERTPS_NDX(3,1,0)
d                     11 01                     b3 -> r1
0                     0 0 0 0                     r: a1, b3, a3, a4

_MM_MK_INSERTPS_NDX(3,2,0)
e                     11 10                     b3 -> r2
0                     0 0 0 0                     r: a1, a2, b3, a4

_MM_MK_INSERTPS_NDX(3,3,0)
f                     11 11                     b3 -> r3
0                     0 0 0 0                     r: a1, a2, a3, b3

原创粉丝点击