Disabling predication in gcc/g++

后端 未结 3 1514
难免孤独
难免孤独 2021-01-18 07:21

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.

3条回答
  •  时光取名叫无心
    2021-01-18 07:36

    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).

提交回复
热议问题