Skip to content

Commit

Permalink
Add vext2xv testcases, try to fix xvshuf
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 14, 2023
1 parent fcb7d85 commit de77119
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 10 deletions.
3 changes: 2 additions & 1 deletion code/gen_tb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
widths_fp = ["s", "d"]
widths_all = ["b", "bu", "h", "hu", "w", "wu", "d", "du"]
widths_vexth = ["h_b", "hu_bu", "w_h", "wu_hu", "d_w", "du_wu", "q_d", "qu_du"]
widths_vext2xv = ["h_b", "hu_bu", "w_b", "wu_bu", "w_h", "wu_hu", "d_b", "du_bu", "d_h", "du_hu", "d_w", "du_wu"]
widths_vsllwil = ["h_b", "hu_bu", "w_h", "wu_hu", "d_w", "du_wu"]
widths_vsrln = ["b_h", "h_w", "w_d"]
widths_vssrln = ["b_h", "bu_h", "h_w", "hu_w", "w_d", "wu_d"]
Expand Down Expand Up @@ -67,7 +68,7 @@
"v128 a, v128 b, int imm",
[0, 3, 7, 15, 16, 32, 64, 128, 255],
),
"vext2xv": (widths_vsllwil, "v128 a"),
"vext2xv": (widths_vext2xv, "v128 a"),
"vfrstp": (widths_vfrstp, "v128 a, v128 b, v128 c"),
"vfrstpi": (widths_vfrstp, "v128 a, v128 b, int imm", [0, 4, 31]),
"vhaddw": (widths_vexth, "v128 a, v128 b"),
Expand Down
9 changes: 9 additions & 0 deletions code/vext2xv_d_b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "common.h"

v256 vext2xv_d_b(v256 a) {
v256 dst;
#include "vext2xv_d_b.h"
return dst;
}

void test() { XFUZZ1(vext2xv_d_b); }
9 changes: 9 additions & 0 deletions code/vext2xv_d_h.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "common.h"

v256 vext2xv_d_h(v256 a) {
v256 dst;
#include "vext2xv_d_h.h"
return dst;
}

void test() { XFUZZ1(vext2xv_d_h); }
9 changes: 9 additions & 0 deletions code/vext2xv_du_bu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "common.h"

v256 vext2xv_du_bu(v256 a) {
v256 dst;
#include "vext2xv_du_bu.h"
return dst;
}

void test() { XFUZZ1(vext2xv_du_bu); }
9 changes: 9 additions & 0 deletions code/vext2xv_du_hu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "common.h"

v256 vext2xv_du_hu(v256 a) {
v256 dst;
#include "vext2xv_du_hu.h"
return dst;
}

void test() { XFUZZ1(vext2xv_du_hu); }
9 changes: 9 additions & 0 deletions code/vext2xv_w_b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "common.h"

v256 vext2xv_w_b(v256 a) {
v256 dst;
#include "vext2xv_w_b.h"
return dst;
}

void test() { XFUZZ1(vext2xv_w_b); }
9 changes: 9 additions & 0 deletions code/vext2xv_wu_bu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "common.h"

v256 vext2xv_wu_bu(v256 a) {
v256 dst;
#include "vext2xv_wu_bu.h"
return dst;
}

void test() { XFUZZ1(vext2xv_wu_bu); }
2 changes: 1 addition & 1 deletion code/vshuf_h.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ for (int i = 0; i < 8; i++) {
} else {
dst.half[i] = b.half[a.half[i] % 8];
}
}
}
10 changes: 6 additions & 4 deletions code/xvshuf_b.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
for (int i = 0; i < 32; i++) {
if ((c.byte[i] % 64) < 32) {
dst.byte[i] = b.byte[c.byte[i] % 32];
if (c.byte[i] >= 64) {
dst.byte[i] = 0;
} else if ((c.byte[i] % 32) < 16) {
dst.byte[i] = b.byte[(c.byte[i] % 32) + ((i >= 16) ? 16 : 0)];
} else {
dst.byte[i] = a.byte[c.byte[i] % 32];
dst.byte[i] = a.byte[(c.byte[i] % 32) + ((i >= 16) ? 0 : -16)];
}
}
}
10 changes: 6 additions & 4 deletions code/xvshuf_h.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
for (int i = 0; i < 16; i++) {
if ((a.half[i] % 32) < 16) {
dst.half[i] = c.half[a.half[i] % 16];
if ((c.half[i] % 256) >= 64) {
dst.half[i] = 0;
} else if ((c.half[i] % 16) < 8) {
dst.half[i] = b.half[(c.half[i] % 16) + ((i >= 8) ? 8 : 0)];
} else {
dst.half[i] = b.half[a.half[i] % 16];
dst.half[i] = a.half[(c.half[i] % 16) + ((i >= 8) ? 0 : -8)];
}
}
}

0 comments on commit de77119

Please sign in to comment.