This commit is contained in:
wangfiox 2024-06-14 13:22:02 +08:00
parent 3ffa0187d3
commit af0675c1a7
89 changed files with 1839 additions and 1903 deletions

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int set(int a[], int pos, int d){ int set(int a[], int pos, int d){
#define bitcount 30 #define bitcount 30
int x[bitcount + 1] = {}; int x[bitcount + 1] = {};

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int set(int a[], int pos, int d){ int set(int a[], int pos, int d){
#define bitcount 30 #define bitcount 30
int x[bitcount + 1] = {}; int x[bitcount + 1] = {};

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int set(int a[], int pos, int d){ int set(int a[], int pos, int d){
#define bitcount 30 #define bitcount 30
int x[bitcount + 1] = {}; int x[bitcount + 1] = {};

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define N 1024 #define N 1024
void mm(int n, int A[][N], int B[][N], int C[][N]){ void mm(int n, int A[][N], int B[][N], int C[][N]){

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define N 1024 #define N 1024
void mm(int n, int A[][N], int B[][N], int C[][N]){ void mm(int n, int A[][N], int B[][N], int C[][N]){

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define N 1024 #define N 1024
void mm(int n, int A[][N], int B[][N], int C[][N]){ void mm(int n, int A[][N], int B[][N], int C[][N]){

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int x; int x;
#define N 2010 #define N 2010

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int x; int x;
#define N 2010 #define N 2010

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int x; int x;
#define N 2010 #define N 2010

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define base 16 #define base 16
int getMaxNum(int n, int arr[]){ int getMaxNum(int n, int arr[]){

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define base 16 #define base 16
int getMaxNum(int n, int arr[]){ int getMaxNum(int n, int arr[]){

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define base 16 #define base 16
int getMaxNum(int n, int arr[]){ int getMaxNum(int n, int arr[]){

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){ void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){
int i, j, k; int i, j, k;
i = 0; i = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){ void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){
int i, j, k; int i, j, k;
i = 0; i = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){ void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){
int i, j, k; int i, j, k;
i = 0; i = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
// Brainfuck Interpreter // Brainfuck Interpreter
// Reads program from stdin, interprets and outputs to stdout. // Reads program from stdin, interprets and outputs to stdout.
// //

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
// Brainfuck Interpreter // Brainfuck Interpreter
// Reads program from stdin, interprets and outputs to stdout. // Reads program from stdin, interprets and outputs to stdout.
// //

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
// Brainfuck Interpreter // Brainfuck Interpreter
// Reads program from stdin, interprets and outputs to stdout. // Reads program from stdin, interprets and outputs to stdout.
// //

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define max 1073741824 #define max 1073741824
int checkrange(int num){ int checkrange(int num){
while (num > max) num = num - max; while (num > max) num = num - max;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define max 1073741824 #define max 1073741824
int checkrange(int num){ int checkrange(int num){
while (num > max) num = num - max; while (num > max) num = num - max;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define max 1073741824 #define max 1073741824
int checkrange(int num){ int checkrange(int num){
while (num > max) num = num - max; while (num > max) num = num - max;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int state = 19260817; int state = 19260817;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int state = 19260817; int state = 19260817;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int state = 19260817; int state = 19260817;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in //gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in
int loopCount = 0; int loopCount = 0;
int global = 0; int global = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in //gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in
int loopCount = 0; int loopCount = 0;
int global = 0; int global = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in //gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in
int loopCount = 0; int loopCount = 0;
int global = 0; int global = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define mod 998244353 #define mod 998244353
int d; int d;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define mod 998244353 #define mod 998244353
int d; int d;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define mod 998244353 #define mod 998244353
int d; int d;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define maxlen 2097152 #define maxlen 2097152
int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen]; int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen];

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define maxlen 2097152 #define maxlen 2097152
int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen]; int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen];

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define maxlen 2097152 #define maxlen 2097152
int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen]; int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen];

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int sheet1[500][500] = {}; int sheet1[500][500] = {};
int sheet2[500][500] = {}; int sheet2[500][500] = {};
int active = 1; int active = 1;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int sheet1[500][500] = {}; int sheet1[500][500] = {};
int sheet2[500][500] = {}; int sheet2[500][500] = {};
int active = 1; int active = 1;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int sheet1[500][500] = {}; int sheet1[500][500] = {};
int sheet2[500][500] = {}; int sheet2[500][500] = {};
int active = 1; int active = 1;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in //gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in
int loopCount = 0; int loopCount = 0;
int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15) int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15)

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in //gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in
int loopCount = 0; int loopCount = 0;
int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15) int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15)

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in //gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in
int loopCount = 0; int loopCount = 0;
int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15) int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15)

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in //gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in
int loopCount = 0; int loopCount = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in //gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in
int loopCount = 0; int loopCount = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in //gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in
int loopCount = 0; int loopCount = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in //gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in
int loopCount = 0; int loopCount = 0;
int multi = 2; int multi = 2;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in //gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in
int loopCount = 0; int loopCount = 0;
int multi = 2; int multi = 2;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
//gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in //gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in
int loopCount = 0; int loopCount = 0;
int multi = 2; int multi = 2;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int n; int n;
int meanless_calculation(int x, int y){ int meanless_calculation(int x, int y){
int i = 0; int i = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int n; int n;
int meanless_calculation(int x, int y){ int meanless_calculation(int x, int y){
int i = 0; int i = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int n; int n;
int meanless_calculation(int x, int y){ int meanless_calculation(int x, int y){
int i = 0; int i = 0;

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int hashmod; int hashmod;
#define maxn 10000000 #define maxn 10000000

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int hashmod; int hashmod;
#define maxn 10000000 #define maxn 10000000

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int hashmod; int hashmod;
#define maxn 10000000 #define maxn 10000000

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int x[600][600][600]; int x[600][600][600];
int y[600][600][600]; int y[600][600][600];

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int x[600][600][600]; int x[600][600][600];
int y[600][600][600]; int y[600][600][600];

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int x[600][600][600]; int x[600][600][600];
int y[600][600][600]; int y[600][600][600];

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define width 512 #define width 512
#define height 1024 #define height 1024
int image_in[width * height]; int image_in[width * height];

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
#define width 1024 #define width 1024
#define height 1024 #define height 1024
int image_in[width * height]; int image_in[width * height];

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int matrix[20000000]; int matrix[20000000];
int a[100000]; int a[100000];

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int matrix[20000000]; int matrix[20000000];
int a[100000]; int a[100000];

View File

@ -1,5 +1,4 @@
#include "sylib.h" #include "sylib.h"
#include "sylib.h"
int matrix[20000000]; int matrix[20000000];
int a[100000]; int a[100000];

14
scripts/add_incs.py Normal file
View File

@ -0,0 +1,14 @@
import os
# Walk through all directories and subdirectories from the current directory
for dirpath, dirnames, filenames in os.walk('.'):
# For each file in the directories
for filename in filenames:
# If the file is a .sy file
if filename.endswith('.sy'):
filepath = os.path.join(dirpath, filename)
with open(filepath, 'r+') as file:
content = file.read()
# Add '#include "sylib.h"' at the beginning of the file
file.seek(0, 0)
file.write('#include "sylib.h"\n' + content)

View File

@ -1,10 +0,0 @@
#!/bin/bash
# Specify the directory
dir="."
# Loop over all .sy files in the directory
find "$dir"/*/sy -type f -name "*.sy" -print0 | while IFS= read -r -d '' file; do
# Use sed to add #include "sylib.h" at the beginning of each file
sed -i '1i#include "sylib.h"' "$file"
done

15
scripts/rm_inc.py Normal file
View File

@ -0,0 +1,15 @@
import os
# Walk through all directories and subdirectories from the current directory
for dirpath, dirnames, filenames in os.walk('.'):
# For each file in the directories
for filename in filenames:
# If the file is a .sy file
if filename.endswith('.sy'):
filepath = os.path.join(dirpath, filename)
with open(filepath, 'r') as file:
lines = file.readlines()
# Remove lines containing '#include "sylib.h"'
lines = [line for line in lines if '#include "sylib.h"' not in line]
with open(filepath, 'w') as file:
file.writelines(lines)

View File

@ -1,24 +0,0 @@
#!/bin/bash
# 定义文件夹路径数组
folder_path_vec=(
final_performance_c/sy
performace_c/sy
hidden_functional_c/sy
functional_c/sy
final_performance_c/sy
)
# 迭代文件夹路径数组
for folder_path in "${folder_path_vec[@]}"; do
# 迭代文件夹中的所有.sy文件
for file in "$folder_path"/*.sy; do
# 检查文件是否存在
if [ -f "$file" ]; then
# 删除文件中包含#include "sylib.h"的行,并将结果保存到临时文件中
grep -v '#include "sylib.h"' "$file" >"$file.tmp" && mv "$file.tmp" "$file"
fi
done
done
echo "已删除所有.sy文件中的#include \"sylib.h\"行"