[llvm-commits] [llvm] r42661 - in /llvm/trunk/lib/Target/X86: X86InstrInfo.cpp X86InstrInfo.td X86InstrX86-64.td

Chris Lattner clattner at apple.com
Fri Oct 5 16:45:17 PDT 2007

> URL: http://llvm.org/viewvc/llvm-project?rev=42661&view=rev
> Log:
> Commute x86 cmove instructions by swapping the operands and change  
> the condition
> to its inverse.
> Testing this as llcbeta

Random crazy idea:

> +def CMOVB16rm : I<0x42, MRMSrcMem,       // if <u, GR16 = [mem16]
> +                  (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
> +                  "cmovb\t{$src2, $dst|$dst, $src2}",
> +                  [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16  
> addr:$src2),
> +                                   X86_COND_B, EFLAGS))]>,
> +                  TB, OpSize;

Instead of having one instruction for each comparison code, would it  
make sense to have one "CMOV16rm" that took the condcode as an  
immediate argument?  If you had that, you could change the comparison  
just by twiddling the immediate operand and wouldn't have a bazillion  
CMOV instructions.


More information about the llvm-commits mailing list