Add wasm tacle-bench targets
This commit is contained in:
BIN
targets/wasm-tacle/test/duff/generated/default/duff.wasm
Executable file
BIN
targets/wasm-tacle/test/duff/generated/default/duff.wasm
Executable file
Binary file not shown.
172
targets/wasm-tacle/test/duff/generated/default/duff.wat
Normal file
172
targets/wasm-tacle/test/duff/generated/default/duff.wat
Normal file
@ -0,0 +1,172 @@
|
||||
(module $duff.wasm
|
||||
(type (;0;) (func (param i32 i32)))
|
||||
(type (;1;) (func))
|
||||
(type (;2;) (func (result i32)))
|
||||
(import "__pragma" "loopbound" (func $__pragma_loopbound (type 0)))
|
||||
(func $__wasm_apply_data_relocs (type 1))
|
||||
(func $duff_main (type 1)
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load8_u offset=1024
|
||||
i32.store8 offset=1136
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=1025 align=1
|
||||
i32.store offset=1137 align=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i64.load offset=1029 align=1
|
||||
i64.store offset=1141 align=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i64.load offset=1037 align=1
|
||||
i64.store offset=1149 align=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i64.load offset=1045 align=1
|
||||
i64.store offset=1157 align=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i64.load offset=1053 align=1
|
||||
i64.store offset=1165 align=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load offset=1061 align=1
|
||||
i32.store offset=1173 align=1
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.load16_u offset=1065 align=1
|
||||
i32.store16 offset=1177 align=1)
|
||||
(func $__original_main (type 2) (result i32)
|
||||
(local i32 i32 i32)
|
||||
global.get $__stack_pointer
|
||||
i32.const 16
|
||||
i32.sub
|
||||
local.tee 0
|
||||
global.set $__stack_pointer
|
||||
i32.const 0
|
||||
local.set 1
|
||||
local.get 0
|
||||
i32.const 0
|
||||
i32.store8 offset=15
|
||||
i32.const 100
|
||||
i32.const 100
|
||||
call $__pragma_loopbound
|
||||
loop ;; label = @1
|
||||
local.get 1
|
||||
i32.const 1028
|
||||
i32.add
|
||||
i32.const 96
|
||||
local.get 1
|
||||
i32.sub
|
||||
i32.store8
|
||||
local.get 1
|
||||
i32.const 1027
|
||||
i32.add
|
||||
i32.const 97
|
||||
local.get 1
|
||||
i32.sub
|
||||
i32.store8
|
||||
local.get 1
|
||||
i32.const 1026
|
||||
i32.add
|
||||
i32.const 98
|
||||
local.get 1
|
||||
i32.sub
|
||||
i32.store8
|
||||
local.get 1
|
||||
i32.const 1025
|
||||
i32.add
|
||||
i32.const 99
|
||||
local.get 1
|
||||
i32.sub
|
||||
i32.store8
|
||||
local.get 1
|
||||
i32.const 1024
|
||||
i32.add
|
||||
i32.const 100
|
||||
local.get 1
|
||||
i32.sub
|
||||
i32.store8
|
||||
local.get 1
|
||||
i32.const 5
|
||||
i32.add
|
||||
local.tee 1
|
||||
i32.const 100
|
||||
i32.ne
|
||||
br_if 0 (;@1;)
|
||||
end
|
||||
i32.const 400
|
||||
i32.const 400
|
||||
call $__pragma_loopbound
|
||||
i32.const -100
|
||||
local.set 1
|
||||
loop ;; label = @1
|
||||
local.get 1
|
||||
i32.const 1124
|
||||
i32.add
|
||||
local.tee 2
|
||||
local.get 2
|
||||
i32.load8_u
|
||||
local.get 0
|
||||
i32.load8_u offset=15
|
||||
i32.xor
|
||||
i32.store8
|
||||
local.get 1
|
||||
i32.const 1125
|
||||
i32.add
|
||||
local.tee 2
|
||||
local.get 2
|
||||
i32.load8_u
|
||||
local.get 0
|
||||
i32.load8_u offset=15
|
||||
i32.xor
|
||||
i32.store8
|
||||
local.get 1
|
||||
i32.const 1126
|
||||
i32.add
|
||||
local.tee 2
|
||||
local.get 2
|
||||
i32.load8_u
|
||||
local.get 0
|
||||
i32.load8_u offset=15
|
||||
i32.xor
|
||||
i32.store8
|
||||
local.get 1
|
||||
i32.const 1127
|
||||
i32.add
|
||||
local.tee 2
|
||||
local.get 2
|
||||
i32.load8_u
|
||||
local.get 0
|
||||
i32.load8_u offset=15
|
||||
i32.xor
|
||||
i32.store8
|
||||
local.get 1
|
||||
i32.const 4
|
||||
i32.add
|
||||
local.tee 1
|
||||
br_if 0 (;@1;)
|
||||
end
|
||||
call $duff_main
|
||||
i32.const 0
|
||||
i32.load8_u offset=1164
|
||||
local.set 1
|
||||
local.get 0
|
||||
i32.const 16
|
||||
i32.add
|
||||
global.set $__stack_pointer
|
||||
local.get 1
|
||||
i32.const 72
|
||||
i32.ne)
|
||||
(table (;0;) 1 1 funcref)
|
||||
(memory (;0;) 1)
|
||||
(global $__stack_pointer (mut i32) (i32.const 5344))
|
||||
(global (;1;) i32 (i32.const 1236))
|
||||
(global (;2;) i32 (i32.const 5344))
|
||||
(export "memory" (memory 0))
|
||||
(export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs))
|
||||
(export "entrypoint" (func $duff_main))
|
||||
(export "main" (func $__original_main))
|
||||
(export "__data_end" (global 1))
|
||||
(export "__heap_base" (global 2)))
|
||||
@ -0,0 +1,127 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 2.0
|
||||
|
||||
Name: duff
|
||||
|
||||
Author: Jakob Engblom
|
||||
|
||||
Function: Duff's device
|
||||
|
||||
Source: MRTC
|
||||
http://www.mrtc.mdh.se/projects/wcet/wcet_bench/duff/duff.c
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: may be used, modified, and re-distributed freely
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
Forward declaration of functions
|
||||
*/
|
||||
|
||||
// Wasm loop bounds
|
||||
|
||||
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
|
||||
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
|
||||
|
||||
void duff_copy(char *to, char *from, int count);
|
||||
void duff_initialize(char *arr, int length);
|
||||
void duff_init();
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
||||
duff_main(void);
|
||||
int duff_return(void);
|
||||
__attribute__((noinline)) __attribute__((export_name("main"))) int main(void);
|
||||
|
||||
/*
|
||||
Declaration of global variables
|
||||
*/
|
||||
|
||||
char duff_source[100];
|
||||
char duff_target[100];
|
||||
|
||||
/*
|
||||
Initialization- and return-value-related functions
|
||||
*/
|
||||
|
||||
void
|
||||
duff_init() {
|
||||
unsigned int i;
|
||||
unsigned char *p;
|
||||
volatile char bitmask = 0;
|
||||
|
||||
duff_initialize(duff_source, 100);
|
||||
|
||||
/*
|
||||
Apply volatile XOR-bitmask to entire input array.
|
||||
*/
|
||||
p = (unsigned char *) &duff_source[0];
|
||||
__pragma_loopbound(400, 400);
|
||||
for (i = 0; i < sizeof(duff_source); ++i, ++p)
|
||||
*p ^= bitmask;
|
||||
}
|
||||
|
||||
int
|
||||
duff_return(void) {
|
||||
return (duff_target[28] - 72 != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
Algorithm core functions
|
||||
*/
|
||||
|
||||
void
|
||||
duff_initialize(char *arr, int length) {
|
||||
int i;
|
||||
|
||||
__pragma_loopbound(100, 100);
|
||||
for (i = 0; i < length; i++)
|
||||
arr[i] = length - i;
|
||||
}
|
||||
|
||||
void
|
||||
duff_copy(char *to, char *from, int count) {
|
||||
int n = (count + 7) / 8;
|
||||
|
||||
_Pragma("marker outside") switch (count % 8) {
|
||||
case 0:
|
||||
do {
|
||||
*to++ = *from++;
|
||||
case 7:
|
||||
*to++ = *from++;
|
||||
case 6:
|
||||
*to++ = *from++;
|
||||
case 5:
|
||||
*to++ = *from++;
|
||||
case 4:
|
||||
*to++ = *from++;
|
||||
case 3:
|
||||
*to++ = *from++;
|
||||
case 2:
|
||||
*to++ = *from++;
|
||||
case 1:
|
||||
_Pragma("marker inside") *to++ = *from++;
|
||||
|
||||
} while (--n > 0);
|
||||
}
|
||||
_Pragma("flowrestriction 1*inside <= 6*outside")
|
||||
}
|
||||
|
||||
/*
|
||||
Main functions
|
||||
*/
|
||||
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
||||
duff_main(void) {
|
||||
duff_copy(duff_target, duff_source, 43);
|
||||
}
|
||||
|
||||
__attribute__((noinline)) __attribute__((export_name("main"))) int
|
||||
main(void) {
|
||||
duff_init();
|
||||
duff_main();
|
||||
|
||||
return (duff_return());
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
/*
|
||||
|
||||
This program is part of the TACLeBench benchmark suite.
|
||||
Version V 2.0
|
||||
|
||||
Name: duff
|
||||
|
||||
Author: Jakob Engblom
|
||||
|
||||
Function: Duff's device
|
||||
|
||||
Source: MRTC
|
||||
http://www.mrtc.mdh.se/projects/wcet/wcet_bench/duff/duff.c
|
||||
|
||||
Changes: no major functional changes
|
||||
|
||||
License: may be used, modified, and re-distributed freely
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
Forward declaration of functions
|
||||
*/
|
||||
|
||||
// Wasm loop bounds
|
||||
|
||||
|
||||
|
||||
|
||||
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
|
||||
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
|
||||
|
||||
__attribute__((always_inline)) static inline void
|
||||
duff_copy(char *to, char *from, int count);
|
||||
__attribute__((always_inline)) static inline void duff_initialize(char *arr,
|
||||
int length);
|
||||
__attribute__((always_inline)) static inline void duff_init();
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
||||
duff_main(void);
|
||||
__attribute__((always_inline)) static inline int duff_return(void);
|
||||
__attribute__((noinline)) __attribute__((export_name("main")))
|
||||
__attribute__((noinline)) __attribute__((export_name("main"))) int
|
||||
main(void);
|
||||
|
||||
/*
|
||||
Declaration of global variables
|
||||
*/
|
||||
|
||||
char duff_source[100];
|
||||
char duff_target[100];
|
||||
|
||||
/*
|
||||
Initialization- and return-value-related functions
|
||||
*/
|
||||
|
||||
__attribute__((always_inline)) static inline void
|
||||
duff_init() {
|
||||
unsigned int i;
|
||||
unsigned char *p;
|
||||
volatile char bitmask = 0;
|
||||
|
||||
duff_initialize(duff_source, 100);
|
||||
|
||||
/*
|
||||
Apply volatile XOR-bitmask to entire input array.
|
||||
*/
|
||||
p = (unsigned char *) &duff_source[0];
|
||||
__pragma_loopbound(400, 400);
|
||||
for (i = 0; i < sizeof(duff_source); ++i, ++p)
|
||||
*p ^= bitmask;
|
||||
}
|
||||
|
||||
__attribute__((always_inline)) static inline int
|
||||
duff_return(void) {
|
||||
return (duff_target[28] - 72 != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
Algorithm core functions
|
||||
*/
|
||||
|
||||
__attribute__((always_inline)) static inline void
|
||||
duff_initialize(char *arr, int length) {
|
||||
int i;
|
||||
|
||||
__pragma_loopbound(100, 100);
|
||||
for (i = 0; i < length; i++)
|
||||
arr[i] = length - i;
|
||||
}
|
||||
|
||||
__attribute__((always_inline)) static inline void
|
||||
duff_copy(char *to, char *from, int count) {
|
||||
int n = (count + 7) / 8;
|
||||
|
||||
_Pragma("marker outside") switch (count % 8) {
|
||||
case 0:
|
||||
do {
|
||||
*to++ = *from++;
|
||||
case 7:
|
||||
*to++ = *from++;
|
||||
case 6:
|
||||
*to++ = *from++;
|
||||
case 5:
|
||||
*to++ = *from++;
|
||||
case 4:
|
||||
*to++ = *from++;
|
||||
case 3:
|
||||
*to++ = *from++;
|
||||
case 2:
|
||||
*to++ = *from++;
|
||||
case 1:
|
||||
_Pragma("marker inside") *to++ = *from++;
|
||||
|
||||
} while (--n > 0);
|
||||
}
|
||||
_Pragma("flowrestriction 1*inside <= 6*outside")
|
||||
}
|
||||
|
||||
/*
|
||||
Main functions
|
||||
*/
|
||||
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
||||
duff_main(void) {
|
||||
duff_copy(duff_target, duff_source, 43);
|
||||
}
|
||||
|
||||
__attribute__((noinline)) __attribute__((export_name("main")))
|
||||
__attribute__((noinline)) __attribute__((export_name("main"))) int
|
||||
main(void) {
|
||||
duff_init();
|
||||
duff_main();
|
||||
|
||||
return (duff_return());
|
||||
}
|
||||
Reference in New Issue
Block a user