avutil: [loongarch] Update loongson_intrinsics.h to v1.1.0
The loongson_intrinsics.h file is updated from v1.0.3 version to v1.1.0. Some spelling mistakes are fixed and new functions are added. Signed-off-by: Hao Chen <chenhao@loongson.cn> Reviewed-by: 殷时友 <yinshiyou-hf@loongson.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
a1fff6566b
commit
5b812acdea
@@ -33,7 +33,7 @@
|
||||
* Xiwei Gu <guxiwei-hf@loongson.cn>
|
||||
* Lu Wang <wanglu@loongson.cn>
|
||||
*
|
||||
* This file is a header file for loongarch builtin extention.
|
||||
* This file is a header file for loongarch builtin extension.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -42,12 +42,12 @@
|
||||
|
||||
/**
|
||||
* MAJOR version: Macro usage changes.
|
||||
* MINOR version: Add new functions, or bug fix.
|
||||
* MINOR version: Add new functions, or bug fixes.
|
||||
* MICRO version: Comment changes or implementation changes.
|
||||
*/
|
||||
#define LSOM_VERSION_MAJOR 1
|
||||
#define LSOM_VERSION_MINOR 0
|
||||
#define LSOM_VERSION_MICRO 3
|
||||
#define LSOM_VERSION_MINOR 1
|
||||
#define LSOM_VERSION_MICRO 0
|
||||
|
||||
#define DUP2_ARG1(_INS, _IN0, _IN1, _OUT0, _OUT1) \
|
||||
{ \
|
||||
@@ -73,15 +73,15 @@
|
||||
DUP2_ARG1(_INS, _IN2, _IN3, _OUT2, _OUT3); \
|
||||
}
|
||||
|
||||
#define DUP4_ARG2(_INS, _IN0, _IN1, _IN2, _IN3, _IN4, _IN5, _IN6, _IN7, \
|
||||
_OUT0, _OUT1, _OUT2, _OUT3) \
|
||||
#define DUP4_ARG2(_INS, _IN0, _IN1, _IN2, _IN3, _IN4, _IN5, _IN6, _IN7, _OUT0, \
|
||||
_OUT1, _OUT2, _OUT3) \
|
||||
{ \
|
||||
DUP2_ARG2(_INS, _IN0, _IN1, _IN2, _IN3, _OUT0, _OUT1); \
|
||||
DUP2_ARG2(_INS, _IN4, _IN5, _IN6, _IN7, _OUT2, _OUT3); \
|
||||
}
|
||||
|
||||
#define DUP4_ARG3(_INS, _IN0, _IN1, _IN2, _IN3, _IN4, _IN5, _IN6, _IN7, \
|
||||
_IN8, _IN9, _IN10, _IN11, _OUT0, _OUT1, _OUT2, _OUT3) \
|
||||
#define DUP4_ARG3(_INS, _IN0, _IN1, _IN2, _IN3, _IN4, _IN5, _IN6, _IN7, _IN8, \
|
||||
_IN9, _IN10, _IN11, _OUT0, _OUT1, _OUT2, _OUT3) \
|
||||
{ \
|
||||
DUP2_ARG3(_INS, _IN0, _IN1, _IN2, _IN3, _IN4, _IN5, _OUT0, _OUT1); \
|
||||
DUP2_ARG3(_INS, _IN6, _IN7, _IN8, _IN9, _IN10, _IN11, _OUT2, _OUT3); \
|
||||
@@ -94,11 +94,11 @@
|
||||
* Description : Dot product & addition of byte vector elements
|
||||
* Arguments : Inputs - in_c, in_h, in_l
|
||||
* Outputs - out
|
||||
* Retrun Type - halfword
|
||||
* Return Type - halfword
|
||||
* Details : Signed byte elements from in_h are multiplied by
|
||||
* signed byte elements from in_l, and then added adjacent to
|
||||
* each other to get results with the twice size of input.
|
||||
* Then the results plus to signed half word elements from in_c.
|
||||
* Then the results plus to signed half-word elements from in_c.
|
||||
* Example : out = __lsx_vdp2add_h_b(in_c, in_h, in_l)
|
||||
* in_c : 1,2,3,4, 1,2,3,4
|
||||
* in_h : 1,2,3,4, 5,6,7,8, 1,2,3,4, 5,6,7,8
|
||||
@@ -106,8 +106,8 @@
|
||||
* out : 23,40,41,26, 23,40,41,26
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2add_h_b(__m128i in_c, __m128i in_h, __m128i in_l)
|
||||
{
|
||||
static inline __m128i __lsx_vdp2add_h_b(__m128i in_c, __m128i in_h,
|
||||
__m128i in_l) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaddwev_h_b(in_c, in_h, in_l);
|
||||
@@ -120,20 +120,20 @@ static inline __m128i __lsx_vdp2add_h_b(__m128i in_c, __m128i in_h, __m128i in_l
|
||||
* Description : Dot product & addition of byte vector elements
|
||||
* Arguments : Inputs - in_c, in_h, in_l
|
||||
* Outputs - out
|
||||
* Retrun Type - halfword
|
||||
* Return Type - halfword
|
||||
* Details : Unsigned byte elements from in_h are multiplied by
|
||||
* unsigned byte elements from in_l, and then added adjacent to
|
||||
* each other to get results with the twice size of input.
|
||||
* The results plus to signed half word elements from in_c.
|
||||
* Example : out = __lsx_vdp2add_h_b(in_c, in_h, in_l)
|
||||
* The results plus to signed half-word elements from in_c.
|
||||
* Example : out = __lsx_vdp2add_h_bu(in_c, in_h, in_l)
|
||||
* in_c : 1,2,3,4, 1,2,3,4
|
||||
* in_h : 1,2,3,4, 5,6,7,8, 1,2,3,4, 5,6,7,8
|
||||
* in_l : 8,7,6,5, 4,3,2,1, 8,7,6,5, 4,3,2,1
|
||||
* out : 23,40,41,26, 23,40,41,26
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2add_h_bu(__m128i in_c, __m128i in_h, __m128i in_l)
|
||||
{
|
||||
static inline __m128i __lsx_vdp2add_h_bu(__m128i in_c, __m128i in_h,
|
||||
__m128i in_l) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaddwev_h_bu(in_c, in_h, in_l);
|
||||
@@ -143,12 +143,38 @@ static inline __m128i __lsx_vdp2add_h_bu(__m128i in_c, __m128i in_h, __m128i in_
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : Dot product & addition of half word vector elements
|
||||
* Description : Dot product & addition of byte vector elements
|
||||
* Arguments : Inputs - in_c, in_h, in_l
|
||||
* Outputs - out
|
||||
* Retrun Type - __m128i
|
||||
* Details : Signed half word elements from in_h are multiplied by
|
||||
* signed half word elements from in_l, and then added adjacent to
|
||||
* Return Type - halfword
|
||||
* Details : Unsigned byte elements from in_h are multiplied by
|
||||
* signed byte elements from in_l, and then added adjacent to
|
||||
* each other to get results with the twice size of input.
|
||||
* The results plus to signed half-word elements from in_c.
|
||||
* Example : out = __lsx_vdp2add_h_bu_b(in_c, in_h, in_l)
|
||||
* in_c : 1,1,1,1, 1,1,1,1
|
||||
* in_h : 1,2,3,4, 5,6,7,8, 1,2,3,4, 5,6,7,8
|
||||
* in_l : -1,-2,-3,-4, -5,-6,-7,-8, 1,2,3,4, 5,6,7,8
|
||||
* out : -4,-24,-60,-112, 6,26,62,114
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2add_h_bu_b(__m128i in_c, __m128i in_h,
|
||||
__m128i in_l) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaddwev_h_bu_b(in_c, in_h, in_l);
|
||||
out = __lsx_vmaddwod_h_bu_b(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : Dot product & addition of half-word vector elements
|
||||
* Arguments : Inputs - in_c, in_h, in_l
|
||||
* Outputs - out
|
||||
* Return Type - __m128i
|
||||
* Details : Signed half-word elements from in_h are multiplied by
|
||||
* signed half-word elements from in_l, and then added adjacent to
|
||||
* each other to get results with the twice size of input.
|
||||
* Then the results plus to signed word elements from in_c.
|
||||
* Example : out = __lsx_vdp2add_h_b(in_c, in_h, in_l)
|
||||
@@ -158,8 +184,8 @@ static inline __m128i __lsx_vdp2add_h_bu(__m128i in_c, __m128i in_h, __m128i in_
|
||||
* out : 23,40,41,26
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2add_w_h(__m128i in_c, __m128i in_h, __m128i in_l)
|
||||
{
|
||||
static inline __m128i __lsx_vdp2add_w_h(__m128i in_c, __m128i in_h,
|
||||
__m128i in_l) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaddwev_w_h(in_c, in_h, in_l);
|
||||
@@ -172,7 +198,7 @@ static inline __m128i __lsx_vdp2add_w_h(__m128i in_c, __m128i in_h, __m128i in_l
|
||||
* Description : Dot product of byte vector elements
|
||||
* Arguments : Inputs - in_h, in_l
|
||||
* Outputs - out
|
||||
* Retrun Type - halfword
|
||||
* Return Type - halfword
|
||||
* Details : Signed byte elements from in_h are multiplied by
|
||||
* signed byte elements from in_l, and then added adjacent to
|
||||
* each other to get results with the twice size of input.
|
||||
@@ -182,8 +208,7 @@ static inline __m128i __lsx_vdp2add_w_h(__m128i in_c, __m128i in_h, __m128i in_l
|
||||
* out : 22,38,38,22, 22,38,38,22
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2_h_b(__m128i in_h, __m128i in_l)
|
||||
{
|
||||
static inline __m128i __lsx_vdp2_h_b(__m128i in_h, __m128i in_l) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmulwev_h_b(in_h, in_l);
|
||||
@@ -196,7 +221,7 @@ static inline __m128i __lsx_vdp2_h_b(__m128i in_h, __m128i in_l)
|
||||
* Description : Dot product of byte vector elements
|
||||
* Arguments : Inputs - in_h, in_l
|
||||
* Outputs - out
|
||||
* Retrun Type - halfword
|
||||
* Return Type - halfword
|
||||
* Details : Unsigned byte elements from in_h are multiplied by
|
||||
* unsigned byte elements from in_l, and then added adjacent to
|
||||
* each other to get results with the twice size of input.
|
||||
@@ -206,8 +231,7 @@ static inline __m128i __lsx_vdp2_h_b(__m128i in_h, __m128i in_l)
|
||||
* out : 22,38,38,22, 22,38,38,22
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2_h_bu(__m128i in_h, __m128i in_l)
|
||||
{
|
||||
static inline __m128i __lsx_vdp2_h_bu(__m128i in_h, __m128i in_l) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmulwev_h_bu(in_h, in_l);
|
||||
@@ -220,7 +244,7 @@ static inline __m128i __lsx_vdp2_h_bu(__m128i in_h, __m128i in_l)
|
||||
* Description : Dot product of byte vector elements
|
||||
* Arguments : Inputs - in_h, in_l
|
||||
* Outputs - out
|
||||
* Retrun Type - halfword
|
||||
* Return Type - halfword
|
||||
* Details : Unsigned byte elements from in_h are multiplied by
|
||||
* signed byte elements from in_l, and then added adjacent to
|
||||
* each other to get results with the twice size of input.
|
||||
@@ -230,8 +254,7 @@ static inline __m128i __lsx_vdp2_h_bu(__m128i in_h, __m128i in_l)
|
||||
* out : 22,38,38,22, 22,38,38,6
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2_h_bu_b(__m128i in_h, __m128i in_l)
|
||||
{
|
||||
static inline __m128i __lsx_vdp2_h_bu_b(__m128i in_h, __m128i in_l) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmulwev_h_bu_b(in_h, in_l);
|
||||
@@ -244,7 +267,7 @@ static inline __m128i __lsx_vdp2_h_bu_b(__m128i in_h, __m128i in_l)
|
||||
* Description : Dot product of byte vector elements
|
||||
* Arguments : Inputs - in_h, in_l
|
||||
* Outputs - out
|
||||
* Retrun Type - halfword
|
||||
* Return Type - halfword
|
||||
* Details : Signed byte elements from in_h are multiplied by
|
||||
* signed byte elements from in_l, and then added adjacent to
|
||||
* each other to get results with the twice size of input.
|
||||
@@ -254,8 +277,7 @@ static inline __m128i __lsx_vdp2_h_bu_b(__m128i in_h, __m128i in_l)
|
||||
* out : 22,38,38,22
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vdp2_w_h(__m128i in_h, __m128i in_l)
|
||||
{
|
||||
static inline __m128i __lsx_vdp2_w_h(__m128i in_h, __m128i in_l) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmulwev_w_h(in_h, in_l);
|
||||
@@ -266,7 +288,8 @@ static inline __m128i __lsx_vdp2_w_h(__m128i in_h, __m128i in_l)
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : Clip all halfword elements of input vector between min & max
|
||||
* out = ((_in) < (min)) ? (min) : (((_in) > (max)) ? (max) : (_in))
|
||||
* out = ((_in) < (min)) ? (min) : (((_in) > (max)) ? (max) :
|
||||
* (_in))
|
||||
* Arguments : Inputs - _in (input vector)
|
||||
* - min (min threshold)
|
||||
* - max (max threshold)
|
||||
@@ -279,8 +302,7 @@ static inline __m128i __lsx_vdp2_w_h(__m128i in_h, __m128i in_l)
|
||||
* out : 1,2,9,9, 1,9,9,9
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vclip_h(__m128i _in, __m128i min, __m128i max)
|
||||
{
|
||||
static inline __m128i __lsx_vclip_h(__m128i _in, __m128i min, __m128i max) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmax_h(min, _in);
|
||||
@@ -293,15 +315,14 @@ static inline __m128i __lsx_vclip_h(__m128i _in, __m128i min, __m128i max)
|
||||
* Description : Set each element of vector between 0 and 255
|
||||
* Arguments : Inputs - _in
|
||||
* Outputs - out
|
||||
* Retrun Type - halfword
|
||||
* Return Type - halfword
|
||||
* Details : Signed byte elements from _in are clamped between 0 and 255.
|
||||
* Example : out = __lsx_vclip255_h(_in)
|
||||
* _in : -8,255,280,249, -8,255,280,249
|
||||
* out : 0,255,255,249, 0,255,255,249
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vclip255_h(__m128i _in)
|
||||
{
|
||||
static inline __m128i __lsx_vclip255_h(__m128i _in) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaxi_h(_in, 0);
|
||||
@@ -314,15 +335,14 @@ static inline __m128i __lsx_vclip255_h(__m128i _in)
|
||||
* Description : Set each element of vector between 0 and 255
|
||||
* Arguments : Inputs - _in
|
||||
* Outputs - out
|
||||
* Retrun Type - word
|
||||
* Return Type - word
|
||||
* Details : Signed byte elements from _in are clamped between 0 and 255.
|
||||
* Example : out = __lsx_vclip255_w(_in)
|
||||
* _in : -8,255,280,249
|
||||
* out : 0,255,255,249
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
{
|
||||
static inline __m128i __lsx_vclip255_w(__m128i _in) {
|
||||
__m128i out;
|
||||
|
||||
out = __lsx_vmaxi_w(_in, 0);
|
||||
@@ -348,7 +368,7 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
_in0 = __lsx_vxor_v(_in0, _in1); \
|
||||
_in1 = __lsx_vxor_v(_in0, _in1); \
|
||||
_in0 = __lsx_vxor_v(_in0, _in1); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
@@ -381,8 +401,10 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
* =============================================================================
|
||||
* Description : Transpose 8x8 block with byte elements in vectors
|
||||
* Arguments : Inputs - _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7
|
||||
* Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
|
||||
* Details : The rows of the matrix become columns, and the columns become rows.
|
||||
* Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6,
|
||||
* _out7
|
||||
* Details : The rows of the matrix become columns, and the columns
|
||||
* become rows.
|
||||
* Example : LSX_TRANSPOSE8x8_B
|
||||
* _in0 : 00,01,02,03,04,05,06,07, 00,00,00,00,00,00,00,00
|
||||
* _in1 : 10,11,12,13,14,15,16,17, 00,00,00,00,00,00,00,00
|
||||
@@ -404,7 +426,8 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LSX_TRANSPOSE8x8_B(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7)\
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
__m128i zero = { 0 }; \
|
||||
__m128i shuf8 = { 0x0F0E0D0C0B0A0908, 0x1716151413121110 }; \
|
||||
@@ -430,7 +453,7 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : Transpose 8x8 block with half word elements in vectors
|
||||
* Description : Transpose 8x8 block with half-word elements in vectors
|
||||
* Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
|
||||
* Outputs - out0, out1, out2, out3, out4, out5, out6, out7
|
||||
* Details :
|
||||
@@ -446,7 +469,8 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LSX_TRANSPOSE8x8_H(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7)\
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
__m128i _s0, _s1, _t0, _t1, _t2, _t3, _t4, _t5, _t6, _t7; \
|
||||
\
|
||||
@@ -483,7 +507,8 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
* Arguments : Inputs - _in0, _in1, _in2, _in3 (input 8x4 byte block)
|
||||
* Outputs - _out0, _out1, _out2, _out3 (output 4x8 byte block)
|
||||
* Return Type - as per RTYPE
|
||||
* Details : The rows of the matrix become columns, and the columns become rows.
|
||||
* Details : The rows of the matrix become columns, and the columns become
|
||||
* rows.
|
||||
* Example : LSX_TRANSPOSE8x4_B
|
||||
* _in0 : 00,01,02,03,00,00,00,00, 00,00,00,00,00,00,00,00
|
||||
* _in1 : 10,11,12,13,00,00,00,00, 00,00,00,00,00,00,00,00
|
||||
@@ -547,9 +572,10 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
* 120,121,122,123,124,125,126,127
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LSX_TRANSPOSE16x8_B(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, _in8, \
|
||||
_in9, _in10, _in11, _in12, _in13, _in14, _in15, _out0, \
|
||||
_out1, _out2, _out3, _out4, _out5, _out6, _out7) \
|
||||
#define LSX_TRANSPOSE16x8_B(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_in8, _in9, _in10, _in11, _in12, _in13, _in14, \
|
||||
_in15, _out0, _out1, _out2, _out3, _out4, _out5, \
|
||||
_out6, _out7) \
|
||||
{ \
|
||||
__m128i _tmp0, _tmp1, _tmp2, _tmp3, _tmp4, _tmp5, _tmp6, _tmp7; \
|
||||
__m128i _t0, _t1, _t2, _t3, _t4, _t5, _t6, _t7; \
|
||||
@@ -631,7 +657,8 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LSX_BUTTERFLY_8_B(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7)\
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
_out0 = __lsx_vadd_b(_in0, _in7); \
|
||||
_out1 = __lsx_vadd_b(_in1, _in6); \
|
||||
@@ -644,7 +671,8 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
}
|
||||
|
||||
#define LSX_BUTTERFLY_8_H(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7)\
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
_out0 = __lsx_vadd_h(_in0, _in7); \
|
||||
_out1 = __lsx_vadd_h(_in1, _in6); \
|
||||
@@ -657,7 +685,8 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
}
|
||||
|
||||
#define LSX_BUTTERFLY_8_W(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7)\
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
_out0 = __lsx_vadd_w(_in0, _in7); \
|
||||
_out1 = __lsx_vadd_w(_in1, _in6); \
|
||||
@@ -670,7 +699,8 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
}
|
||||
|
||||
#define LSX_BUTTERFLY_8_D(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7)\
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
_out0 = __lsx_vadd_d(_in0, _in7); \
|
||||
_out1 = __lsx_vadd_d(_in1, _in6); \
|
||||
@@ -700,8 +730,7 @@ static inline __m128i __lsx_vclip255_w(__m128i _in)
|
||||
* Example : See out = __lasx_xvdp2_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2_h_bu(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2_h_bu(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_h_bu(in_h, in_l);
|
||||
@@ -718,13 +747,12 @@ static inline __m256i __lasx_xvdp2_h_bu(__m256i in_h, __m256i in_l)
|
||||
* Details : Signed byte elements from in_h are multiplied with
|
||||
* signed byte elements from in_l producing a result
|
||||
* twice the size of input i.e. signed halfword.
|
||||
* Then this iniplication results of adjacent odd-even elements
|
||||
* Then this multiplication results of adjacent odd-even elements
|
||||
* are added to the out vector
|
||||
* Example : See out = __lasx_xvdp2_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2_h_b(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2_h_b(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_h_b(in_h, in_l);
|
||||
@@ -749,8 +777,7 @@ static inline __m256i __lasx_xvdp2_h_b(__m256i in_h, __m256i in_l)
|
||||
* out : 22,38,38,22, 22,38,38,22
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_w_h(in_h, in_l);
|
||||
@@ -763,17 +790,16 @@ static inline __m256i __lasx_xvdp2_w_h(__m256i in_h, __m256i in_l)
|
||||
* Description : Dot product of word vector elements
|
||||
* Arguments : Inputs - in_h, in_l
|
||||
* Output - out
|
||||
* Retrun Type - signed double
|
||||
* Return Type - signed double
|
||||
* Details : Signed word elements from in_h are multiplied with
|
||||
* signed word elements from in_l producing a result
|
||||
* twice the size of input i.e. signed double word.
|
||||
* twice the size of input i.e. signed double-word.
|
||||
* Then this multiplied results of adjacent odd-even elements
|
||||
* are added to the out vector.
|
||||
* Example : See out = __lasx_xvdp2_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2_d_w(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2_d_w(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_d_w(in_h, in_l);
|
||||
@@ -795,8 +821,7 @@ static inline __m256i __lasx_xvdp2_d_w(__m256i in_h, __m256i in_l)
|
||||
* Example : See out = __lasx_xvdp2_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2_w_hu_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2_w_hu_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_w_hu_h(in_h, in_l);
|
||||
@@ -809,7 +834,7 @@ static inline __m256i __lasx_xvdp2_w_hu_h(__m256i in_h, __m256i in_l)
|
||||
* Description : Dot product & addition of byte vector elements
|
||||
* Arguments : Inputs - in_h, in_l
|
||||
* Output - out
|
||||
* Retrun Type - halfword
|
||||
* Return Type - halfword
|
||||
* Details : Signed byte elements from in_h are multiplied with
|
||||
* signed byte elements from in_l producing a result
|
||||
* twice the size of input i.e. signed halfword.
|
||||
@@ -818,8 +843,8 @@ static inline __m256i __lasx_xvdp2_w_hu_h(__m256i in_h, __m256i in_l)
|
||||
* Example : See out = __lasx_xvdp2add_w_h(in_c, in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_h_b(__m256i in_c,__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2add_h_b(__m256i in_c, __m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_h_b(in_c, in_h, in_l);
|
||||
@@ -827,6 +852,52 @@ static inline __m256i __lasx_xvdp2add_h_b(__m256i in_c,__m256i in_h, __m256i in_
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : Dot product & addition of byte vector elements
|
||||
* Arguments : Inputs - in_h, in_l
|
||||
* Output - out
|
||||
* Return Type - halfword
|
||||
* Details : Unsigned byte elements from in_h are multiplied with
|
||||
* unsigned byte elements from in_l producing a result
|
||||
* twice the size of input i.e. signed halfword.
|
||||
* Then this multiplied results of adjacent odd-even elements
|
||||
* are added to the in_c vector.
|
||||
* Example : See out = __lasx_xvdp2add_w_h(in_c, in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_h_bu(__m256i in_c, __m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_h_bu(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_bu(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : Dot product & addition of byte vector elements
|
||||
* Arguments : Inputs - in_h, in_l
|
||||
* Output - out
|
||||
* Return Type - halfword
|
||||
* Details : Unsigned byte elements from in_h are multiplied with
|
||||
* signed byte elements from in_l producing a result
|
||||
* twice the size of input i.e. signed halfword.
|
||||
* Then this multiplied results of adjacent odd-even elements
|
||||
* are added to the in_c vector.
|
||||
* Example : See out = __lasx_xvdp2add_w_h(in_c, in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_h_bu_b(__m256i in_c, __m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_h_bu_b(in_c, in_h, in_l);
|
||||
out = __lasx_xvmaddwod_h_bu_b(out, in_h, in_l);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : Dot product of halfword vector elements
|
||||
@@ -845,8 +916,8 @@ static inline __m256i __lasx_xvdp2add_h_b(__m256i in_c,__m256i in_h, __m256i in_
|
||||
* out : 23,40,41,26, 23,40,41,26
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_w_h(__m256i in_c, __m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2add_w_h(__m256i in_c, __m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_w_h(in_c, in_h, in_l);
|
||||
@@ -868,8 +939,8 @@ static inline __m256i __lasx_xvdp2add_w_h(__m256i in_c, __m256i in_h, __m256i in
|
||||
* Example : See out = __lasx_xvdp2add_w_h(in_c, in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_w_hu(__m256i in_c, __m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2add_w_hu(__m256i in_c, __m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_w_hu(in_c, in_h, in_l);
|
||||
@@ -891,8 +962,8 @@ static inline __m256i __lasx_xvdp2add_w_hu(__m256i in_c, __m256i in_h, __m256i i
|
||||
* Example : See out = __lasx_xvdp2add_w_h(in_c, in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2add_w_hu_h(__m256i in_c, __m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2add_w_hu_h(__m256i in_c, __m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaddwev_w_hu_h(in_c, in_h, in_l);
|
||||
@@ -915,8 +986,8 @@ static inline __m256i __lasx_xvdp2add_w_hu_h(__m256i in_c, __m256i in_h, __m256i
|
||||
* Example : See out = __lasx_xvdp2sub_w_h(in_c, in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2sub_h_bu(__m256i in_c, __m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2sub_h_bu(__m256i in_c, __m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_h_bu(in_h, in_l);
|
||||
@@ -944,8 +1015,8 @@ static inline __m256i __lasx_xvdp2sub_h_bu(__m256i in_c, __m256i in_h, __m256i i
|
||||
* out : -7,-3,0,0, 0,-1,0,-1
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp2sub_w_h(__m256i in_c, __m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp2sub_w_h(__m256i in_c, __m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_w_h(in_h, in_l);
|
||||
@@ -960,10 +1031,10 @@ static inline __m256i __lasx_xvdp2sub_w_h(__m256i in_c, __m256i in_h, __m256i in
|
||||
* Arguments : Inputs - in_h, in_l
|
||||
* Output - out
|
||||
* Return Type - signed word
|
||||
* Details : Signed halfword elements from in_h are iniplied with
|
||||
* Details : Signed halfword elements from in_h are multiplied with
|
||||
* signed halfword elements from in_l producing a result
|
||||
* four times the size of input i.e. signed doubleword.
|
||||
* Then this iniplication results of four adjacent elements
|
||||
* Then this multiplication results of four adjacent elements
|
||||
* are added together and stored to the out vector.
|
||||
* Example : out = __lasx_xvdp4_d_h(in_h, in_l)
|
||||
* in_h : 3,1,3,0, 0,0,0,1, 0,0,1,-1, 0,0,0,1
|
||||
@@ -971,8 +1042,7 @@ static inline __m256i __lasx_xvdp2sub_w_h(__m256i in_c, __m256i in_h, __m256i in
|
||||
* out : -2,0,1,1
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvdp4_d_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvdp4_d_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmulwev_w_h(in_h, in_l);
|
||||
@@ -993,8 +1063,7 @@ static inline __m256i __lasx_xvdp4_d_h(__m256i in_h, __m256i in_l)
|
||||
* Example : See out = __lasx_xvaddwh_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddwh_h_b(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvaddwh_h_b(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvilvh_b(in_h, in_l);
|
||||
@@ -1017,8 +1086,7 @@ static inline __m256i __lasx_xvaddwh_h_b(__m256i in_h, __m256i in_l)
|
||||
* out : 1,0,0,-1, 1,0,0, 2
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddwh_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvaddwh_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvilvh_h(in_h, in_l);
|
||||
@@ -1038,8 +1106,7 @@ static inline __m256i __lasx_xvaddwh_h_b(__m256i in_h, __m256i in_l)
|
||||
* Example : See out = __lasx_xvaddwl_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddwl_h_b(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvaddwl_h_b(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvilvl_b(in_h, in_l);
|
||||
@@ -1062,8 +1129,7 @@ static inline __m256i __lasx_xvaddwl_h_b(__m256i in_h, __m256i in_l)
|
||||
* out : 5,-1,4,2, 1,0,2,-1
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddwl_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvaddwl_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvilvl_h(in_h, in_l);
|
||||
@@ -1083,8 +1149,7 @@ static inline __m256i __lasx_xvaddwl_w_h(__m256i in_h, __m256i in_l)
|
||||
* Example : See out = __lasx_xvaddwl_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddwl_h_bu(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvaddwl_h_bu(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvilvl_b(in_h, in_l);
|
||||
@@ -1103,8 +1168,7 @@ static inline __m256i __lasx_xvaddwl_h_bu(__m256i in_h, __m256i in_l)
|
||||
* Example : See out = __lasx_xvaddw_w_w_h(in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddw_h_h_bu(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvaddw_h_h_bu(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvsllwil_hu_bu(in_l, 0);
|
||||
@@ -1126,8 +1190,7 @@ static inline __m256i __lasx_xvaddw_h_h_bu(__m256i in_h, __m256i in_l)
|
||||
* out : 2, 0,1,2, -1,0,1,1,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvaddw_w_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvaddw_w_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvsllwil_w_h(in_l, 0);
|
||||
@@ -1153,8 +1216,8 @@ static inline __m256i __lasx_xvaddw_w_w_h(__m256i in_h, __m256i in_l)
|
||||
* out : 201, 602,1203,2004, -995, -1794,-2793,-3992
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvmaddwl_w_h(__m256i in_c, __m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvmaddwl_w_h(__m256i in_c, __m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i tmp0, tmp1, out;
|
||||
|
||||
tmp0 = __lasx_xvsllwil_w_h(in_h, 0);
|
||||
@@ -1177,8 +1240,8 @@ static inline __m256i __lasx_xvmaddwl_w_h(__m256i in_c, __m256i in_h, __m256i in
|
||||
* Example : See out = __lasx_xvmaddwl_w_h(in_c, in_h, in_l)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvmaddwh_w_h(__m256i in_c, __m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvmaddwh_w_h(__m256i in_c, __m256i in_h,
|
||||
__m256i in_l) {
|
||||
__m256i tmp0, tmp1, out;
|
||||
|
||||
tmp0 = __lasx_xvilvh_h(in_h, in_h);
|
||||
@@ -1203,8 +1266,7 @@ static inline __m256i __lasx_xvmaddwh_w_h(__m256i in_c, __m256i in_h, __m256i in
|
||||
* out : 6,1,3,0, 0,0,1,0
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvmulwl_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvmulwl_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i tmp0, tmp1, out;
|
||||
|
||||
tmp0 = __lasx_xvsllwil_w_h(in_h, 0);
|
||||
@@ -1228,8 +1290,7 @@ static inline __m256i __lasx_xvmulwl_w_h(__m256i in_h, __m256i in_l)
|
||||
* out : 0,0,0,0, 0,0,0,1
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvmulwh_w_h(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvmulwh_w_h(__m256i in_h, __m256i in_l) {
|
||||
__m256i tmp0, tmp1, out;
|
||||
|
||||
tmp0 = __lasx_xvilvh_h(in_h, in_h);
|
||||
@@ -1240,21 +1301,22 @@ static inline __m256i __lasx_xvmulwh_w_h(__m256i in_h, __m256i in_l)
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : The low half of the vector elements are expanded and
|
||||
* added saturately after being doubled.
|
||||
* Description : The low half of the vector elements are added to the high half
|
||||
* after being doubled, then saturated.
|
||||
* Arguments : Inputs - in_h, in_l
|
||||
* Output - out
|
||||
* Details : The in_h vector adds the in_l vector saturately after the lower
|
||||
* half of the two-fold zero extension (unsigned byte to unsigned
|
||||
* halfword) and the results are stored to the out vector.
|
||||
* Details : The in_h vector adds the in_l vector after the lower half of
|
||||
* the two-fold zero extension (unsigned byte to unsigned
|
||||
* halfword) and then saturated. The results are stored to the out
|
||||
* vector.
|
||||
* Example : out = __lasx_xvsaddw_hu_hu_bu(in_h, in_l)
|
||||
* in_h : 2,65532,1,2, 1,0,0,0, 0,0,1,0, 1,0,0,1
|
||||
* in_l : 3,6,3,0, 0,0,0,1, 0,0,1,1, 0,0,0,1, 3,18,3,0, 0,0,0,1, 0,0,1,1, 0,0,0,1
|
||||
* in_l : 3,6,3,0, 0,0,0,1, 0,0,1,1, 0,0,0,1, 3,18,3,0, 0,0,0,1, 0,0,1,1,
|
||||
* 0,0,0,1
|
||||
* out : 5,65535,4,2, 1,0,0,1, 3,18,4,0, 1,0,0,2,
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvsaddw_hu_hu_bu(__m256i in_h, __m256i in_l)
|
||||
{
|
||||
static inline __m256i __lasx_xvsaddw_hu_hu_bu(__m256i in_h, __m256i in_l) {
|
||||
__m256i tmp1, out;
|
||||
__m256i zero = { 0 };
|
||||
|
||||
@@ -1279,8 +1341,7 @@ static inline __m256i __lasx_xvsaddw_hu_hu_bu(__m256i in_h, __m256i in_l)
|
||||
* out : 1,2,9,9, 1,9,9,9, 4,4,4,4, 5,5,5,5
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvclip_h(__m256i in, __m256i min, __m256i max)
|
||||
{
|
||||
static inline __m256i __lasx_xvclip_h(__m256i in, __m256i min, __m256i max) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmax_h(min, in);
|
||||
@@ -1298,8 +1359,7 @@ static inline __m256i __lasx_xvclip_h(__m256i in, __m256i min, __m256i max)
|
||||
* Example : See out = __lasx_xvclip255_w(in)
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvclip255_h(__m256i in)
|
||||
{
|
||||
static inline __m256i __lasx_xvclip255_h(__m256i in) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaxi_h(in, 0);
|
||||
@@ -1319,8 +1379,7 @@ static inline __m256i __lasx_xvclip255_h(__m256i in)
|
||||
* out : 0,255,255,249, 0,255,255,249
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvclip255_w(__m256i in)
|
||||
{
|
||||
static inline __m256i __lasx_xvclip255_w(__m256i in) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvmaxi_w(in, 0);
|
||||
@@ -1331,8 +1390,8 @@ static inline __m256i __lasx_xvclip255_w(__m256i in)
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : Indexed halfword element values are replicated to all
|
||||
* elements in output vector. If 'indx < 8' use xvsplati_l_*,
|
||||
* if 'indx >= 8' use xvsplati_h_*.
|
||||
* elements in output vector. If 'idx < 8' use xvsplati_l_*,
|
||||
* if 'idx >= 8' use xvsplati_h_*.
|
||||
* Arguments : Inputs - in, idx
|
||||
* Output - out
|
||||
* Details : Idx element value from in vector is replicated to all
|
||||
@@ -1344,8 +1403,7 @@ static inline __m256i __lasx_xvclip255_w(__m256i in)
|
||||
* out : 11,11,11,11, 11,11,11,11, 11,11,11,11, 11,11,11,11
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvsplati_l_h(__m256i in, int idx)
|
||||
{
|
||||
static inline __m256i __lasx_xvsplati_l_h(__m256i in, int idx) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvpermi_q(in, in, 0x02);
|
||||
@@ -1356,8 +1414,8 @@ static inline __m256i __lasx_xvsplati_l_h(__m256i in, int idx)
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : Indexed halfword element values are replicated to all
|
||||
* elements in output vector. If 'indx < 8' use xvsplati_l_*,
|
||||
* if 'indx >= 8' use xvsplati_h_*.
|
||||
* elements in output vector. If 'idx < 8' use xvsplati_l_*,
|
||||
* if 'idx >= 8' use xvsplati_h_*.
|
||||
* Arguments : Inputs - in, idx
|
||||
* Output - out
|
||||
* Details : Idx element value from in vector is replicated to all
|
||||
@@ -1369,8 +1427,7 @@ static inline __m256i __lasx_xvsplati_l_h(__m256i in, int idx)
|
||||
* out : 2,2,2,2, 2,2,2,2, 2,2,2,2, 2,2,2,2
|
||||
* =============================================================================
|
||||
*/
|
||||
static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
{
|
||||
static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx) {
|
||||
__m256i out;
|
||||
|
||||
out = __lasx_xvpermi_q(in, in, 0x13);
|
||||
@@ -1380,7 +1437,7 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
* Description : Transpose 4x4 block with double word elements in vectors
|
||||
* Description : Transpose 4x4 block with double-word elements in vectors
|
||||
* Arguments : Inputs - _in0, _in1, _in2, _in3
|
||||
* Outputs - _out0, _out1, _out2, _out3
|
||||
* Example : LASX_TRANSPOSE4x4_D
|
||||
@@ -1395,7 +1452,8 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* _out3 : 4,4,4,4
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LASX_TRANSPOSE4x4_D(_in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3) \
|
||||
#define LASX_TRANSPOSE4x4_D(_in0, _in1, _in2, _in3, _out0, _out1, _out2, \
|
||||
_out3) \
|
||||
{ \
|
||||
__m256i _tmp0, _tmp1, _tmp2, _tmp3; \
|
||||
_tmp0 = __lasx_xvilvl_d(_in1, _in0); \
|
||||
@@ -1412,7 +1470,8 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* =============================================================================
|
||||
* Description : Transpose 8x8 block with word elements in vectors
|
||||
* Arguments : Inputs - _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7
|
||||
* Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
|
||||
* Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6,
|
||||
* _out7
|
||||
* Example : LASX_TRANSPOSE8x8_W
|
||||
* _in0 : 1,2,3,4,5,6,7,8
|
||||
* _in1 : 2,2,3,4,5,6,7,8
|
||||
@@ -1434,7 +1493,8 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LASX_TRANSPOSE8x8_W(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7) \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
__m256i _s0_m, _s1_m; \
|
||||
__m256i _tmp0_m, _tmp1_m, _tmp2_m, _tmp3_m; \
|
||||
@@ -1472,15 +1532,17 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* Arguments : Inputs - _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7,
|
||||
* _in8, _in9, _in10, _in11, _in12, _in13, _in14, _in15
|
||||
* (input 16x8 byte block)
|
||||
* Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
|
||||
* (output 8x16 byte block)
|
||||
* Details : The rows of the matrix become columns, and the columns become rows.
|
||||
* Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6,
|
||||
* _out7 (output 8x16 byte block)
|
||||
* Details : The rows of the matrix become columns, and the columns become
|
||||
* rows.
|
||||
* Example : See LASX_TRANSPOSE16x8_H
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LASX_TRANSPOSE16x8_B(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_in8, _in9, _in10, _in11, _in12, _in13, _in14, _in15, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7) \
|
||||
_in8, _in9, _in10, _in11, _in12, _in13, _in14, \
|
||||
_in15, _out0, _out1, _out2, _out3, _out4, _out5, \
|
||||
_out6, _out7) \
|
||||
{ \
|
||||
__m256i _tmp0_m, _tmp1_m, _tmp2_m, _tmp3_m; \
|
||||
__m256i _tmp4_m, _tmp5_m, _tmp6_m, _tmp7_m; \
|
||||
@@ -1525,9 +1587,10 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* Arguments : Inputs - _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7,
|
||||
* _in8, _in9, _in10, _in11, _in12, _in13, _in14, _in15
|
||||
* (input 16x8 byte block)
|
||||
* Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
|
||||
* (output 8x16 byte block)
|
||||
* Details : The rows of the matrix become columns, and the columns become rows.
|
||||
* Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6,
|
||||
* _out7 (output 8x16 byte block)
|
||||
* Details : The rows of the matrix become columns, and the columns become
|
||||
* rows.
|
||||
* Example : LASX_TRANSPOSE16x8_H
|
||||
* _in0 : 1,2,3,4,5,6,7,8,0,0,0,0,0,0,0,0
|
||||
* _in1 : 2,2,3,4,5,6,7,8,0,0,0,0,0,0,0,0
|
||||
@@ -1557,8 +1620,9 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LASX_TRANSPOSE16x8_H(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_in8, _in9, _in10, _in11, _in12, _in13, _in14, _in15, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7) \
|
||||
_in8, _in9, _in10, _in11, _in12, _in13, _in14, \
|
||||
_in15, _out0, _out1, _out2, _out3, _out4, _out5, \
|
||||
_out6, _out7) \
|
||||
{ \
|
||||
__m256i _tmp0_m, _tmp1_m, _tmp2_m, _tmp3_m; \
|
||||
__m256i _tmp4_m, _tmp5_m, _tmp6_m, _tmp7_m; \
|
||||
@@ -1629,11 +1693,13 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* Arguments : Inputs - _in0, _in1, _in2, _in3
|
||||
* Outputs - _out0, _out1, _out2, _out3
|
||||
* Return Type - signed halfword
|
||||
* Details : The rows of the matrix become columns, and the columns become rows.
|
||||
* Details : The rows of the matrix become columns, and the columns become
|
||||
* rows.
|
||||
* Example : See LASX_TRANSPOSE8x8_H
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LASX_TRANSPOSE4x4_H(_in0, _in1, _in2, _in3, _out0, _out1, _out2, _out3) \
|
||||
#define LASX_TRANSPOSE4x4_H(_in0, _in1, _in2, _in3, _out0, _out1, _out2, \
|
||||
_out3) \
|
||||
{ \
|
||||
__m256i _s0_m, _s1_m; \
|
||||
\
|
||||
@@ -1650,13 +1716,14 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* Description : Transpose input 8x8 byte block
|
||||
* Arguments : Inputs - _in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7
|
||||
* (input 8x8 byte block)
|
||||
* Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7
|
||||
* (output 8x8 byte block)
|
||||
* Outputs - _out0, _out1, _out2, _out3, _out4, _out5, _out6,
|
||||
* _out7 (output 8x8 byte block)
|
||||
* Example : See LASX_TRANSPOSE8x8_H
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LASX_TRANSPOSE8x8_B(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, _out0, \
|
||||
_out1, _out2, _out3, _out4, _out5, _out6, _out7) \
|
||||
#define LASX_TRANSPOSE8x8_B(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
__m256i _tmp0_m, _tmp1_m, _tmp2_m, _tmp3_m; \
|
||||
__m256i _tmp4_m, _tmp5_m, _tmp6_m, _tmp7_m; \
|
||||
@@ -1683,7 +1750,8 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* Description : Transpose 8x8 block with halfword elements in vectors.
|
||||
* Arguments : Inputs - _in0, _in1, ~
|
||||
* Outputs - _out0, _out1, ~
|
||||
* Details : The rows of the matrix become columns, and the columns become rows.
|
||||
* Details : The rows of the matrix become columns, and the columns become
|
||||
* rows.
|
||||
* Example : LASX_TRANSPOSE8x8_H
|
||||
* _in0 : 1,2,3,4, 5,6,7,8, 1,2,3,4, 5,6,7,8
|
||||
* _in1 : 8,2,3,4, 5,6,7,8, 8,2,3,4, 5,6,7,8
|
||||
@@ -1704,8 +1772,9 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* _out7 : 8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LASX_TRANSPOSE8x8_H(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, _out0, \
|
||||
_out1, _out2, _out3, _out4, _out5, _out6, _out7) \
|
||||
#define LASX_TRANSPOSE8x8_H(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
__m256i _s0_m, _s1_m; \
|
||||
__m256i _tmp0_m, _tmp1_m, _tmp2_m, _tmp3_m; \
|
||||
@@ -1799,7 +1868,8 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
* =============================================================================
|
||||
*/
|
||||
#define LASX_BUTTERFLY_8_B(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7)\
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
_out0 = __lasx_xvadd_b(_in0, _in7); \
|
||||
_out1 = __lasx_xvadd_b(_in1, _in6); \
|
||||
@@ -1812,7 +1882,8 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
}
|
||||
|
||||
#define LASX_BUTTERFLY_8_H(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7)\
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
_out0 = __lasx_xvadd_h(_in0, _in7); \
|
||||
_out1 = __lasx_xvadd_h(_in1, _in6); \
|
||||
@@ -1825,7 +1896,8 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
}
|
||||
|
||||
#define LASX_BUTTERFLY_8_W(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7)\
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
_out0 = __lasx_xvadd_w(_in0, _in7); \
|
||||
_out1 = __lasx_xvadd_w(_in1, _in6); \
|
||||
@@ -1838,7 +1910,8 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
}
|
||||
|
||||
#define LASX_BUTTERFLY_8_D(_in0, _in1, _in2, _in3, _in4, _in5, _in6, _in7, \
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, _out7)\
|
||||
_out0, _out1, _out2, _out3, _out4, _out5, _out6, \
|
||||
_out7) \
|
||||
{ \
|
||||
_out0 = __lasx_xvadd_d(_in0, _in7); \
|
||||
_out1 = __lasx_xvadd_d(_in1, _in6); \
|
||||
@@ -1867,10 +1940,8 @@ static inline __m256i __lasx_xvsplati_h_h(__m256i in, int idx)
|
||||
{ \
|
||||
RTYPE _tmp0 = (RTYPE)in0; \
|
||||
int _i = 0; \
|
||||
if (enter) \
|
||||
printf("\nVP:"); \
|
||||
for(_i = 0; _i < element_num; _i++) \
|
||||
printf("%d,",_tmp0[_i]); \
|
||||
if (enter) printf("\nVP:"); \
|
||||
for (_i = 0; _i < element_num; _i++) printf("%d,", _tmp0[_i]); \
|
||||
}
|
||||
|
||||
#endif /* LOONGSON_INTRINSICS_H */
|
||||
|
Reference in New Issue
Block a user