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,25 @@
# ~~~
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2026, Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU)
# ~~~
cmake_minimum_required(VERSION 3.20)
project(cover)
set(TACLEBENCH_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../..")
set(REPOSITORY_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..")
set(APP_TARGET_NAME "${CMAKE_PROJECT_NAME}")
if(DEFINED TACLEBENCH_VARIANT AND "${TACLEBENCH_VARIANT}" STREQUAL "inline")
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/inline/cover.c")
else()
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/default/cover.c")
endif()
include(${REPOSITORY_ROOT_PATH}/cmake/taclebench_wasm.cmake)

View File

@ -0,0 +1,57 @@
File: cover.c
Original provenience: Mälardalen benchmark suite,
Source: http://www.mrtc.mdh.se/projects/wcet/wcet_bench/cover/cover.c
2016-03-15:
- Made sure that cover_return returns value 0.
2016-01-06:
- Added original name to generic TACLeBench header.
- Applied TACLeBench formatting rules via
astyle --options=doc/example/astylerc.txt
2015-12-03:
- Replaced comment describing purpose of benchmark from lines 1-7
with generic TACLeBench header.
- Removed all "/* k switch case traversed */ comments.
(lines 10, 144, 218)
- Introduced comments to split file in sections for forward declarations,
global variables, initialization-related and return-value-related functions,
core benchmark functions, and main routine.
- Renamed function swi10 to cover_swi10.
- Renamed function swi50 to cover_swi50.
- Renamed function swi120 to cover_swi120.
- Renamed function main to cover_main.
- Replaced local variable cnt in cover_main with global variable cover_cnt.
- Added function cover_init that handles the initialization of cover_cnt.
- Added function cover_return that handles the original return value of main.
- Changed cover_main such that no value is returned.
- Added new function main that first calls cover_init, then cover_main and
finally returns the return value of cover_return.
- Added forward declarations for all these functions.
- Applied code formatting according to the following rules:
- Lines shall not be wider than 80 characters; whenever possible, appropriate
line breaks shall be inserted to keep lines below 80 characters
- Indentation is done using whitespaces only, no tabs. Code is indented by
two whitespaces
- Two empty lines are put between any two functions
- In non-empty lists or index expressions, opening '(' and '[' are followed by
one whitespace, closing ')' and ']' are preceded by one whitespace
- In comma- or colon-separated argument lists, one whitespace is put after
each comma/colon
- For pointer types, one whitespace is put before the '*'
- Operators within expressions shall be preceded and followed by one
whitespace
- Code of then- and else-parts of if-then-else statements shall be put in
separate lines, not in the same lines as the if-condition or the keyword
"else"
- Opening braces '{' denoting the beginning of code for some if-else or loop
body shall be put at the end of the same line where the keywords "if",
"else", "for", "while" etc. occur
- Function arguments are specified in ANSI style, i.e.,
float my_sqrtf( float val )
and NOT in Kernighan&Ritchie style like, e.g.,
float my_sqrtf( val )
float val;
- Tested conformance to C90 via
clang -fsyntax-only -Weverything -Wno-unknown-pragmas -pedantic -std=c90

View File

@ -0,0 +1,702 @@
/*
This program is part of the TACLeBench benchmark suite.
Version 2.0
Name: cover
Author: unknown
Function: A program for testing many paths generated by switch-case
statements.
Source: MRTC
http://www.mrtc.mdh.se/projects/wcet/wcet_bench/cover/cover.c
Original name: cover
Changes: See ChangeLog.txt
License: may be used, modified, and re-distributed freely
*/
/*
Forward declaration of functions
*/
void cover_init( void );
void cover_main( void );
int cover_return( void );
int cover_swi10( int );
int cover_swi50( int );
int cover_swi120( int );
/*
Declaration of global variables
*/
static volatile int cover_cnt;
/*
Initialization- and return-value-related functions
*/
void cover_init( void )
{
cover_cnt = 0;
}
int cover_return( void )
{
return cover_cnt - 180;
}
/*
Core benchmark functions
*/
int cover_swi120( int c )
{
int i;
_Pragma( "loopbound min 120 max 120" )
for ( i = 0; i < 120; i++ ) {
switch ( i ) {
case 0:
c++;
break;
case 1:
c++;
break;
case 2:
c++;
break;
case 3:
c++;
break;
case 4:
c++;
break;
case 5:
c++;
break;
case 6:
c++;
break;
case 7:
c++;
break;
case 8:
c++;
break;
case 9:
c++;
break;
case 10:
c++;
break;
case 11:
c++;
break;
case 12:
c++;
break;
case 13:
c++;
break;
case 14:
c++;
break;
case 15:
c++;
break;
case 16:
c++;
break;
case 17:
c++;
break;
case 18:
c++;
break;
case 19:
c++;
break;
case 20:
c++;
break;
case 21:
c++;
break;
case 22:
c++;
break;
case 23:
c++;
break;
case 24:
c++;
break;
case 25:
c++;
break;
case 26:
c++;
break;
case 27:
c++;
break;
case 28:
c++;
break;
case 29:
c++;
break;
case 30:
c++;
break;
case 31:
c++;
break;
case 32:
c++;
break;
case 33:
c++;
break;
case 34:
c++;
break;
case 35:
c++;
break;
case 36:
c++;
break;
case 37:
c++;
break;
case 38:
c++;
break;
case 39:
c++;
break;
case 40:
c++;
break;
case 41:
c++;
break;
case 42:
c++;
break;
case 43:
c++;
break;
case 44:
c++;
break;
case 45:
c++;
break;
case 46:
c++;
break;
case 47:
c++;
break;
case 48:
c++;
break;
case 49:
c++;
break;
case 50:
c++;
break;
case 51:
c++;
break;
case 52:
c++;
break;
case 53:
c++;
break;
case 54:
c++;
break;
case 55:
c++;
break;
case 56:
c++;
break;
case 57:
c++;
break;
case 58:
c++;
break;
case 59:
c++;
break;
case 60:
c++;
break;
case 61:
c++;
break;
case 62:
c++;
break;
case 63:
c++;
break;
case 64:
c++;
break;
case 65:
c++;
break;
case 66:
c++;
break;
case 67:
c++;
break;
case 68:
c++;
break;
case 69:
c++;
break;
case 70:
c++;
break;
case 71:
c++;
break;
case 72:
c++;
break;
case 73:
c++;
break;
case 74:
c++;
break;
case 75:
c++;
break;
case 76:
c++;
break;
case 77:
c++;
break;
case 78:
c++;
break;
case 79:
c++;
break;
case 80:
c++;
break;
case 81:
c++;
break;
case 82:
c++;
break;
case 83:
c++;
break;
case 84:
c++;
break;
case 85:
c++;
break;
case 86:
c++;
break;
case 87:
c++;
break;
case 88:
c++;
break;
case 89:
c++;
break;
case 90:
c++;
break;
case 91:
c++;
break;
case 92:
c++;
break;
case 93:
c++;
break;
case 94:
c++;
break;
case 95:
c++;
break;
case 96:
c++;
break;
case 97:
c++;
break;
case 98:
c++;
break;
case 99:
c++;
break;
case 100:
c++;
break;
case 101:
c++;
break;
case 102:
c++;
break;
case 103:
c++;
break;
case 104:
c++;
break;
case 105:
c++;
break;
case 106:
c++;
break;
case 107:
c++;
break;
case 108:
c++;
break;
case 109:
c++;
break;
case 110:
c++;
break;
case 111:
c++;
break;
case 112:
c++;
break;
case 113:
c++;
break;
case 114:
c++;
break;
case 115:
c++;
break;
case 116:
c++;
break;
case 117:
c++;
break;
case 118:
c++;
break;
case 119:
c++;
break;
default:
c--;
break;
}
}
return c;
}
int cover_swi50( int c )
{
int i;
_Pragma( "loopbound min 50 max 50" )
for ( i = 0; i < 50; i++ ) {
switch ( i ) {
case 0:
c++;
break;
case 1:
c++;
break;
case 2:
c++;
break;
case 3:
c++;
break;
case 4:
c++;
break;
case 5:
c++;
break;
case 6:
c++;
break;
case 7:
c++;
break;
case 8:
c++;
break;
case 9:
c++;
break;
case 10:
c++;
break;
case 11:
c++;
break;
case 12:
c++;
break;
case 13:
c++;
break;
case 14:
c++;
break;
case 15:
c++;
break;
case 16:
c++;
break;
case 17:
c++;
break;
case 18:
c++;
break;
case 19:
c++;
break;
case 20:
c++;
break;
case 21:
c++;
break;
case 22:
c++;
break;
case 23:
c++;
break;
case 24:
c++;
break;
case 25:
c++;
break;
case 26:
c++;
break;
case 27:
c++;
break;
case 28:
c++;
break;
case 29:
c++;
break;
case 30:
c++;
break;
case 31:
c++;
break;
case 32:
c++;
break;
case 33:
c++;
break;
case 34:
c++;
break;
case 35:
c++;
break;
case 36:
c++;
break;
case 37:
c++;
break;
case 38:
c++;
break;
case 39:
c++;
break;
case 40:
c++;
break;
case 41:
c++;
break;
case 42:
c++;
break;
case 43:
c++;
break;
case 44:
c++;
break;
case 45:
c++;
break;
case 46:
c++;
break;
case 47:
c++;
break;
case 48:
c++;
break;
case 49:
c++;
break;
case 50:
c++;
break;
case 51:
c++;
break;
case 52:
c++;
break;
case 53:
c++;
break;
case 54:
c++;
break;
case 55:
c++;
break;
case 56:
c++;
break;
case 57:
c++;
break;
case 58:
c++;
break;
case 59:
c++;
break;
default:
c--;
break;
}
}
return c;
}
int cover_swi10( int c )
{
int i;
_Pragma( "loopbound min 10 max 10" )
for ( i = 0; i < 10; i++ ) {
switch ( i ) {
case 0:
c++;
break;
case 1:
c++;
break;
case 2:
c++;
break;
case 3:
c++;
break;
case 4:
c++;
break;
case 5:
c++;
break;
case 6:
c++;
break;
case 7:
c++;
break;
case 8:
c++;
break;
case 9:
c++;
break;
default:
c--;
break;
}
}
return c;
}
void _Pragma( "entrypoint" ) cover_main( void )
{
cover_cnt = cover_swi10( cover_cnt );
cover_cnt = cover_swi50( cover_cnt );
cover_cnt = cover_swi120( cover_cnt );
}
/*
Main function
*/
int main( void )
{
cover_init();
cover_main();
return cover_return();
}

Binary file not shown.

View File

@ -0,0 +1,61 @@
(module $cover.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 $cover_main (type 1)
(local i32)
i32.const 0
i32.load offset=1024
local.set 0
i32.const 10
i32.const 10
call $__pragma_loopbound
i32.const 0
local.get 0
i32.const 10
i32.add
i32.store offset=1024
i32.const 0
i32.load offset=1024
local.set 0
i32.const 50
i32.const 50
call $__pragma_loopbound
i32.const 0
local.get 0
i32.const 50
i32.add
i32.store offset=1024
i32.const 0
i32.load offset=1024
local.set 0
i32.const 120
i32.const 120
call $__pragma_loopbound
i32.const 0
local.get 0
i32.const 120
i32.add
i32.store offset=1024)
(func $__original_main (type 2) (result i32)
i32.const 0
i32.const 0
i32.store offset=1024
call $cover_main
i32.const 0
i32.load offset=1024
i32.const -180
i32.add)
(table (;0;) 1 1 funcref)
(memory (;0;) 1)
(global $__stack_pointer (mut i32) (i32.const 5136))
(global (;1;) i32 (i32.const 1028))
(global (;2;) i32 (i32.const 5136))
(export "memory" (memory 0))
(export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs))
(export "entrypoint" (func $cover_main))
(export "main" (func $__original_main))
(export "__data_end" (global 1))
(export "__heap_base" (global 2)))

View File

@ -0,0 +1,699 @@
/*
This program is part of the TACLeBench benchmark suite.
Version 2.0
Name: cover
Author: unknown
Function: A program for testing many paths generated by switch-case
statements.
Source: MRTC
http://www.mrtc.mdh.se/projects/wcet/wcet_bench/cover/cover.c
Original name: cover
Changes: See ChangeLog.txt
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 cover_init(void);
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
cover_main(void);
int cover_return(void);
int cover_swi10(int);
int cover_swi50(int);
int cover_swi120(int);
/*
Declaration of global variables
*/
static volatile int cover_cnt;
/*
Initialization- and return-value-related functions
*/
void
cover_init(void) {
cover_cnt = 0;
}
int
cover_return(void) {
return cover_cnt - 180;
}
/*
Core benchmark functions
*/
int
cover_swi120(int c) {
int i;
__pragma_loopbound(120, 120);
for (i = 0; i < 120; i++) {
switch (i) {
case 0:
c++;
break;
case 1:
c++;
break;
case 2:
c++;
break;
case 3:
c++;
break;
case 4:
c++;
break;
case 5:
c++;
break;
case 6:
c++;
break;
case 7:
c++;
break;
case 8:
c++;
break;
case 9:
c++;
break;
case 10:
c++;
break;
case 11:
c++;
break;
case 12:
c++;
break;
case 13:
c++;
break;
case 14:
c++;
break;
case 15:
c++;
break;
case 16:
c++;
break;
case 17:
c++;
break;
case 18:
c++;
break;
case 19:
c++;
break;
case 20:
c++;
break;
case 21:
c++;
break;
case 22:
c++;
break;
case 23:
c++;
break;
case 24:
c++;
break;
case 25:
c++;
break;
case 26:
c++;
break;
case 27:
c++;
break;
case 28:
c++;
break;
case 29:
c++;
break;
case 30:
c++;
break;
case 31:
c++;
break;
case 32:
c++;
break;
case 33:
c++;
break;
case 34:
c++;
break;
case 35:
c++;
break;
case 36:
c++;
break;
case 37:
c++;
break;
case 38:
c++;
break;
case 39:
c++;
break;
case 40:
c++;
break;
case 41:
c++;
break;
case 42:
c++;
break;
case 43:
c++;
break;
case 44:
c++;
break;
case 45:
c++;
break;
case 46:
c++;
break;
case 47:
c++;
break;
case 48:
c++;
break;
case 49:
c++;
break;
case 50:
c++;
break;
case 51:
c++;
break;
case 52:
c++;
break;
case 53:
c++;
break;
case 54:
c++;
break;
case 55:
c++;
break;
case 56:
c++;
break;
case 57:
c++;
break;
case 58:
c++;
break;
case 59:
c++;
break;
case 60:
c++;
break;
case 61:
c++;
break;
case 62:
c++;
break;
case 63:
c++;
break;
case 64:
c++;
break;
case 65:
c++;
break;
case 66:
c++;
break;
case 67:
c++;
break;
case 68:
c++;
break;
case 69:
c++;
break;
case 70:
c++;
break;
case 71:
c++;
break;
case 72:
c++;
break;
case 73:
c++;
break;
case 74:
c++;
break;
case 75:
c++;
break;
case 76:
c++;
break;
case 77:
c++;
break;
case 78:
c++;
break;
case 79:
c++;
break;
case 80:
c++;
break;
case 81:
c++;
break;
case 82:
c++;
break;
case 83:
c++;
break;
case 84:
c++;
break;
case 85:
c++;
break;
case 86:
c++;
break;
case 87:
c++;
break;
case 88:
c++;
break;
case 89:
c++;
break;
case 90:
c++;
break;
case 91:
c++;
break;
case 92:
c++;
break;
case 93:
c++;
break;
case 94:
c++;
break;
case 95:
c++;
break;
case 96:
c++;
break;
case 97:
c++;
break;
case 98:
c++;
break;
case 99:
c++;
break;
case 100:
c++;
break;
case 101:
c++;
break;
case 102:
c++;
break;
case 103:
c++;
break;
case 104:
c++;
break;
case 105:
c++;
break;
case 106:
c++;
break;
case 107:
c++;
break;
case 108:
c++;
break;
case 109:
c++;
break;
case 110:
c++;
break;
case 111:
c++;
break;
case 112:
c++;
break;
case 113:
c++;
break;
case 114:
c++;
break;
case 115:
c++;
break;
case 116:
c++;
break;
case 117:
c++;
break;
case 118:
c++;
break;
case 119:
c++;
break;
default:
c--;
break;
}
}
return c;
}
int
cover_swi50(int c) {
int i;
__pragma_loopbound(50, 50);
for (i = 0; i < 50; i++) {
switch (i) {
case 0:
c++;
break;
case 1:
c++;
break;
case 2:
c++;
break;
case 3:
c++;
break;
case 4:
c++;
break;
case 5:
c++;
break;
case 6:
c++;
break;
case 7:
c++;
break;
case 8:
c++;
break;
case 9:
c++;
break;
case 10:
c++;
break;
case 11:
c++;
break;
case 12:
c++;
break;
case 13:
c++;
break;
case 14:
c++;
break;
case 15:
c++;
break;
case 16:
c++;
break;
case 17:
c++;
break;
case 18:
c++;
break;
case 19:
c++;
break;
case 20:
c++;
break;
case 21:
c++;
break;
case 22:
c++;
break;
case 23:
c++;
break;
case 24:
c++;
break;
case 25:
c++;
break;
case 26:
c++;
break;
case 27:
c++;
break;
case 28:
c++;
break;
case 29:
c++;
break;
case 30:
c++;
break;
case 31:
c++;
break;
case 32:
c++;
break;
case 33:
c++;
break;
case 34:
c++;
break;
case 35:
c++;
break;
case 36:
c++;
break;
case 37:
c++;
break;
case 38:
c++;
break;
case 39:
c++;
break;
case 40:
c++;
break;
case 41:
c++;
break;
case 42:
c++;
break;
case 43:
c++;
break;
case 44:
c++;
break;
case 45:
c++;
break;
case 46:
c++;
break;
case 47:
c++;
break;
case 48:
c++;
break;
case 49:
c++;
break;
case 50:
c++;
break;
case 51:
c++;
break;
case 52:
c++;
break;
case 53:
c++;
break;
case 54:
c++;
break;
case 55:
c++;
break;
case 56:
c++;
break;
case 57:
c++;
break;
case 58:
c++;
break;
case 59:
c++;
break;
default:
c--;
break;
}
}
return c;
}
int
cover_swi10(int c) {
int i;
__pragma_loopbound(10, 10);
for (i = 0; i < 10; i++) {
switch (i) {
case 0:
c++;
break;
case 1:
c++;
break;
case 2:
c++;
break;
case 3:
c++;
break;
case 4:
c++;
break;
case 5:
c++;
break;
case 6:
c++;
break;
case 7:
c++;
break;
case 8:
c++;
break;
case 9:
c++;
break;
default:
c--;
break;
}
}
return c;
}
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
cover_main(void) {
cover_cnt = cover_swi10(cover_cnt);
cover_cnt = cover_swi50(cover_cnt);
cover_cnt = cover_swi120(cover_cnt);
}
/*
Main function
*/
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
cover_init();
cover_main();
return cover_return();
}

View File

@ -0,0 +1,705 @@
/*
This program is part of the TACLeBench benchmark suite.
Version 2.0
Name: cover
Author: unknown
Function: A program for testing many paths generated by switch-case
statements.
Source: MRTC
http://www.mrtc.mdh.se/projects/wcet/wcet_bench/cover/cover.c
Original name: cover
Changes: See ChangeLog.txt
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 cover_init(void);
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
cover_main(void);
__attribute__((always_inline)) static inline int cover_return(void);
__attribute__((always_inline)) static inline int cover_swi10(int);
__attribute__((always_inline)) static inline int cover_swi50(int);
__attribute__((always_inline)) static inline int cover_swi120(int);
/*
Declaration of global variables
*/
static volatile int cover_cnt;
/*
Initialization- and return-value-related functions
*/
__attribute__((always_inline)) static inline void
cover_init(void) {
cover_cnt = 0;
}
__attribute__((always_inline)) static inline int
cover_return(void) {
return cover_cnt - 180;
}
/*
Core benchmark functions
*/
__attribute__((always_inline)) static inline int
cover_swi120(int c) {
int i;
__pragma_loopbound(120, 120);
for (i = 0; i < 120; i++) {
switch (i) {
case 0:
c++;
break;
case 1:
c++;
break;
case 2:
c++;
break;
case 3:
c++;
break;
case 4:
c++;
break;
case 5:
c++;
break;
case 6:
c++;
break;
case 7:
c++;
break;
case 8:
c++;
break;
case 9:
c++;
break;
case 10:
c++;
break;
case 11:
c++;
break;
case 12:
c++;
break;
case 13:
c++;
break;
case 14:
c++;
break;
case 15:
c++;
break;
case 16:
c++;
break;
case 17:
c++;
break;
case 18:
c++;
break;
case 19:
c++;
break;
case 20:
c++;
break;
case 21:
c++;
break;
case 22:
c++;
break;
case 23:
c++;
break;
case 24:
c++;
break;
case 25:
c++;
break;
case 26:
c++;
break;
case 27:
c++;
break;
case 28:
c++;
break;
case 29:
c++;
break;
case 30:
c++;
break;
case 31:
c++;
break;
case 32:
c++;
break;
case 33:
c++;
break;
case 34:
c++;
break;
case 35:
c++;
break;
case 36:
c++;
break;
case 37:
c++;
break;
case 38:
c++;
break;
case 39:
c++;
break;
case 40:
c++;
break;
case 41:
c++;
break;
case 42:
c++;
break;
case 43:
c++;
break;
case 44:
c++;
break;
case 45:
c++;
break;
case 46:
c++;
break;
case 47:
c++;
break;
case 48:
c++;
break;
case 49:
c++;
break;
case 50:
c++;
break;
case 51:
c++;
break;
case 52:
c++;
break;
case 53:
c++;
break;
case 54:
c++;
break;
case 55:
c++;
break;
case 56:
c++;
break;
case 57:
c++;
break;
case 58:
c++;
break;
case 59:
c++;
break;
case 60:
c++;
break;
case 61:
c++;
break;
case 62:
c++;
break;
case 63:
c++;
break;
case 64:
c++;
break;
case 65:
c++;
break;
case 66:
c++;
break;
case 67:
c++;
break;
case 68:
c++;
break;
case 69:
c++;
break;
case 70:
c++;
break;
case 71:
c++;
break;
case 72:
c++;
break;
case 73:
c++;
break;
case 74:
c++;
break;
case 75:
c++;
break;
case 76:
c++;
break;
case 77:
c++;
break;
case 78:
c++;
break;
case 79:
c++;
break;
case 80:
c++;
break;
case 81:
c++;
break;
case 82:
c++;
break;
case 83:
c++;
break;
case 84:
c++;
break;
case 85:
c++;
break;
case 86:
c++;
break;
case 87:
c++;
break;
case 88:
c++;
break;
case 89:
c++;
break;
case 90:
c++;
break;
case 91:
c++;
break;
case 92:
c++;
break;
case 93:
c++;
break;
case 94:
c++;
break;
case 95:
c++;
break;
case 96:
c++;
break;
case 97:
c++;
break;
case 98:
c++;
break;
case 99:
c++;
break;
case 100:
c++;
break;
case 101:
c++;
break;
case 102:
c++;
break;
case 103:
c++;
break;
case 104:
c++;
break;
case 105:
c++;
break;
case 106:
c++;
break;
case 107:
c++;
break;
case 108:
c++;
break;
case 109:
c++;
break;
case 110:
c++;
break;
case 111:
c++;
break;
case 112:
c++;
break;
case 113:
c++;
break;
case 114:
c++;
break;
case 115:
c++;
break;
case 116:
c++;
break;
case 117:
c++;
break;
case 118:
c++;
break;
case 119:
c++;
break;
default:
c--;
break;
}
}
return c;
}
__attribute__((always_inline)) static inline int
cover_swi50(int c) {
int i;
__pragma_loopbound(50, 50);
for (i = 0; i < 50; i++) {
switch (i) {
case 0:
c++;
break;
case 1:
c++;
break;
case 2:
c++;
break;
case 3:
c++;
break;
case 4:
c++;
break;
case 5:
c++;
break;
case 6:
c++;
break;
case 7:
c++;
break;
case 8:
c++;
break;
case 9:
c++;
break;
case 10:
c++;
break;
case 11:
c++;
break;
case 12:
c++;
break;
case 13:
c++;
break;
case 14:
c++;
break;
case 15:
c++;
break;
case 16:
c++;
break;
case 17:
c++;
break;
case 18:
c++;
break;
case 19:
c++;
break;
case 20:
c++;
break;
case 21:
c++;
break;
case 22:
c++;
break;
case 23:
c++;
break;
case 24:
c++;
break;
case 25:
c++;
break;
case 26:
c++;
break;
case 27:
c++;
break;
case 28:
c++;
break;
case 29:
c++;
break;
case 30:
c++;
break;
case 31:
c++;
break;
case 32:
c++;
break;
case 33:
c++;
break;
case 34:
c++;
break;
case 35:
c++;
break;
case 36:
c++;
break;
case 37:
c++;
break;
case 38:
c++;
break;
case 39:
c++;
break;
case 40:
c++;
break;
case 41:
c++;
break;
case 42:
c++;
break;
case 43:
c++;
break;
case 44:
c++;
break;
case 45:
c++;
break;
case 46:
c++;
break;
case 47:
c++;
break;
case 48:
c++;
break;
case 49:
c++;
break;
case 50:
c++;
break;
case 51:
c++;
break;
case 52:
c++;
break;
case 53:
c++;
break;
case 54:
c++;
break;
case 55:
c++;
break;
case 56:
c++;
break;
case 57:
c++;
break;
case 58:
c++;
break;
case 59:
c++;
break;
default:
c--;
break;
}
}
return c;
}
__attribute__((always_inline)) static inline int
cover_swi10(int c) {
int i;
__pragma_loopbound(10, 10);
for (i = 0; i < 10; i++) {
switch (i) {
case 0:
c++;
break;
case 1:
c++;
break;
case 2:
c++;
break;
case 3:
c++;
break;
case 4:
c++;
break;
case 5:
c++;
break;
case 6:
c++;
break;
case 7:
c++;
break;
case 8:
c++;
break;
case 9:
c++;
break;
default:
c--;
break;
}
}
return c;
}
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
cover_main(void) {
cover_cnt = cover_swi10(cover_cnt);
cover_cnt = cover_swi50(cover_cnt);
cover_cnt = cover_swi120(cover_cnt);
}
/*
Main function
*/
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
cover_init();
cover_main();
return cover_return();
}

View File

@ -0,0 +1,25 @@
# ~~~
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2026, Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU)
# ~~~
cmake_minimum_required(VERSION 3.20)
project(duff)
set(TACLEBENCH_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../..")
set(REPOSITORY_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..")
set(APP_TARGET_NAME "${CMAKE_PROJECT_NAME}")
if(DEFINED TACLEBENCH_VARIANT AND "${TACLEBENCH_VARIANT}" STREQUAL "inline")
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/inline/duff.c")
else()
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/default/duff.c")
endif()
include(${REPOSITORY_ROOT_PATH}/cmake/taclebench_wasm.cmake)

View File

@ -0,0 +1,40 @@
File: duff.c
Original provenience: Mälardalen benchmark suite,
ww.mrtc.mdh.se/projects/wcet/wcet_bench/duff/duff.c
2015-12-21:
- Susbstituted #define ARRAYSIZE 100
- Susbstituted #define INVOCATION_COUNT 43
- Renamed each function FUNC to duff_FUNC
- Changed the order of parameters in the functio call
duff_copy( duff_target, duff_source, 43 ). Original version was not working.
- Added functions duff_init, duff_return and main
- Added forward declarations of all functions before the declarations of global
variables
- Used duff_target[0] as the return value
- Re-ordered functions to fit template-order
- Applied code formatting according to the following rules
(incomplete, to be discussed; I basically used astyle with the attached
options file):
- Lines shall not be wider than 80 characters; whenever possible, appropriate
line breaks shall be inserted to keep lines below 80 characters
- Indentation is done using whitespaces only, no tabs. Code is indented by
two whitespaces
- Two empty lines are put between any two functions
- In non-empty lists or index expressions, opening '(' and '[' are followed by
one whitespace, closing ')' and ']' are preceded by one whitespace
- In comma- or colon-separated argument lists, one whitespace is put after
each comma/colon
- Names of functions and global variables all start with a benchmark-specific
prefix (here: st_) followed by lowercase letter (e.g., st_square)
- For pointer types, one whitespace is put before the '*'
- Operators within expressions shall be preceded and followed by one
whitespace
- Code of then- and else-parts of if-then-else statements shall be put in
separate lines, not in the same lines as the if-condition or the keyword
"else"
- Opening braces '{' denoting the beginning of code for some if-else or loop
body shall be put at the end of the same line where the keywords "if",
"else", "for", "while" etc. occur
- Added general TACLeBench header to beginning of source code

View File

@ -0,0 +1,133 @@
/*
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
*/
void duff_copy( char *to, char *from, int count );
void duff_initialize( char *arr, int length );
void duff_init();
void duff_main( void );
int duff_return( void );
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 min 400 max 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 min 100 max 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
*/
void _Pragma( "entrypoint" ) duff_main( void )
{
duff_copy( duff_target, duff_source, 43 );
}
int main( void )
{
duff_init();
duff_main();
return ( duff_return() );
}

Binary file not shown.

View 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)))

View File

@ -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());
}

View File

@ -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());
}

View File

@ -0,0 +1,25 @@
# ~~~
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2026, Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU)
# ~~~
cmake_minimum_required(VERSION 3.20)
project(test3)
set(TACLEBENCH_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../..")
set(REPOSITORY_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..")
set(APP_TARGET_NAME "${CMAKE_PROJECT_NAME}")
if(DEFINED TACLEBENCH_VARIANT AND "${TACLEBENCH_VARIANT}" STREQUAL "inline")
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/inline/test3.c")
else()
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/default/test3.c")
endif()
include(${REPOSITORY_ROOT_PATH}/cmake/taclebench_wasm.cmake)

View File

@ -0,0 +1,37 @@
File: test3.c
Original provenience: Universitaet des Saarlandes, Saarbruecken, Germany
Compiler Research Group
2015-10-18:
- Removed original header comment, replaced by TACLeBench header.
- Added prefix "test3_" to all global symbols.
- Added explicit forward declarations of functions.
- Replaced initialization code by TACLeBench-compliant initialization code.
Added pseudo-random initialization of the global arrays "test3_array1" ...
"test3_array8".
- Added new function test3_return producing a checksum as return value.
- Added new function test3_main according to TACLeBench guidelines.
test3_main is annotated as entry-point for timing analysis.
- Applied code formatting according to the following rules
- Lines shall not be wider than 80 characters; whenever possible, appropriate
line breaks shall be inserted to keep lines below 80 characters
- Indentation is done using whitespaces only, no tabs. Code is indented by
two whitespaces
- Two empty lines are put between any two functions
- In non-empty lists or index expressions, opening '(' and '[' are followed by
one whitespace, closing ')' and ']' are preceded by one whitespace
- In comma- or colon-separated argument lists, one whitespace is put after
each comma/colon
- Names of functions and global variables all start with a benchmark-specific
prefix (here: bs_) followed by lowercase letter (e.g., bs_square)
- For pointer types, one whitespace is put before the '*'
- Operators within expressions shall be preceded and followed by one
whitespace
- Code of then- and else-parts of if-then-else statements shall be put in
separate lines, not in the same lines as the if-condition or the keyword
"else"
- Opening braces '{' denoting the beginning of code for some if-else or loop
body shall be put at the end of the same line where the keywords "if",
"else", "for", "while" etc. occur
- Sanity check: Replaced all expressions 'x >> 1' by 'x >>= 1' in order to
eliminate compiler warnings showing that 'x >> 1' makes no sense.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff