Skip to content

Commit

Permalink
Add more lasx tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 14, 2023
1 parent 8fac972 commit 98459d1
Show file tree
Hide file tree
Showing 35 changed files with 272 additions and 39 deletions.
18 changes: 16 additions & 2 deletions code/gen_tb.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@

tb = {
# widths, args, extra args for imm
"vadd": (widths_signed, "v128 a, v128 b"),
"vadd": (widths_signed + ["q"], "v128 a, v128 b"),
"vadda": (widths_signed, "v128 a, v128 b"),
"vaddi": (widths_unsigned, "v128 a, int imm", [0, 31]),
"vand": (["v"], "v128 a, v128 b"),
"vandn": (["v"], "v128 a, v128 b"),
"vandi": (["b"], "v128 a, int imm", [0, 31]),
"vabsd": (widths_all, "v128 a, v128 b"),
"vavg": (widths_all, "v128 a, v128 b"),
"vavgr": (widths_all, "v128 a, v128 b"),
"vaddwev": (widths_vaddw, "v128 a, v128 b"),
Expand All @@ -50,6 +55,8 @@
"vbitseti": (widths_signed, "v128 a, int imm", [0, 3, 7]),
"vbitrev": (widths_signed, "v128 a, v128 b"),
"vbitrevi": (widths_signed, "v128 a, int imm", [0, 3, 7]),
"vbsll": (["v"], "v128 a, int imm", [0, 3]),
"vbsrl": (["v"], "v128 a, int imm", [0, 3]),
"vclo": (widths_signed, "v128 a"),
"vclz": (widths_signed, "v128 a"),
"vdiv": (widths_all, "v128 a, v128 b"),
Expand Down Expand Up @@ -88,6 +95,11 @@
"vmulwev": (widths_vaddw, "v128 a, v128 b"),
"vmulwod": (widths_vaddw, "v128 a, v128 b"),
"vneg": (widths_signed, "v128 a"),
"vnor": (["v"], "v128 a, v128 b"),
"vnori": (["b"], "v128 a, int imm", [0, 31]),
"vor": (["v"], "v128 a, v128 b"),
"vorn": (["v"], "v128 a, v128 b"),
"vori": (["b"], "v128 a, int imm", [0, 31]),
"vpackev": (widths_signed, "v128 a, v128 b"),
"vpackod": (widths_signed, "v128 a, v128 b"),
"vpcnt": (widths_signed, "v128 a"),
Expand All @@ -107,7 +119,7 @@
"vsigncov": (widths_signed, "v128 a, v128 b"),
"vsllwil": (widths_vsllwil, "v128 a, int imm", [0, 7]),
"vssub": (widths_all, "v128 a, v128 b"),
"vsub": (widths_signed, "v128 a, v128 b"),
"vsub": (widths_signed + ["q"], "v128 a, v128 b"),
"vsubi": (widths_unsigned, "v128 a, int imm", [0, 31]),
"vsll": (widths_signed, "v128 a, v128 b"),
"vslli": (widths_signed, "v128 a, int imm", [0, 7]),
Expand Down Expand Up @@ -142,6 +154,8 @@
"vsub": (widths_signed, "v128 a, v128 b"),
"vsubwev": (widths_vsubw, "v128 a, v128 b"),
"vsubwod": (widths_vsubw, "v128 a, v128 b"),
"vxor": (["v"], "v128 a, v128 b"),
"vxori": (["b"], "v128 a, int imm", [0, 31]),
}

for name in tb:
Expand Down
7 changes: 2 additions & 5 deletions code/vandi_b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ v128 vandi_b(v128 a, int imm) {
}

void test() {
FUZZ1(vandi_b, 0x00);
FUZZ1(vandi_b, 0x04);
FUZZ1(vandi_b, 0x08);
FUZZ1(vandi_b, 0x10);
FUZZ1(vandi_b, 0xFF);
FUZZ1(vandi_b, 0);
FUZZ1(vandi_b, 31);
}
6 changes: 0 additions & 6 deletions code/vbsll_v.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,4 @@ v128 vbsll_v(v128 a, int imm) {
void test() {
FUZZ1(vbsll_v, 0);
FUZZ1(vbsll_v, 3);
FUZZ1(vbsll_v, 7);
FUZZ1(vbsll_v, 8);
FUZZ1(vbsll_v, 16);
FUZZ1(vbsll_v, 24);
FUZZ1(vbsll_v, 25);
FUZZ1(vbsll_v, 31);
}
6 changes: 0 additions & 6 deletions code/vbsrl_v.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,4 @@ v128 vbsrl_v(v128 a, int imm) {
void test() {
FUZZ1(vbsrl_v, 0);
FUZZ1(vbsrl_v, 3);
FUZZ1(vbsrl_v, 7);
FUZZ1(vbsrl_v, 8);
FUZZ1(vbsrl_v, 16);
FUZZ1(vbsrl_v, 24);
FUZZ1(vbsrl_v, 25);
FUZZ1(vbsrl_v, 31);
}
7 changes: 2 additions & 5 deletions code/vnori_b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ v128 vnori_b(v128 a, int imm) {
}

void test() {
FUZZ1(vnori_b, 0x00);
FUZZ1(vnori_b, 0x04);
FUZZ1(vnori_b, 0x08);
FUZZ1(vnori_b, 0x10);
FUZZ1(vnori_b, 0xFF);
FUZZ1(vnori_b, 0);
FUZZ1(vnori_b, 31);
}
7 changes: 2 additions & 5 deletions code/vori_b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ v128 vori_b(v128 a, int imm) {
}

void test() {
FUZZ1(vori_b, 0x00);
FUZZ1(vori_b, 0x04);
FUZZ1(vori_b, 0x08);
FUZZ1(vori_b, 0x10);
FUZZ1(vori_b, 0xFF);
FUZZ1(vori_b, 0);
FUZZ1(vori_b, 31);
}
6 changes: 3 additions & 3 deletions code/vorn_v.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "common.h"

v128 vnor_v(v128 a, v128 b) {
v128 vorn_v(v128 a, v128 b) {
v128 dst;
#include "vnor_v.h"
#include "vorn_v.h"
return dst;
}

void test() { FUZZ2(vnor_v); }
void test() { FUZZ2(vorn_v); }
7 changes: 2 additions & 5 deletions code/vxori_b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ v128 vxori_b(v128 a, int imm) {
}

void test() {
FUZZ1(vxori_b, 0x00);
FUZZ1(vxori_b, 0x04);
FUZZ1(vxori_b, 0x08);
FUZZ1(vxori_b, 0x10);
FUZZ1(vxori_b, 0xFF);
FUZZ1(vxori_b, 0);
FUZZ1(vxori_b, 31);
}
9 changes: 9 additions & 0 deletions code/xvabsd_b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "common.h"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void test() { XFUZZ2(xvorn_v); }
2 changes: 1 addition & 1 deletion code/xvsub_q.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
for (int i = 0;i < 2;i++) {
for (int i = 0; i < 2; i++) {
dst.qword[i] = a.qword[i] - b.qword[i];
}
Loading

0 comments on commit 98459d1

Please sign in to comment.