Search code examples
ccompiler-constructionbenchmarking

How to compile the floating computation of DSPStone on X86 Architecture?


I want to use this benchmark to evaluate my optimization in compiler.

I can compile int computation of DSPStone on X86 architecture, but the other cannot.

The error is the type of main function is float.

I know it is not allowed in X86 architecture, so I want to know if there are other ways to compile it on X86.

Thanks!!


Solution

  • You just create a float function and call it with your main function. Please read some C tutorials.

    I suggest this one: https://www.tutorialspoint.com/cprogramming/index.htm

    float computation(float f);
    
    int main(int argc, char *argv[]) {
        float test = 3.14;
        test = computation(test);
        return 0;
    }
    
    float computation(float f) {
        f = f + f;
        return f;
    }