Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// | 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file implements the TargetLoweringX8632 class, which | 10 // This file implements the TargetLoweringX8632 class, which |
| (...skipping 2692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2703 _cmp(Src0RM, Src1); | 2703 _cmp(Src0RM, Src1); |
| 2704 _br(getIcmp32Mapping(Inst->getCondition()), NextBr->getTargetTrue(), | 2704 _br(getIcmp32Mapping(Inst->getCondition()), NextBr->getTargetTrue(), |
| 2705 NextBr->getTargetFalse()); | 2705 NextBr->getTargetFalse()); |
| 2706 // Skip over the following branch instruction. | 2706 // Skip over the following branch instruction. |
| 2707 Context.advanceNext(); | 2707 Context.advanceNext(); |
| 2708 return; | 2708 return; |
| 2709 } | 2709 } |
| 2710 } | 2710 } |
| 2711 | 2711 |
| 2712 // a=icmp cond, b, c ==> cmp b,c; a=1; br cond,L1; FakeUse(a); a=0; L1: | 2712 // a=icmp cond, b, c ==> cmp b,c; a=1; br cond,L1; FakeUse(a); a=0; L1: |
| 2713 Constant *Zero = Ctx->getConstantZero(IceType_i32); | |
| 2714 Constant *One = Ctx->getConstantInt32(1); | |
| 2715 if (Src0->getType() == IceType_i64) { | 2713 if (Src0->getType() == IceType_i64) { |
| 2716 InstIcmp::ICond Condition = Inst->getCondition(); | 2714 InstIcmp::ICond Condition = Inst->getCondition(); |
| 2717 size_t Index = static_cast<size_t>(Condition); | 2715 size_t Index = static_cast<size_t>(Condition); |
| 2718 assert(Index < TableIcmp64Size); | 2716 assert(Index < TableIcmp64Size); |
| 2719 Operand *Src0LoRM = legalize(loOperand(Src0), Legal_Reg | Legal_Mem); | 2717 Operand *Src0LoRM = legalize(loOperand(Src0), Legal_Reg | Legal_Mem); |
| 2720 Operand *Src0HiRM = legalize(hiOperand(Src0), Legal_Reg | Legal_Mem); | 2718 Operand *Src0HiRM = legalize(hiOperand(Src0), Legal_Reg | Legal_Mem); |
| 2721 Operand *Src1LoRI = legalize(loOperand(Src1), Legal_Reg | Legal_Imm); | 2719 Operand *Src1LoRI = legalize(loOperand(Src1), Legal_Reg | Legal_Imm); |
| 2722 Operand *Src1HiRI = legalize(hiOperand(Src1), Legal_Reg | Legal_Imm); | 2720 Operand *Src1HiRI = legalize(hiOperand(Src1), Legal_Reg | Legal_Imm); |
| 2723 if (Condition == InstIcmp::Eq || Condition == InstIcmp::Ne) { | 2721 Constant *Zero = Ctx->getConstantZero(IceType_i32); |
| 2724 InstX8632Label *Label = InstX8632Label::create(Func, this); | 2722 Constant *One = Ctx->getConstantInt32(1); |
|
Jim Stichnoth
2015/05/06 22:24:21
This block of code is entirely removed.
| |
| 2725 _mov(Dest, (Condition == InstIcmp::Eq ? Zero : One)); | 2723 InstX8632Label *LabelFalse = InstX8632Label::create(Func, this); |
| 2726 _cmp(Src0LoRM, Src1LoRI); | 2724 InstX8632Label *LabelTrue = InstX8632Label::create(Func, this); |
| 2727 _br(CondX86::Br_ne, Label); | 2725 _mov(Dest, One); |
| 2728 _cmp(Src0HiRM, Src1HiRI); | 2726 _cmp(Src0HiRM, Src1HiRI); |
| 2729 _br(CondX86::Br_ne, Label); | 2727 if (TableIcmp64[Index].C1 != CondX86::Br_None) |
| 2730 _mov_nonkillable(Dest, (Condition == InstIcmp::Eq ? One : Zero)); | |
| 2731 Context.insert(Label); | |
| 2732 } else { | |
| 2733 InstX8632Label *LabelFalse = InstX8632Label::create(Func, this); | |
| 2734 InstX8632Label *LabelTrue = InstX8632Label::create(Func, this); | |
| 2735 _mov(Dest, One); | |
| 2736 _cmp(Src0HiRM, Src1HiRI); | |
| 2737 _br(TableIcmp64[Index].C1, LabelTrue); | 2728 _br(TableIcmp64[Index].C1, LabelTrue); |
|
Jim Stichnoth
2015/05/06 22:24:21
These two branch instructions are now created only
| |
| 2729 if (TableIcmp64[Index].C2 != CondX86::Br_None) | |
| 2738 _br(TableIcmp64[Index].C2, LabelFalse); | 2730 _br(TableIcmp64[Index].C2, LabelFalse); |
| 2739 _cmp(Src0LoRM, Src1LoRI); | 2731 _cmp(Src0LoRM, Src1LoRI); |
| 2740 _br(TableIcmp64[Index].C3, LabelTrue); | 2732 _br(TableIcmp64[Index].C3, LabelTrue); |
| 2741 Context.insert(LabelFalse); | 2733 Context.insert(LabelFalse); |
| 2742 _mov_nonkillable(Dest, Zero); | 2734 _mov_nonkillable(Dest, Zero); |
| 2743 Context.insert(LabelTrue); | 2735 Context.insert(LabelTrue); |
| 2744 } | |
| 2745 return; | 2736 return; |
| 2746 } | 2737 } |
| 2747 | 2738 |
| 2748 // cmp b, c | 2739 // cmp b, c |
| 2749 Operand *Src0RM = | 2740 Operand *Src0RM = |
| 2750 legalize(Src0, IsSrc1ImmOrReg ? (Legal_Reg | Legal_Mem) : Legal_Reg); | 2741 legalize(Src0, IsSrc1ImmOrReg ? (Legal_Reg | Legal_Mem) : Legal_Reg); |
| 2751 _cmp(Src0RM, Src1); | 2742 _cmp(Src0RM, Src1); |
| 2752 _setcc(Dest, getIcmp32Mapping(Inst->getCondition())); | 2743 _setcc(Dest, getIcmp32Mapping(Inst->getCondition())); |
| 2753 } | 2744 } |
| 2754 | 2745 |
| (...skipping 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4883 case FT_Asm: | 4874 case FT_Asm: |
| 4884 case FT_Iasm: { | 4875 case FT_Iasm: { |
| 4885 OstreamLocker L(Ctx); | 4876 OstreamLocker L(Ctx); |
| 4886 emitConstantPool<PoolTypeConverter<float>>(Ctx); | 4877 emitConstantPool<PoolTypeConverter<float>>(Ctx); |
| 4887 emitConstantPool<PoolTypeConverter<double>>(Ctx); | 4878 emitConstantPool<PoolTypeConverter<double>>(Ctx); |
| 4888 } break; | 4879 } break; |
| 4889 } | 4880 } |
| 4890 } | 4881 } |
| 4891 | 4882 |
| 4892 } // end of namespace Ice | 4883 } // end of namespace Ice |
| OLD | NEW |