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(deg2rad)
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/deg2rad.c")
else()
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/default/deg2rad.c")
endif()
include(${REPOSITORY_ROOT_PATH}/cmake/taclebench_wasm.cmake)

View File

@ -0,0 +1,78 @@
Original provenience: MiBench benchmark suite,
http://wwweb.eecs.umich.edu/mibench
2016-02-09:
- Added TACLeBench header
- Renamed benchmark from 'basicmath_small' to 'basicmath'
- Fixed a typo in code comments: 'soem' -> 'some'
- Removed unused variable 'n' from the main funcion
- Added variable 'double Y' to the main function and accumulated the results of
'deg2rad(X)' and 'rad2deg(X)' in this variable so that the compiler warning
'statement with no effect' is fixed.
- Removed conditionally compiled main (test) function from isqrt.c
- Removed conditionally compiled main (test) function from cubic.c
- Removed commented-out code
- Removed unused function, variable, macro and type declarations, structs and
unions
- Removed seemingly unnecessary empty lines
- Renamed memcpy.t to basicmath_libc.c
- Removed unused files:
rad2deg.c
sniptype.h
sniptype.h
- Created basicmath_libc.h and put declaration of basicmath_memcpy() in it
- Reorganized snipmath.h so that the following are in the given order just
after the header
- includes
- declarations of functions
- Reorganized sniptype.h so that the following are in the given order just
after the header
- macro definitions
- type definitions
- Removed duplicated copyright information from wcclibm.c
- Removed __STDC__ checks from wcclibm.c and used only ANSI style function
arguments
- Removed 'last modified' comments from files
- Removed mention 'use __kernel_rem_pio2f()' from comments of function
__ieee754_rem_pio2f() since it doesn't really use it.
- Removed math functions specialization macros from wcclibm.h and updated call
sites with explicit nameks of the functions.
- Removed '#define double float' from wcclibm.h and replaced all 'double's
with 'float's in the benchmark
- Added a new main function that calls the old main function
- Annotated basicmath_main() as the entry point of the 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: statemate_) followed by lowercase letter
- 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
2017-06-27
- Introduce basicmath_init and basicmath_return functions.
- Add prefix basicmath_ to global variables.
- Introduce dummy initialization in ieee754_rem_pio2f to please linter.
2017-07-10
- Fix possible stack buffer overflow caused by sizeof of incorrect type.
2019-03-07
-split basicmath into seperate files
-Add TACLeBench Header
-put each benchmark into a seperate folder
-adjust the code formatting to the common TACLeBench code style

View File

@ -0,0 +1,90 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.9
Name: deg2rad
Author: unknown
Function: deg2rad performs conversion of degree to radiant
Source: MiBench
http://wwweb.eecs.umich.edu/mibench
Original name: basicmath_small
Changes: no major functional changes
License: this code is FREE with no restrictions
*/
#include "pi.h"
#define deg2rad(d) ((d)*PI/180)
/*
Forward declaration of functions
*/
void deg2rad_init( void );
void deg2rad_main( void );
int deg2rad_return( void );
int main( void );
/*
Declaration of global variables
*/
float deg2rad_X, deg2rad_Y;
/*
Initialization function
*/
void deg2rad_init( void )
{
deg2rad_X = 0;
deg2rad_Y = 0;
}
/*
Return function
*/
int deg2rad_return( void )
{
int temp = deg2rad_Y;
if ( temp == 1133 )
return 0;
else
return -1;
}
/*
Main functions
*/
void _Pragma( "entrypoint" ) deg2rad_main( void )
{
/* convert some rads to degrees */
_Pragma( "loopbound min 361 max 361" )
for ( deg2rad_X = 0.0f; deg2rad_X <= 360.0f; deg2rad_X += 1.0f )
deg2rad_Y += deg2rad( deg2rad_X );
}
int main( void )
{
deg2rad_init();
deg2rad_main();
return deg2rad_return();
}

View File

@ -0,0 +1,83 @@
(module $deg2rad.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 $deg2rad_main (type 1)
(local f32 f32)
i32.const 361
i32.const 361
call $__pragma_loopbound
i32.const 0
f32.load offset=1028
local.set 0
f32.const 0x0p+0 (;=0;)
local.set 1
loop ;; label = @1
local.get 1
f32.const 0x1.91eb86p+1 (;=3.14;)
f32.mul
f32.const 0x1.68p+7 (;=180;)
f32.div
local.get 0
f32.add
local.set 0
local.get 1
f32.const 0x1p+0 (;=1;)
f32.add
local.tee 1
f32.const 0x1.68p+8 (;=360;)
f32.le
br_if 0 (;@1;)
end
i32.const 0
local.get 0
f32.store offset=1028
i32.const 0
local.get 1
f32.store offset=1024)
(func $__original_main (type 2) (result i32)
(local f32 i32)
i32.const 0
i32.const 0
i32.store offset=1028
i32.const 0
i32.const 0
i32.store offset=1024
call $deg2rad_main
block ;; label = @1
block ;; label = @2
i32.const 0
f32.load offset=1028
local.tee 0
f32.abs
f32.const 0x1p+31 (;=2.14748e+09;)
f32.lt
i32.eqz
br_if 0 (;@2;)
local.get 0
i32.trunc_f32_s
local.set 1
br 1 (;@1;)
end
i32.const -2147483648
local.set 1
end
i32.const -1
i32.const 0
local.get 1
i32.const 1133
i32.ne
select)
(table (;0;) 1 1 funcref)
(memory (;0;) 1)
(global $__stack_pointer (mut i32) (i32.const 5136))
(global (;1;) i32 (i32.const 1032))
(global (;2;) i32 (i32.const 5136))
(export "memory" (memory 0))
(export "__wasm_apply_data_relocs" (func $__wasm_apply_data_relocs))
(export "entrypoint" (func $deg2rad_main))
(export "main" (func $__original_main))
(export "__data_end" (global 1))
(export "__heap_base" (global 2)))

View File

@ -0,0 +1,89 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.9
Name: deg2rad
Author: unknown
Function: deg2rad performs conversion of degree to radiant
Source: MiBench
http://wwweb.eecs.umich.edu/mibench
Original name: basicmath_small
Changes: no major functional changes
License: this code is FREE with no restrictions
*/
#include "pi.h"
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
#define deg2rad(d) ((d) * PI / 180)
/*
Forward declaration of functions
*/
void deg2rad_init(void);
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
deg2rad_main(void);
int deg2rad_return(void);
__attribute__((noinline)) __attribute__((export_name("main"))) int main(void);
/*
Declaration of global variables
*/
float deg2rad_X, deg2rad_Y;
/*
Initialization function
*/
void
deg2rad_init(void) {
deg2rad_X = 0;
deg2rad_Y = 0;
}
/*
Return function
*/
int
deg2rad_return(void) {
int temp = deg2rad_Y;
if (temp == 1133)
return 0;
else
return -1;
}
/*
Main functions
*/
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
deg2rad_main(void) {
/* convert some rads to degrees */
__pragma_loopbound(361, 361);
for (deg2rad_X = 0.0f; deg2rad_X <= 360.0f; deg2rad_X += 1.0f)
deg2rad_Y += deg2rad(deg2rad_X);
}
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
deg2rad_init();
deg2rad_main();
return deg2rad_return();
}

View File

@ -0,0 +1,30 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.9
Name: pi
Author: unknown
Function: Header file for definition of pi
Source: MiBench
http://wwweb.eecs.umich.edu/mibench
Original name: basicmath_small
Changes: no major functional changes
License: this code is FREE with no restrictions
*/
#ifndef PI__H
#define PI__H
#ifndef PI
#define PI 3.14f
#endif
#endif /* PI__H */

View File

@ -0,0 +1,97 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.9
Name: deg2rad
Author: unknown
Function: deg2rad performs conversion of degree to radiant
Source: MiBench
http://wwweb.eecs.umich.edu/mibench
Original name: basicmath_small
Changes: no major functional changes
License: this code is FREE with no restrictions
*/
#include "pi.h"
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
#define deg2rad(d) ((d) * PI / 180)
/*
Forward declaration of functions
*/
__attribute__((always_inline)) static inline void deg2rad_init(void);
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
deg2rad_main(void);
__attribute__((always_inline)) static inline int deg2rad_return(void);
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void);
/*
Declaration of global variables
*/
float deg2rad_X, deg2rad_Y;
/*
Initialization function
*/
__attribute__((always_inline)) static inline void
deg2rad_init(void) {
deg2rad_X = 0;
deg2rad_Y = 0;
}
/*
Return function
*/
__attribute__((always_inline)) static inline int
deg2rad_return(void) {
int temp = deg2rad_Y;
if (temp == 1133)
return 0;
else
return -1;
}
/*
Main functions
*/
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
deg2rad_main(void) {
/* convert some rads to degrees */
__pragma_loopbound(361, 361);
for (deg2rad_X = 0.0f; deg2rad_X <= 360.0f; deg2rad_X += 1.0f)
deg2rad_Y += deg2rad(deg2rad_X);
}
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
deg2rad_init();
deg2rad_main();
return deg2rad_return();
}

View File

@ -0,0 +1,30 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.9
Name: pi
Author: unknown
Function: Header file for definition of pi
Source: MiBench
http://wwweb.eecs.umich.edu/mibench
Original name: basicmath_small
Changes: no major functional changes
License: this code is FREE with no restrictions
*/
#ifndef PI__H
#define PI__H
#ifndef PI
#define PI 3.14f
#endif
#endif /* PI__H */

View File

@ -0,0 +1,31 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.9
Name: pi
Author: unknown
Function: Header file for definition of pi
Source: MiBench
http://wwweb.eecs.umich.edu/mibench
Original name: basicmath_small
Changes: no major functional changes
License: this code is FREE with no restrictions
*/
#ifndef PI__H
#define PI__H
#ifndef PI
#define PI 3.14f
#endif
#endif /* PI__H */