Emit conditonal move: cmov vs movMMcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

So i was playing around with adding an intel-like cmov insn to a gcc
7.5 based backend. syntax is
cmov %a,%b,%c,%d

semantics is
a = (%b ? %c : %d)

Now I am aware of two predefined rtl insns for this purpose (from optabs.def):

mov$acc
cmov$a6

my question is, what are the differences, and in what context is one
selected over the other?

Now cmov sounds more intuitively what I want (conditional move), but
my initial RTL .md template implementation didn't get caught. So i
build x86_64 and looked how _it_ emitted cmov. This led me to look at
ifcvt.c, and discovered it makes its decision to convert a conditional
to a move by looking if the target has a movMMcc insn.

ifcvt.c:3577 tries cmov'ing if we HAVE_conditional_move (we do), and then
ifcvt.c:1775 here we call noce_emit_cmove if the args are right, then
ifcvt.c:1700 we actually call emit_conditional_move, then
optabs.c:4275 this line reads "icode = direct_optab_handler (movcc_optab, mode)"

which was surprising. I couldn't find much uses of cmov_optab either.

Maxim



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux