-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tcc): add 'ref' scale input for tcc
- Loading branch information
Showing
11 changed files
with
136 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#include <gemm.h> | ||
|
||
bench_gemm_config config = {110, 110, 110}; | ||
bench_gemm_config config = {.m = 110, .n = 110, .k = 110, .checksum = 0x503d0fe9}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#include <gemm.h> | ||
|
||
bench_gemm_config config = {50, 50, 50}; | ||
bench_gemm_config config = {.m = 50, .n = 50, .k = 50, .checksum = 0x53c1fb28}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#include <gemm.h> | ||
|
||
bench_gemm_config config = {40, 40, 40}; | ||
bench_gemm_config config = {.m = 40, .n = 40, .k = 40, .checksum = 0x1efebe93}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "../config.h" | ||
#include <fs.h> | ||
|
||
Finfo file_table[] = { | ||
{"/share/trm.c", 269, 0, NULL, NULL}, | ||
{"/share/trap.h", 110, 269, NULL, NULL}, | ||
{"/share/ref.c", 1844, 379, NULL, NULL}, | ||
{"/share/ref", 21332, 2223, NULL, NULL} | ||
}; | ||
|
||
int tcc_argc1 = 10; | ||
char *tcc_argv1[] = { | ||
"./tcc", "/share/trm.c", "/share/ref.c", "-ffreestanding", | ||
"-nostdlib", "-o", "/share/ref", "-Wl,-Ttext=0x80000000", | ||
"-O2", "-static" | ||
}; | ||
|
||
bench_tcc_config config = {.file_count = 4}; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#include "trap.h" | ||
|
||
typedef unsigned int uint32_t; | ||
typedef unsigned char uint8_t; | ||
typedef uint32_t size_t; | ||
#define NULL 0 | ||
#define LENGTH(x) sizeof(x) / sizeof(x[0]) | ||
|
||
void *memset(void *s, int c, size_t n) { | ||
char *p = NULL; | ||
if (s == NULL) | ||
return s; | ||
|
||
p = (char *)s; | ||
while (n > 0) { | ||
*(p++) = c; | ||
n--; | ||
} | ||
return s; | ||
} | ||
|
||
int add(int a, int b) { return a + b; } | ||
int sub(int a, int b) { return a - b; } | ||
int mul(int a, int b) { return a * b; } | ||
int div_safe(int a, int b) { return b != 0 ? a / b : 0; } | ||
|
||
int test_data[] = {0, 1, 2, 3, 0x7fffffff, 0x80000000, 0x80000001, 0xffffffff}; | ||
int ans_data[1000] = {0}; | ||
|
||
#define NR_DATA 1000 | ||
|
||
int add_main() { | ||
int i, j; | ||
for (i = 0; i < NR_DATA; i++) { | ||
for (j = 0; j < NR_DATA; j++) { | ||
int expected = add(test_data[i % 8], test_data[j % 8]); | ||
check(add(test_data[i % 8], test_data[j % 8]) == expected); | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
int sub_main() { | ||
int i, j; | ||
for (i = 0; i < NR_DATA; i++) { | ||
for (j = 0; j < NR_DATA; j++) { | ||
int expected = sub(test_data[i % 8], test_data[j % 8]); | ||
check(sub(test_data[i % 8], test_data[j % 8]) == expected); | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
int mul_main() { | ||
int i, j; | ||
for (i = 0; i < NR_DATA; i++) { | ||
for (j = 0; j < NR_DATA; j++) { | ||
int expected = mul(test_data[i % 8], test_data[j % 8]); | ||
check(mul(test_data[i % 8], test_data[j % 8]) == expected); | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
int div_main() { | ||
int i, j; | ||
for (i = 0; i < NR_DATA; i++) { | ||
for (j = 0; j < NR_DATA; j++) { | ||
int expected = div_safe(test_data[i % 8], test_data[(j % 7) + 1]); | ||
check(div_safe(test_data[i % 8], test_data[(j % 7) + 1]) == expected); | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
int main() { | ||
memset(ans_data, 0, sizeof(ans_data)); | ||
|
||
for (int k = 0; k < 10; k++) { | ||
add_main(); | ||
sub_main(); | ||
mul_main(); | ||
div_main(); | ||
} | ||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.section .data | ||
.global ramdisk_start, ramdisk_end | ||
ramdisk_start: | ||
.incbin "input/trm.c" | ||
.incbin "input/trap.h" | ||
.incbin "input/ref.c" | ||
.incbin "input/ref" | ||
ramdisk_end: |