Add wasm tacle-bench targets

This commit is contained in:
2026-06-12 20:06:22 +02:00
parent 30daa8a00c
commit 08c2e9c13d
1122 changed files with 520422 additions and 0 deletions

View File

@ -0,0 +1,132 @@
(module $binarysearch.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 $binarysearch_main (type 1)
(local i32 i32 i32 i32 i32)
i32.const 1
i32.const 4
call $__pragma_loopbound
i32.const 14
local.set 0
i32.const 0
local.set 1
block ;; label = @1
loop ;; label = @2
block ;; label = @3
local.get 0
local.get 1
i32.add
i32.const 1
i32.shr_s
local.tee 2
i32.const 3
i32.shl
i32.const 1040
i32.add
local.tee 3
i32.load
local.tee 4
i32.const 8
i32.ne
br_if 0 (;@3;)
local.get 3
i32.load offset=4
local.set 3
br 2 (;@1;)
end
i32.const -1
local.set 3
local.get 1
local.get 2
i32.const 1
i32.add
local.get 4
i32.const 8
i32.gt_s
local.tee 4
select
local.tee 1
local.get 2
i32.const -1
i32.add
local.get 0
local.get 4
select
local.tee 0
i32.le_s
br_if 0 (;@2;)
end
end
i32.const 0
local.get 3
i32.store offset=1160)
(func $__original_main (type 2) (result i32)
(local i32 i32)
i32.const 0
i32.const 0
i32.store offset=1024
i32.const 15
i32.const 15
call $__pragma_loopbound
i32.const -120
local.set 0
loop ;; label = @1
i32.const 0
i32.const 0
i32.load offset=1024
i32.const 133
i32.mul
i32.const 81
i32.add
i32.const 8095
i32.rem_s
i32.store offset=1024
i32.const 0
i32.load offset=1024
local.set 1
i32.const 0
i32.const 0
i32.load offset=1024
i32.const 133
i32.mul
i32.const 81
i32.add
i32.const 8095
i32.rem_s
i32.store offset=1024
local.get 0
i32.const 1160
i32.add
local.get 1
i32.store
local.get 0
i32.const 1164
i32.add
i32.const 0
i32.load offset=1024
i32.store
local.get 0
i32.const 8
i32.add
local.tee 0
br_if 0 (;@1;)
end
call $binarysearch_main
i32.const 0
i32.load offset=1160
i32.const -1
i32.ne)
(table (;0;) 1 1 funcref)
(memory (;0;) 1)
(global $__stack_pointer (mut i32) (i32.const 5264))
(global (;1;) i32 (i32.const 1164))
(global (;2;) i32 (i32.const 5264))
(export "memory" (memory 0))
(export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs))
(export "entrypoint" (func $binarysearch_main))
(export "main" (func $__original_main))
(export "__data_end" (global 1))
(export "__heap_base" (global 2)))

View File

@ -0,0 +1,153 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: binarysearch
Author: Sung-Soo Lim <sslim@archi.snu.ac.kr>
Function: binarysearch performs binary search in an array of 15 integer
elements.
This program is completely structured (no unconditional jumps, no exits
from loop bodies), and does not contain switch statements, no do-while
loops.
Source: MRTC
http://www.mrtc.mdh.se/projects/wcet/wcet_bench/bs/bs.c
Original name: bs
Changes: No major functional changes.
License: May be used, modified, and re-distributed freely, but
the SNU-RT Benchmark Suite must be acknowledged
*/
/*
This program is derived from the SNU-RT Benchmark Suite for Worst
Case Timing Analysis by Sung-Soo Lim
*/
/*
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 binarysearch_initSeed(void);
long binarysearch_randomInteger(void);
void binarysearch_init(void);
int binarysearch_return(void);
int binarysearch_binary_search(int);
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
binarysearch_main(void);
__attribute__((noinline)) __attribute__((export_name("main"))) int main(void);
/*
Declaration of global variables
*/
volatile int binarysearch_seed;
struct binarysearch_DATA {
int key;
int value;
};
struct binarysearch_DATA binarysearch_data[15];
int binarysearch_result;
/*
Initialization- and return-value-related functions
*/
/*
binarysearch_initSeed initializes the seed used in the "random" number
generator.
*/
void
binarysearch_initSeed(void) {
binarysearch_seed = 0;
}
/*
binarysearch_RandomInteger generates "random" integers between 0 and 8094.
*/
long
binarysearch_randomInteger(void) {
binarysearch_seed = ((binarysearch_seed * 133) + 81) % 8095;
return (binarysearch_seed);
}
void
binarysearch_init(void) {
int i;
binarysearch_initSeed();
__pragma_loopbound(15, 15);
for (i = 0; i < 15; ++i) {
binarysearch_data[i].key = binarysearch_randomInteger();
binarysearch_data[i].value = binarysearch_randomInteger();
}
}
int
binarysearch_return(void) {
return (binarysearch_result);
}
/*
Algorithm core functions
*/
int
binarysearch_binary_search(int x) {
int fvalue, mid, up, low;
low = 0;
up = 14;
fvalue = -1;
__pragma_loopbound(1, 4);
while (low <= up) {
mid = (low + up) >> 1;
if (binarysearch_data[mid].key == x) {
/* Item found */
up = low - 1;
fvalue = binarysearch_data[mid].value;
} else
if (binarysearch_data[mid].key > x)
/* Item not found */
up = mid - 1;
else
low = mid + 1;
}
return (fvalue);
}
/*
Main functions
*/
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
binarysearch_main(void) {
binarysearch_result = binarysearch_binary_search(8);
}
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
binarysearch_init();
binarysearch_main();
return (binarysearch_return() - (-1) != 0);
}

View File

@ -0,0 +1,163 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: binarysearch
Author: Sung-Soo Lim <sslim@archi.snu.ac.kr>
Function: binarysearch performs binary search in an array of 15 integer
elements.
This program is completely structured (no unconditional jumps, no exits
from loop bodies), and does not contain switch statements, no do-while
loops.
Source: MRTC
http://www.mrtc.mdh.se/projects/wcet/wcet_bench/bs/bs.c
Original name: bs
Changes: No major functional changes.
License: May be used, modified, and re-distributed freely, but
the SNU-RT Benchmark Suite must be acknowledged
*/
/*
This program is derived from the SNU-RT Benchmark Suite for Worst
Case Timing Analysis by Sung-Soo Lim
*/
/*
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 binarysearch_initSeed(void);
__attribute__((always_inline)) static inline long
binarysearch_randomInteger(void);
__attribute__((always_inline)) static inline void binarysearch_init(void);
__attribute__((always_inline)) static inline int binarysearch_return(void);
__attribute__((always_inline)) static inline int
binarysearch_binary_search(int);
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
binarysearch_main(void);
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void);
/*
Declaration of global variables
*/
volatile int binarysearch_seed;
struct binarysearch_DATA {
int key;
int value;
};
struct binarysearch_DATA binarysearch_data[15];
int binarysearch_result;
/*
Initialization- and return-value-related functions
*/
/*
binarysearch_initSeed initializes the seed used in the "random" number
generator.
*/
__attribute__((always_inline)) static inline void
binarysearch_initSeed(void) {
binarysearch_seed = 0;
}
/*
binarysearch_RandomInteger generates "random" integers between 0 and 8094.
*/
__attribute__((always_inline)) static inline long
binarysearch_randomInteger(void) {
binarysearch_seed = ((binarysearch_seed * 133) + 81) % 8095;
return (binarysearch_seed);
}
__attribute__((always_inline)) static inline void
binarysearch_init(void) {
int i;
binarysearch_initSeed();
__pragma_loopbound(15, 15);
for (i = 0; i < 15; ++i) {
binarysearch_data[i].key = binarysearch_randomInteger();
binarysearch_data[i].value = binarysearch_randomInteger();
}
}
__attribute__((always_inline)) static inline int
binarysearch_return(void) {
return (binarysearch_result);
}
/*
Algorithm core functions
*/
__attribute__((always_inline)) static inline int
binarysearch_binary_search(int x) {
int fvalue, mid, up, low;
low = 0;
up = 14;
fvalue = -1;
__pragma_loopbound(1, 4);
while (low <= up) {
mid = (low + up) >> 1;
if (binarysearch_data[mid].key == x) {
/* Item found */
up = low - 1;
fvalue = binarysearch_data[mid].value;
} else
if (binarysearch_data[mid].key > x)
/* Item not found */
up = mid - 1;
else
low = mid + 1;
}
return (fvalue);
}
/*
Main functions
*/
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
binarysearch_main(void) {
binarysearch_result = binarysearch_binary_search(8);
}
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
binarysearch_init();
binarysearch_main();
return (binarysearch_return() - (-1) != 0);
}