This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to disable floating-point instruction generation with aarch64 GCC compiler

Dear Sir,

  How to disable floating-point instruction generation with aarch64 GCC compiler ?

  We want to use software to do floating-point calculation.

  But always has error messages as below:

aarch64-linux-gnu-gcc -mcpu=cortex-a53+nofp test.c
test.c: In function 'main':
test.c:24:11: error: '+nofp' feature modifier is incompatible with floating-point code
     float aa = 0.0;
           ^
test.c:28:12: error: '+nofp' feature modifier is incompatible with floating-point argument
         aa += 3.0;
            ^
test.c:28:12: error: '+nofp' feature modifier is incompatible with floating-point argument
test.c:28:12: error: '+nofp' feature modifier is incompatible with floating-point code
test.c:28: confused by earlier errors, bailing out

    Any suggestion is good.

    Thank you.

test.c

#include <stdlib.h>
#include <stdio.h>

/*
 * void main(void)
 *    the application start point for the primary CPU
 *
 *  Inputs
 *    <none>
 *
 *  Returns
 *    subroutine does not return
 */
int main(void)
{
    float aa = 0.0;
    int i;

    for(i = 0; i < 1024; i++) {
        aa += 3.0;
    }  

    if (aa > 1000.0)
        exit(1);
    else
        exit(2);

    return 0;
}