Add prefetch capability to target of arm-linux-gnueabi-g++

694 Views Asked by At

The following line of code has been cross-compiled by using arm-linux-gnueabi-g++-4.7 on Ubuntu host machine. The prfm instruction was supposed to be generated for the particular line, but it was not.

__builtin_prefetch(&some_variable,0,3); 

The command to compile is:

arm-linux-gnueabi-g++-4.7 -O0 -S -std=c++11 main.cpp -D some_definition 
cat main.s | grep pr
//Returns null (main.s is all lower case)

Quoting one line from the gcc reference here related to the problem:

If the target does not support data prefetch, the address expression is evaluated if it includes side effects but no other code is generated and GCC does not issue a warning.

Last piece of information is that the cross compiler is installed by using apt-get install, not from scratch.

Here comes the question:

How can one simply add data prefetch support to the target of the arm-linux-gnueabi-g++-4.7 cross compiler?

Thanks in advance

1

There are 1 best solutions below

0
On BEST ANSWER

As @Notlikethat suggested, compiling with -march=armv7-a solved the issue. Now there is a pld instruction in the assembly output.

$ arm-linux-gnueabi-g++-4.7 -g -O3 -std=c++11 -static -S -march=armv7-a main.cpp -D some_definition
$ cat main.s | grep pld
pld [r0, #0]