86 lines
1.4 KiB
C
86 lines
1.4 KiB
C
/*
|
|
|
|
This program is part of the TACLeBench benchmark suite.
|
|
Version V 1.9
|
|
|
|
Name: cosf
|
|
|
|
Author: Dustin Green
|
|
|
|
Function: cosf performs calculations of the cosinus function
|
|
|
|
Source:
|
|
|
|
Original name:
|
|
|
|
Changes:
|
|
|
|
License: this code is FREE with no restrictions
|
|
|
|
*/
|
|
|
|
#include "wcclibm.h"
|
|
|
|
/*
|
|
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 cosf_init(void);
|
|
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
|
cosf_main(void);
|
|
int cosf_return(void);
|
|
__attribute__((noinline)) __attribute__((export_name("main"))) int main(void);
|
|
|
|
/*
|
|
Declaration of global variables
|
|
*/
|
|
|
|
float cosf_solutions;
|
|
|
|
/*
|
|
Initialization function
|
|
*/
|
|
|
|
void
|
|
cosf_init(void) {
|
|
cosf_solutions = 0.0f;
|
|
}
|
|
|
|
/*
|
|
Return function
|
|
*/
|
|
|
|
int
|
|
cosf_return(void) {
|
|
int temp = cosf_solutions;
|
|
|
|
if (temp == -4)
|
|
return 0;
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
/*
|
|
Main functions
|
|
*/
|
|
|
|
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
|
cosf_main(void) {
|
|
float i;
|
|
__pragma_loopbound(100, 100);
|
|
for (i = 0.0f; i < 10; i += 0.1f)
|
|
cosf_solutions += basicmath___cosf(i);
|
|
}
|
|
|
|
__attribute__((noinline)) __attribute__((export_name("main"))) int
|
|
main(void) {
|
|
cosf_init();
|
|
cosf_main();
|
|
return cosf_return();
|
|
}
|