Skip to content

Commit

Permalink
Expand capabilities of SHIFT_OP
Browse files Browse the repository at this point in the history
SHIFT_OP can now be used for everything excluding psrldq and  pslldq
  • Loading branch information
jason-conway committed Feb 13, 2023
1 parent f982368 commit e8a147f
Showing 1 changed file with 23 additions and 47 deletions.
70 changes: 23 additions & 47 deletions tests/e2e/qemu/qemu-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2306,22 +2306,6 @@ static uint64_t __attribute__((aligned(16))) test_values[4][2] = {
}\
}

#define SHIFT_OP_MM(op,ib)\
{\
int i;\
for(i=0;i<2;i++) {\
a.q[0] = test_values[2*i][0];\
b.q[0] = ib;\
a.q[1] = b.q[1] = 0;\
asm volatile (#op " %2, %0" : "=y" (r.q[0]) : "0" (a.q[0]), "y" (b.q[0]));\
printf("%-9s: a=" FMT64X " b=" FMT64X " r=" FMT64X "\n",\
#op,\
a.q[0],\
b.q[0],\
r.q[0]);\
}\
}

#define SHIFT_OP(op, ib)\
{\
int i;\
Expand All @@ -2338,6 +2322,17 @@ static uint64_t __attribute__((aligned(16))) test_values[4][2] = {
b.q[1], b.q[0],\
r.q[1], r.q[0]);\
}\
for(i=0;i<2;i++) {\
a.q[0] = test_values[2*i][0];\
b.q[0] = ib;\
a.q[1] = b.q[1] = 0;\
asm volatile (#op " %2, %0" : "=y" (r.q[0]) : "0" (a.q[0]), "y" (b.q[0]));\
printf("%-9s: a=" FMT64X " b=" FMT64X " r=" FMT64X "\n",\
#op,\
a.q[0],\
b.q[0],\
r.q[0]);\
}\
}

#define MOVMSK(op)\
Expand Down Expand Up @@ -2646,19 +2641,19 @@ void test_sse(void)
PSHUF_OP(pshuflw, 0x78);
PSHUF_OP(pshufhw, 0x78);

SHIFT_DQ_IM(psrlw, 7);
SHIFT_DQ_IM(psrlw, 16);
SHIFT_DQ_IM(psraw, 7);
SHIFT_DQ_IM(psraw, 16);
SHIFT_DQ_IM(psllw, 7);
SHIFT_DQ_IM(psllw, 16);
SHIFT_OP(psrlw, 7);
SHIFT_OP(psrlw, 16);
SHIFT_OP(psraw, 7);
SHIFT_OP(psraw, 16);
SHIFT_OP(psllw, 7);
SHIFT_OP(psllw, 16);

SHIFT_DQ_IM(psrld, 7);
SHIFT_DQ_IM(psrld, 32);
SHIFT_DQ_IM(psrad, 7);
SHIFT_DQ_IM(psrad, 32);
SHIFT_DQ_IM(pslld, 7);
SHIFT_DQ_IM(pslld, 32);
SHIFT_OP(psrld, 7);
SHIFT_OP(psrld, 32);
SHIFT_OP(psrad, 7);
SHIFT_OP(psrad, 32);
SHIFT_OP(pslld, 7);
SHIFT_OP(pslld, 32);

SHIFT_OP(psrlq, 7);
SHIFT_OP(psrlq, 32);
Expand All @@ -2669,25 +2664,6 @@ void test_sse(void)
SHIFT_DQ_IM(psrldq, 7);
SHIFT_DQ_IM(pslldq, 16);
SHIFT_DQ_IM(pslldq, 7);
SHIFT_IM(psrlq, 16);
SHIFT_IM(psrlq, 7);
SHIFT_IM(psllq, 16);
SHIFT_IM(psllq, 7);

SHIFT_OP_MM(psllw, 16);
SHIFT_OP_MM(psllw, 7);
SHIFT_OP_MM(psrlw, 16);
SHIFT_OP_MM(psrlw, 7);

SHIFT_OP_MM(pslld, 32);
SHIFT_OP_MM(pslld, 7);
SHIFT_OP_MM(psrld, 32);
SHIFT_OP_MM(psrld, 7);

SHIFT_OP_MM(psllq, 32);
SHIFT_OP_MM(psllq, 7);
SHIFT_OP_MM(psrlq, 32);
SHIFT_OP_MM(psrlq, 7);

// MOVMSK(movmskps);
MOVMSK(movmskpd);
Expand Down

0 comments on commit e8a147f

Please sign in to comment.