How to absolute 2 double or 4 floats using SSE instruction set? (Up to SSE4)

前端 未结 3 2073
栀梦
栀梦 2020-12-29 07:17

Here\'s the sample C code that I am trying to accelerate using SSE, the two arrays are 3072 element long with doubles, may drop it down to float if i don\'t need the precisi

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-29 08:18

    The maximum of -x and x should be abs(x). Here it is in code:

    x = _mm_max_ps(_mm_sub_ps(_mm_setzero_ps(), x), x)
    

提交回复
热议问题