Skip to content

Commit

Permalink
Add missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 14, 2023
1 parent e50f500 commit 937c897
Show file tree
Hide file tree
Showing 26 changed files with 275 additions and 10 deletions.
8 changes: 7 additions & 1 deletion code/gen_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1262,12 +1262,18 @@
print(f"}}", file=f)
else:
with open(f"{prefix}repl128vei_{width}.h", "w") as f:
print(f"for (int i = 0;i < {vlen // w};i++) {{", file=f)
print(f"for (int i = 0;i < {vlen // 2 // w};i++) {{", file=f)
print(
f" dst.{m}[i] = a.{m}[idx];",
file=f,
)
print(f"}}", file=f)
print(f"for (int i = {vlen // 2 // w};i < {vlen // w};i++) {{", file=f)
print(
f" dst.{m}[i] = a.{m}[idx + {vlen // 2 // w}];",
file=f,
)
print(f"}}", file=f)
with open(f"{prefix}replgr2vr_{width}.h", "w") as f:
print(f"for (int i = 0;i < {vlen // w};i++) {{", file=f)
print(
Expand Down
13 changes: 13 additions & 0 deletions code/xvinsve0_d.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "common.h"

v256 xvinsve0_d(v256 a, v256 b, int imm) {
v256 dst;
#include "xvinsve0_d.h"
return dst;
}

void test() {
XFUZZ2(xvinsve0_d, 0);
XFUZZ2(xvinsve0_d, 1);
XFUZZ2(xvinsve0_d, 2);
}
13 changes: 13 additions & 0 deletions code/xvinsve0_w.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "common.h"

v256 xvinsve0_w(v256 a, v256 b, int imm) {
v256 dst;
#include "xvinsve0_w.h"
return dst;
}

void test() {
XFUZZ2(xvinsve0_w, 0);
XFUZZ2(xvinsve0_w, 1);
XFUZZ2(xvinsve0_w, 2);
}
13 changes: 13 additions & 0 deletions code/xvperm_w.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "common.h"

v256 xvperm_w(v256 a, v256 b) {
v256 dst;
#include "xvperm_w.h"
return dst;
}

void test() {
XFUZZ2(xvperm_w);
XFUZZ2(xvperm_w);
XFUZZ2(xvperm_w);
}
2 changes: 1 addition & 1 deletion code/xvperm_w.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
for (int i = 0; i < 8; i++) {
dst.word[i] = a.word[b.word[i] & 0x8];
dst.word[i] = a.word[b.word[i] % 0x8];
}
14 changes: 14 additions & 0 deletions code/xvpermi_d.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "common.h"

v256 xvpermi_d(v256 a, int imm) {
v256 dst;
#include "xvpermi_d.h"
return dst;
}

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

v256 xvpermi_q(v256 a, v256 b, int imm) {
v256 dst;
#include "xvpermi_q.h"
return dst;
}

void test() {
XFUZZ2(xvpermi_q, 0);
XFUZZ2(xvpermi_q, 1);
XFUZZ2(xvpermi_q, 2);
XFUZZ2(xvpermi_q, 0x10);
XFUZZ2(xvpermi_q, 0xF0);
XFUZZ2(xvpermi_q, 0xFF);
}
7 changes: 3 additions & 4 deletions code/xvpermi_q.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
dst.word[0] = b.word[imm & 0x3];
dst.word[1] = b.word[(imm >> 2) & 0x3];
dst.word[2] = a.word[(imm >> 4) & 0x3];
dst.word[3] = a.word[(imm >> 6) & 0x3];
dst.qword[0] = (imm & 2) ? a.qword[imm & 0x1] : b.qword[imm & 0x1];
dst.qword[1] =
(imm & 0x20) ? a.qword[(imm >> 4) & 0x1] : b.qword[(imm >> 4) & 0x1];
14 changes: 14 additions & 0 deletions code/xvpermi_w.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "common.h"

v256 xvpermi_w(v256 a, v256 b, int imm) {
v256 dst;
#include "xvpermi_w.h"
return dst;
}

void test() {
XFUZZ2(xvpermi_w, 0);
XFUZZ2(xvpermi_w, 1);
XFUZZ2(xvpermi_w, 2);
XFUZZ2(xvpermi_w, 0xFF);
}
14 changes: 14 additions & 0 deletions code/xvpickve_d.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "common.h"

v256 xvpickve_d(v256 a, int imm) {
v256 dst;
#include "xvpickve_d.h"
return dst;
}

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

v256 xvpickve_d_f(v256 a, int imm) {
v256 dst;
#include "xvpickve_d_f.h"
return dst;
}

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

v256 xvpickve_w(v256 a, int imm) {
v256 dst;
#include "xvpickve_w.h"
return dst;
}

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

v256 xvpickve_w(v256 a, int imm) {
v256 dst;
#include "xvpickve_w.h"
return dst;
}

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

v256 xvrepl128vei_b(v256 a, int idx) {
v256 dst;
#include "xvrepl128vei_b.h"
return dst;
}

void test() {
XFUZZ1(xvrepl128vei_b, 0);
XFUZZ1(xvrepl128vei_b, 1);
XFUZZ1(xvrepl128vei_b, 2);
XFUZZ1(xvrepl128vei_b, 3);
}
5 changes: 4 additions & 1 deletion code/xvrepl128vei_b.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
for (int i = 0; i < 32; i++) {
for (int i = 0; i < 16; i++) {
dst.byte[i] = a.byte[idx];
}
for (int i = 16; i < 32; i++) {
dst.byte[i] = a.byte[idx + 16];
}
12 changes: 12 additions & 0 deletions code/xvrepl128vei_d.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

v256 xvrepl128vei_d(v256 a, int idx) {
v256 dst;
#include "xvrepl128vei_d.h"
return dst;
}

void test() {
XFUZZ1(xvrepl128vei_d, 0);
XFUZZ1(xvrepl128vei_d, 1);
}
5 changes: 4 additions & 1 deletion code/xvrepl128vei_d.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
for (int i = 0; i < 4; i++) {
for (int i = 0; i < 2; i++) {
dst.dword[i] = a.dword[idx];
}
for (int i = 2; i < 4; i++) {
dst.dword[i] = a.dword[idx + 2];
}
14 changes: 14 additions & 0 deletions code/xvrepl128vei_h.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "common.h"

v256 xvrepl128vei_h(v256 a, int idx) {
v256 dst;
#include "xvrepl128vei_h.h"
return dst;
}

void test() {
XFUZZ1(xvrepl128vei_h, 0);
XFUZZ1(xvrepl128vei_h, 1);
XFUZZ1(xvrepl128vei_h, 2);
XFUZZ1(xvrepl128vei_h, 3);
}
5 changes: 4 additions & 1 deletion code/xvrepl128vei_h.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 8; i++) {
dst.half[i] = a.half[idx];
}
for (int i = 8; i < 16; i++) {
dst.half[i] = a.half[idx + 8];
}
14 changes: 14 additions & 0 deletions code/xvrepl128vei_w.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "common.h"

v256 xvrepl128vei_w(v256 a, int idx) {
v256 dst;
#include "xvrepl128vei_w.h"
return dst;
}

void test() {
XFUZZ1(xvrepl128vei_w, 0);
XFUZZ1(xvrepl128vei_w, 1);
XFUZZ1(xvrepl128vei_w, 2);
XFUZZ1(xvrepl128vei_w, 3);
}
5 changes: 4 additions & 1 deletion code/xvrepl128vei_w.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
for (int i = 0; i < 8; i++) {
for (int i = 0; i < 4; i++) {
dst.word[i] = a.word[idx];
}
for (int i = 4; i < 8; i++) {
dst.word[i] = a.word[idx + 4];
}
11 changes: 11 additions & 0 deletions code/xvreplve0_b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "common.h"

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

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

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

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

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

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

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

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

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

void test() {
XFUZZ1(xvreplve0_w);
}

0 comments on commit 937c897

Please sign in to comment.