开发者

Disabling predication in gcc/g++

I was wondering if there's a way to disable predication in gcc/g++. When I get the object dump of my code, I don't want there to be any CMOV, CCMP, etc instructions in it.

I have gone through the gcc man page without any success. So far the only 开发者_Python百科way ahead seems to be hacking into gcc itself. Using gcc 4.3 on RHEL x86_64 machine. Any ideas?

Thanks in advance.


I ran into that problem before and in my case the solution was to disable if-conversion. You can use the compilation flags:

-fno-if-conversion -fno-if-conversion2 


You could try targetting a previous x86 instruction set that didn't have these instructions?

http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/Target-Options.html

gcc -b i386 main.c

(I've not tried this)


Try the following arguments on the gcc command line:

-fno-if-conversion -fno-if-conversion2 -fno-tree-loop-if-convert

This worked for me and the trick was the last argument, which is needed for some cases where ifs are converted to conditional moves inside loops, and these cases aren't covered by the other two arguments.

I discovered this based on this conversation from the gcc mailing lists:

--- Comment #1 from Andrew Pinski --- I don't think -fno-if-conversion and -fno-if-conversion2 are designed to turn off all predicated instructions.

Note -O3 turns on -ftree-loop-if-convert which also causes production of predicated instructions (predicated moves).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜