Skip to content

Commit

Permalink
Fix vpickve2gr/xvpickve2gr
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Dec 14, 2023
1 parent 4a70743 commit e50f500
Show file tree
Hide file tree
Showing 32 changed files with 210 additions and 31 deletions.
2 changes: 2 additions & 0 deletions code/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ void print(const char *s, __m256d num) {
printf("__m256d %s: %lf %lf %lf %lf\n", s, num[0], num[1], num[2], num[3]);
}

void print(const char *s, int num) { printf("int %s: %d\n", s, num); }

#define PRINT(x) print(#x, x)

#define FUZZ_N 128
Expand Down
2 changes: 1 addition & 1 deletion code/gen_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@
# skip xvpickve2gr_b/bu/h/hu
if prefix != "xv" or (width[0] != "b" and width[0] != "h"):
with open(f"{prefix}pickve2gr_{width}.h", "w") as f:
print(f"dst = a.{m}[idx];", file=f)
print(f"dst = ({sign}{w})a.{m}[idx];", file=f)

for width in ["b", "bu", "h", "hu", "w", "wu", "d", "du"]:
double_width = double_widths[width]
Expand Down
15 changes: 14 additions & 1 deletion code/gen_tb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@
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_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
14 changes: 13 additions & 1 deletion code/untested.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,16 @@
for f in sorted(glob.glob("*.h")):
src = f.replace(".h", ".cpp")
if not os.path.exists(src):
print(f"Missing {src}")
if (
src.startswith("xvf")
or src.startswith("vf")
or src.startswith("xvset")
or src.startswith("vset")
or src.startswith("xvld")
or src.startswith("vld")
or src.startswith("xvst")
or src.startswith("vst")
):
# skipped
continue
print(f"Missing {src}")
12 changes: 12 additions & 0 deletions code/vpickve2gr_b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

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

void test() {
FUZZ1(vpickve2gr_b, 0);
FUZZ1(vpickve2gr_b, 7);
}
2 changes: 1 addition & 1 deletion code/vpickve2gr_b.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.byte[idx];
dst = (s8)a.byte[idx];
12 changes: 12 additions & 0 deletions code/vpickve2gr_bu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

unsigned int vpickve2gr_bu(v128 a, int idx) {
unsigned int dst;
#include "vpickve2gr_bu.h"
return dst;
}

void test() {
FUZZ1(vpickve2gr_bu, 0);
FUZZ1(vpickve2gr_bu, 7);
}
2 changes: 1 addition & 1 deletion code/vpickve2gr_bu.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.byte[idx];
dst = (u8)a.byte[idx];
12 changes: 12 additions & 0 deletions code/vpickve2gr_d.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

long int vpickve2gr_d(v128 a, int idx) {
long int dst;
#include "vpickve2gr_d.h"
return dst;
}

void test() {
FUZZ1(vpickve2gr_d, 0);
FUZZ1(vpickve2gr_d, 1);
}
2 changes: 1 addition & 1 deletion code/vpickve2gr_d.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.dword[idx];
dst = (s64)a.dword[idx];
12 changes: 12 additions & 0 deletions code/vpickve2gr_du.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

unsigned long int vpickve2gr_du(v128 a, int idx) {
unsigned long int dst;
#include "vpickve2gr_du.h"
return dst;
}

void test() {
FUZZ1(vpickve2gr_du, 0);
FUZZ1(vpickve2gr_du, 1);
}
2 changes: 1 addition & 1 deletion code/vpickve2gr_du.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.dword[idx];
dst = (u64)a.dword[idx];
12 changes: 12 additions & 0 deletions code/vpickve2gr_h.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

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

void test() {
FUZZ1(vpickve2gr_h, 0);
FUZZ1(vpickve2gr_h, 7);
}
2 changes: 1 addition & 1 deletion code/vpickve2gr_h.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.half[idx];
dst = (s16)a.half[idx];
12 changes: 12 additions & 0 deletions code/vpickve2gr_hu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

unsigned int vpickve2gr_hu(v128 a, int idx) {
unsigned int dst;
#include "vpickve2gr_hu.h"
return dst;
}

void test() {
FUZZ1(vpickve2gr_hu, 0);
FUZZ1(vpickve2gr_hu, 7);
}
2 changes: 1 addition & 1 deletion code/vpickve2gr_hu.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.half[idx];
dst = (u16)a.half[idx];
12 changes: 12 additions & 0 deletions code/vpickve2gr_w.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

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

void test() {
FUZZ1(vpickve2gr_w, 0);
FUZZ1(vpickve2gr_w, 3);
}
2 changes: 1 addition & 1 deletion code/vpickve2gr_w.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.word[idx];
dst = (s32)a.word[idx];
12 changes: 12 additions & 0 deletions code/vpickve2gr_wu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

unsigned int vpickve2gr_wu(v128 a, int idx) {
unsigned int dst;
#include "vpickve2gr_wu.h"
return dst;
}

void test() {
FUZZ1(vpickve2gr_wu, 0);
FUZZ1(vpickve2gr_wu, 3);
}
2 changes: 1 addition & 1 deletion code/vpickve2gr_wu.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.word[idx];
dst = (u32)a.word[idx];
8 changes: 0 additions & 8 deletions code/vssran_du_q.h

This file was deleted.

8 changes: 0 additions & 8 deletions code/vssrln_du_q.h

This file was deleted.

9 changes: 9 additions & 0 deletions code/xvbitsel_v.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "common.h"

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

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

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

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

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

void test() {
XFUZZ1(xvpickve2gr_d, 0);
XFUZZ1(xvpickve2gr_d, 3);
}
2 changes: 1 addition & 1 deletion code/xvpickve2gr_d.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.dword[idx];
dst = (s64)a.dword[idx];
12 changes: 12 additions & 0 deletions code/xvpickve2gr_du.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

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

void test() {
XFUZZ1(xvpickve2gr_du, 0);
XFUZZ1(xvpickve2gr_du, 3);
}
2 changes: 1 addition & 1 deletion code/xvpickve2gr_du.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.dword[idx];
dst = (u64)a.dword[idx];
12 changes: 12 additions & 0 deletions code/xvpickve2gr_w.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

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

void test() {
XFUZZ1(xvpickve2gr_w, 0);
XFUZZ1(xvpickve2gr_w, 7);
}
2 changes: 1 addition & 1 deletion code/xvpickve2gr_w.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.word[idx];
dst = (s32)a.word[idx];
12 changes: 12 additions & 0 deletions code/xvpickve2gr_wu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "common.h"

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

void test() {
XFUZZ1(xvpickve2gr_wu, 0);
XFUZZ1(xvpickve2gr_wu, 7);
}
2 changes: 1 addition & 1 deletion code/xvpickve2gr_wu.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dst = a.word[idx];
dst = (u32)a.word[idx];

0 comments on commit e50f500

Please sign in to comment.