From 98459d18558722dddd27f0b759d4a45870275104 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Thu, 14 Dec 2023 11:07:57 +0800 Subject: [PATCH] Add more lasx tests --- code/gen_tb.py | 18 ++++++++++++++++-- code/vandi_b.cpp | 7 ++----- code/vbsll_v.cpp | 6 ------ code/vbsrl_v.cpp | 6 ------ code/vnori_b.cpp | 7 ++----- code/vori_b.cpp | 7 ++----- code/vorn_v.cpp | 6 +++--- code/vxori_b.cpp | 7 ++----- code/xvabsd_b.cpp | 9 +++++++++ code/xvabsd_bu.cpp | 9 +++++++++ code/xvabsd_d.cpp | 9 +++++++++ code/xvabsd_du.cpp | 9 +++++++++ code/xvabsd_h.cpp | 9 +++++++++ code/xvabsd_hu.cpp | 9 +++++++++ code/xvabsd_w.cpp | 9 +++++++++ code/xvabsd_wu.cpp | 9 +++++++++ code/xvadd_q.cpp | 9 +++++++++ code/xvadd_q.h | 2 +- code/xvadda_b.cpp | 9 +++++++++ code/xvadda_d.cpp | 9 +++++++++ code/xvadda_h.cpp | 9 +++++++++ code/xvadda_w.cpp | 9 +++++++++ code/xvand_v.cpp | 9 +++++++++ code/xvandi_b.cpp | 12 ++++++++++++ code/xvandn_v.cpp | 9 +++++++++ code/xvbsll_v.cpp | 12 ++++++++++++ code/xvbsrl_v.cpp | 12 ++++++++++++ code/xvnor_v.cpp | 9 +++++++++ code/xvnori_b.cpp | 12 ++++++++++++ code/xvor_v.cpp | 9 +++++++++ code/xvori_b.cpp | 12 ++++++++++++ code/xvorn_v.cpp | 9 +++++++++ code/xvsub_q.h | 2 +- code/xvxor_v.cpp | 9 +++++++++ code/xvxori_b.cpp | 12 ++++++++++++ 35 files changed, 272 insertions(+), 39 deletions(-) create mode 100644 code/xvabsd_b.cpp create mode 100644 code/xvabsd_bu.cpp create mode 100644 code/xvabsd_d.cpp create mode 100644 code/xvabsd_du.cpp create mode 100644 code/xvabsd_h.cpp create mode 100644 code/xvabsd_hu.cpp create mode 100644 code/xvabsd_w.cpp create mode 100644 code/xvabsd_wu.cpp create mode 100644 code/xvadd_q.cpp create mode 100644 code/xvadda_b.cpp create mode 100644 code/xvadda_d.cpp create mode 100644 code/xvadda_h.cpp create mode 100644 code/xvadda_w.cpp create mode 100644 code/xvand_v.cpp create mode 100644 code/xvandi_b.cpp create mode 100644 code/xvandn_v.cpp create mode 100644 code/xvbsll_v.cpp create mode 100644 code/xvbsrl_v.cpp create mode 100644 code/xvnor_v.cpp create mode 100644 code/xvnori_b.cpp create mode 100644 code/xvor_v.cpp create mode 100644 code/xvori_b.cpp create mode 100644 code/xvorn_v.cpp create mode 100644 code/xvxor_v.cpp create mode 100644 code/xvxori_b.cpp diff --git a/code/gen_tb.py b/code/gen_tb.py index 532b5de5..3aa59640 100644 --- a/code/gen_tb.py +++ b/code/gen_tb.py @@ -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"), @@ -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"), @@ -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"), @@ -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]), @@ -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: diff --git a/code/vandi_b.cpp b/code/vandi_b.cpp index 72a267c6..81e26fe5 100644 --- a/code/vandi_b.cpp +++ b/code/vandi_b.cpp @@ -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); } diff --git a/code/vbsll_v.cpp b/code/vbsll_v.cpp index 9ea2e951..4cf6039b 100644 --- a/code/vbsll_v.cpp +++ b/code/vbsll_v.cpp @@ -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); } diff --git a/code/vbsrl_v.cpp b/code/vbsrl_v.cpp index c00ab86c..1a7a757f 100644 --- a/code/vbsrl_v.cpp +++ b/code/vbsrl_v.cpp @@ -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); } diff --git a/code/vnori_b.cpp b/code/vnori_b.cpp index 2abb2ad8..4a21e206 100644 --- a/code/vnori_b.cpp +++ b/code/vnori_b.cpp @@ -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); } diff --git a/code/vori_b.cpp b/code/vori_b.cpp index d6970f62..1c1fc328 100644 --- a/code/vori_b.cpp +++ b/code/vori_b.cpp @@ -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); } diff --git a/code/vorn_v.cpp b/code/vorn_v.cpp index d875b575..c98b27d1 100644 --- a/code/vorn_v.cpp +++ b/code/vorn_v.cpp @@ -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); } diff --git a/code/vxori_b.cpp b/code/vxori_b.cpp index f8732438..a1210b4d 100644 --- a/code/vxori_b.cpp +++ b/code/vxori_b.cpp @@ -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); } diff --git a/code/xvabsd_b.cpp b/code/xvabsd_b.cpp new file mode 100644 index 00000000..b12e37a6 --- /dev/null +++ b/code/xvabsd_b.cpp @@ -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); } diff --git a/code/xvabsd_bu.cpp b/code/xvabsd_bu.cpp new file mode 100644 index 00000000..f78b77be --- /dev/null +++ b/code/xvabsd_bu.cpp @@ -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); } diff --git a/code/xvabsd_d.cpp b/code/xvabsd_d.cpp new file mode 100644 index 00000000..ba7afd7e --- /dev/null +++ b/code/xvabsd_d.cpp @@ -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); } diff --git a/code/xvabsd_du.cpp b/code/xvabsd_du.cpp new file mode 100644 index 00000000..84ccc8a3 --- /dev/null +++ b/code/xvabsd_du.cpp @@ -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); } diff --git a/code/xvabsd_h.cpp b/code/xvabsd_h.cpp new file mode 100644 index 00000000..c2fd5e09 --- /dev/null +++ b/code/xvabsd_h.cpp @@ -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); } diff --git a/code/xvabsd_hu.cpp b/code/xvabsd_hu.cpp new file mode 100644 index 00000000..f71733e9 --- /dev/null +++ b/code/xvabsd_hu.cpp @@ -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); } diff --git a/code/xvabsd_w.cpp b/code/xvabsd_w.cpp new file mode 100644 index 00000000..f7fc2555 --- /dev/null +++ b/code/xvabsd_w.cpp @@ -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); } diff --git a/code/xvabsd_wu.cpp b/code/xvabsd_wu.cpp new file mode 100644 index 00000000..8fb298ea --- /dev/null +++ b/code/xvabsd_wu.cpp @@ -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); } diff --git a/code/xvadd_q.cpp b/code/xvadd_q.cpp new file mode 100644 index 00000000..683b239d --- /dev/null +++ b/code/xvadd_q.cpp @@ -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); } diff --git a/code/xvadd_q.h b/code/xvadd_q.h index b406be11..f8739d80 100644 --- a/code/xvadd_q.h +++ b/code/xvadd_q.h @@ -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]; } diff --git a/code/xvadda_b.cpp b/code/xvadda_b.cpp new file mode 100644 index 00000000..41960c77 --- /dev/null +++ b/code/xvadda_b.cpp @@ -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); } diff --git a/code/xvadda_d.cpp b/code/xvadda_d.cpp new file mode 100644 index 00000000..8fa4e615 --- /dev/null +++ b/code/xvadda_d.cpp @@ -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); } diff --git a/code/xvadda_h.cpp b/code/xvadda_h.cpp new file mode 100644 index 00000000..6fd172a9 --- /dev/null +++ b/code/xvadda_h.cpp @@ -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); } diff --git a/code/xvadda_w.cpp b/code/xvadda_w.cpp new file mode 100644 index 00000000..891aad28 --- /dev/null +++ b/code/xvadda_w.cpp @@ -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); } diff --git a/code/xvand_v.cpp b/code/xvand_v.cpp new file mode 100644 index 00000000..ffca1f7c --- /dev/null +++ b/code/xvand_v.cpp @@ -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); } diff --git a/code/xvandi_b.cpp b/code/xvandi_b.cpp new file mode 100644 index 00000000..7d315b68 --- /dev/null +++ b/code/xvandi_b.cpp @@ -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); +} diff --git a/code/xvandn_v.cpp b/code/xvandn_v.cpp new file mode 100644 index 00000000..15437086 --- /dev/null +++ b/code/xvandn_v.cpp @@ -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); } diff --git a/code/xvbsll_v.cpp b/code/xvbsll_v.cpp new file mode 100644 index 00000000..40892877 --- /dev/null +++ b/code/xvbsll_v.cpp @@ -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); +} diff --git a/code/xvbsrl_v.cpp b/code/xvbsrl_v.cpp new file mode 100644 index 00000000..982bacb2 --- /dev/null +++ b/code/xvbsrl_v.cpp @@ -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); +} diff --git a/code/xvnor_v.cpp b/code/xvnor_v.cpp new file mode 100644 index 00000000..627b26a4 --- /dev/null +++ b/code/xvnor_v.cpp @@ -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); } diff --git a/code/xvnori_b.cpp b/code/xvnori_b.cpp new file mode 100644 index 00000000..ec9b5dd3 --- /dev/null +++ b/code/xvnori_b.cpp @@ -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); +} diff --git a/code/xvor_v.cpp b/code/xvor_v.cpp new file mode 100644 index 00000000..2eb81e7a --- /dev/null +++ b/code/xvor_v.cpp @@ -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); } diff --git a/code/xvori_b.cpp b/code/xvori_b.cpp new file mode 100644 index 00000000..630b4815 --- /dev/null +++ b/code/xvori_b.cpp @@ -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); +} diff --git a/code/xvorn_v.cpp b/code/xvorn_v.cpp new file mode 100644 index 00000000..c0744024 --- /dev/null +++ b/code/xvorn_v.cpp @@ -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); } diff --git a/code/xvsub_q.h b/code/xvsub_q.h index 3c00c47f..3e01f9e6 100644 --- a/code/xvsub_q.h +++ b/code/xvsub_q.h @@ -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]; } diff --git a/code/xvxor_v.cpp b/code/xvxor_v.cpp new file mode 100644 index 00000000..63a55e43 --- /dev/null +++ b/code/xvxor_v.cpp @@ -0,0 +1,9 @@ +#include "common.h" + +v256 xvxor_v(v256 a, v256 b) { + v256 dst; +#include "xvxor_v.h" + return dst; +} + +void test() { XFUZZ2(xvxor_v); } diff --git a/code/xvxori_b.cpp b/code/xvxori_b.cpp new file mode 100644 index 00000000..49aa184e --- /dev/null +++ b/code/xvxori_b.cpp @@ -0,0 +1,12 @@ +#include "common.h" + +v256 xvxori_b(v256 a, int imm) { + v256 dst; +#include "xvxori_b.h" + return dst; +} + +void test() { + XFUZZ1(xvxori_b, 0); + XFUZZ1(xvxori_b, 31); +}