Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// | 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// |
| 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 /// \file | 10 /// \file |
| (...skipping 2769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2780 TargetX86Base<Machine>::lowerIcmp64(const InstIcmp *Inst) { | 2780 TargetX86Base<Machine>::lowerIcmp64(const InstIcmp *Inst) { |
| 2781 // a=icmp cond, b, c ==> cmp b,c; a=1; br cond,L1; FakeUse(a); a=0; L1: | 2781 // a=icmp cond, b, c ==> cmp b,c; a=1; br cond,L1; FakeUse(a); a=0; L1: |
| 2782 Operand *Src0 = legalize(Inst->getSrc(0)); | 2782 Operand *Src0 = legalize(Inst->getSrc(0)); |
| 2783 Operand *Src1 = legalize(Inst->getSrc(1)); | 2783 Operand *Src1 = legalize(Inst->getSrc(1)); |
| 2784 Variable *Dest = Inst->getDest(); | 2784 Variable *Dest = Inst->getDest(); |
| 2785 InstIcmp::ICond Condition = Inst->getCondition(); | 2785 InstIcmp::ICond Condition = Inst->getCondition(); |
| 2786 size_t Index = static_cast<size_t>(Condition); | 2786 size_t Index = static_cast<size_t>(Condition); |
| 2787 assert(Index < Traits::TableIcmp64Size); | 2787 assert(Index < Traits::TableIcmp64Size); |
| 2788 Operand *Src0LoRM = legalize(loOperand(Src0), Legal_Reg | Legal_Mem); | 2788 Operand *Src0LoRM = legalize(loOperand(Src0), Legal_Reg | Legal_Mem); |
| 2789 Operand *Src0HiRM = legalize(hiOperand(Src0), Legal_Reg | Legal_Mem); | 2789 Operand *Src0HiRM = legalize(hiOperand(Src0), Legal_Reg | Legal_Mem); |
| 2790 Constant *Zero = Ctx->getConstantZero(IceType_i32); | |
| 2791 Constant *One = Ctx->getConstantInt32(1); | |
| 2792 Constant *SignMask = Ctx->getConstantInt32(0x80000000); | |
| 2793 if (auto *Const64 = llvm::dyn_cast<ConstantInteger64>(Src1)) { | |
| 2794 if (Const64->getValue() == 0) { | |
| 2795 Variable *Temp = nullptr; | |
| 2796 switch (Condition) { | |
| 2797 default: | |
| 2798 llvm_unreachable("unexpected condition"); | |
| 2799 break; | |
| 2800 case InstIcmp::Eq: | |
| 2801 _mov(Temp, Src0LoRM); | |
| 2802 _or(Temp, Src0HiRM); | |
| 2803 Context.insert(InstFakeUse::create(Func, Temp)); | |
| 2804 _setcc(Dest, Traits::Cond::Br_e); | |
| 2805 return; | |
| 2806 case InstIcmp::Ne: | |
| 2807 _mov(Temp, Src0LoRM); | |
| 2808 _or(Temp, Src0HiRM); | |
| 2809 Context.insert(InstFakeUse::create(Func, Temp)); | |
| 2810 _setcc(Dest, Traits::Cond::Br_ne); | |
| 2811 return; | |
| 2812 case InstIcmp::Ugt: | |
|
Jim Stichnoth
2015/10/14 18:04:49
I think you should combine Ugt with Ne, and Ule wi
sehr
2015/10/15 00:19:34
Good point. Done.
| |
| 2813 _mov(Temp, Src0LoRM); | |
| 2814 _or(Temp, Src0HiRM); | |
| 2815 Context.insert(InstFakeUse::create(Func, Temp)); | |
| 2816 _setcc(Dest, Traits::Cond::Br_ne); | |
| 2817 return; | |
| 2818 case InstIcmp::Uge: | |
| 2819 _mov(Dest, One); | |
| 2820 return; | |
| 2821 case InstIcmp::Ult: | |
| 2822 _mov(Dest, Zero); | |
| 2823 return; | |
| 2824 case InstIcmp::Ule: | |
| 2825 _mov(Temp, Src0LoRM); | |
| 2826 _or(Temp, Src0HiRM); | |
| 2827 Context.insert(InstFakeUse::create(Func, Temp)); | |
| 2828 _setcc(Dest, Traits::Cond::Br_e); | |
| 2829 return; | |
| 2830 case InstIcmp::Sgt: | |
| 2831 break; | |
| 2832 case InstIcmp::Sge: | |
| 2833 _test(Src0HiRM, SignMask); | |
| 2834 _setcc(Dest, Traits::Cond::Br_e); | |
| 2835 return; | |
| 2836 case InstIcmp::Slt: | |
| 2837 _test(Src0HiRM, SignMask); | |
| 2838 _setcc(Dest, Traits::Cond::Br_ne); | |
| 2839 return; | |
| 2840 case InstIcmp::Sle: | |
| 2841 break; | |
| 2842 } | |
| 2843 } | |
| 2844 } | |
| 2790 Operand *Src1LoRI = legalize(loOperand(Src1), Legal_Reg | Legal_Imm); | 2845 Operand *Src1LoRI = legalize(loOperand(Src1), Legal_Reg | Legal_Imm); |
| 2791 Operand *Src1HiRI = legalize(hiOperand(Src1), Legal_Reg | Legal_Imm); | 2846 Operand *Src1HiRI = legalize(hiOperand(Src1), Legal_Reg | Legal_Imm); |
| 2792 Constant *Zero = Ctx->getConstantZero(IceType_i32); | |
| 2793 Constant *One = Ctx->getConstantInt32(1); | |
| 2794 typename Traits::Insts::Label *LabelFalse = | 2847 typename Traits::Insts::Label *LabelFalse = |
| 2795 Traits::Insts::Label::create(Func, this); | 2848 Traits::Insts::Label::create(Func, this); |
| 2796 typename Traits::Insts::Label *LabelTrue = | 2849 typename Traits::Insts::Label *LabelTrue = |
| 2797 Traits::Insts::Label::create(Func, this); | 2850 Traits::Insts::Label::create(Func, this); |
| 2798 _mov(Dest, One); | 2851 _mov(Dest, One); |
| 2799 _cmp(Src0HiRM, Src1HiRI); | 2852 _cmp(Src0HiRM, Src1HiRI); |
| 2800 if (Traits::TableIcmp64[Index].C1 != Traits::Cond::Br_None) | 2853 if (Traits::TableIcmp64[Index].C1 != Traits::Cond::Br_None) |
| 2801 _br(Traits::TableIcmp64[Index].C1, LabelTrue); | 2854 _br(Traits::TableIcmp64[Index].C1, LabelTrue); |
| 2802 if (Traits::TableIcmp64[Index].C2 != Traits::Cond::Br_None) | 2855 if (Traits::TableIcmp64[Index].C2 != Traits::Cond::Br_None) |
| 2803 _br(Traits::TableIcmp64[Index].C2, LabelFalse); | 2856 _br(Traits::TableIcmp64[Index].C2, LabelFalse); |
| (...skipping 2705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5509 } | 5562 } |
| 5510 // the offset is not eligible for blinding or pooling, return the original | 5563 // the offset is not eligible for blinding or pooling, return the original |
| 5511 // mem operand | 5564 // mem operand |
| 5512 return MemOperand; | 5565 return MemOperand; |
| 5513 } | 5566 } |
| 5514 | 5567 |
| 5515 } // end of namespace X86Internal | 5568 } // end of namespace X86Internal |
| 5516 } // end of namespace Ice | 5569 } // end of namespace Ice |
| 5517 | 5570 |
| 5518 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 5571 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |