Subzero: Use a setcc sequence for better icmp lowering.
For an example like:
%a = icmp eq i32 %b, %c
The original icmp lowering sequence for i8/i16/i32 was something like:
cmpl b, c
movb 1, a
je label
movb 0, a
label:
The improved sequence is:
cmpl b, c
sete a
In O2 mode, this doesn't help when successive compare/branch instructions are fused, but it does help when the boolean result needs to be saved and later used.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/1118353005
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 582e441..399d058 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -2748,12 +2748,8 @@
// cmp b, c
Operand *Src0RM =
legalize(Src0, IsSrc1ImmOrReg ? (Legal_Reg | Legal_Mem) : Legal_Reg);
- InstX8632Label *Label = InstX8632Label::create(Func, this);
_cmp(Src0RM, Src1);
- _mov(Dest, One);
- _br(getIcmp32Mapping(Inst->getCondition()), Label);
- _mov_nonkillable(Dest, Zero);
- Context.insert(Label);
+ _setcc(Dest, getIcmp32Mapping(Inst->getCondition()));
}
void TargetX8632::lowerInsertElement(const InstInsertElement *Inst) {