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 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2695 | 2695 |
2696 // Lowering a = fcmp cond, b, c | 2696 // Lowering a = fcmp cond, b, c |
2697 // ucomiss b, c /* only if C1 != Br_None */ | 2697 // ucomiss b, c /* only if C1 != Br_None */ |
2698 // /* but swap b,c order if SwapOperands==true */ | 2698 // /* but swap b,c order if SwapOperands==true */ |
2699 // mov a, <default> | 2699 // mov a, <default> |
2700 // j<C1> label /* only if C1 != Br_None */ | 2700 // j<C1> label /* only if C1 != Br_None */ |
2701 // j<C2> label /* only if C2 != Br_None */ | 2701 // j<C2> label /* only if C2 != Br_None */ |
2702 // FakeUse(a) /* only if C1 != Br_None */ | 2702 // FakeUse(a) /* only if C1 != Br_None */ |
2703 // mov a, !<default> /* only if C1 != Br_None */ | 2703 // mov a, !<default> /* only if C1 != Br_None */ |
2704 // label: /* only if C1 != Br_None */ | 2704 // label: /* only if C1 != Br_None */ |
| 2705 // |
| 2706 // setcc lowering when C1 != Br_None && C2 == Br_None: |
| 2707 // ucomiss b, c /* but swap b,c order if SwapOperands==true */ |
| 2708 // setcc a, C1 |
2705 InstFcmp::FCond Condition = Inst->getCondition(); | 2709 InstFcmp::FCond Condition = Inst->getCondition(); |
2706 size_t Index = static_cast<size_t>(Condition); | 2710 size_t Index = static_cast<size_t>(Condition); |
2707 assert(Index < TableFcmpSize); | 2711 assert(Index < TableFcmpSize); |
2708 if (TableFcmp[Index].SwapScalarOperands) { | 2712 if (TableFcmp[Index].SwapScalarOperands) |
2709 Operand *Tmp = Src0; | 2713 std::swap(Src0, Src1); |
2710 Src0 = Src1; | |
2711 Src1 = Tmp; | |
2712 } | |
2713 bool HasC1 = (TableFcmp[Index].C1 != CondX86::Br_None); | 2714 bool HasC1 = (TableFcmp[Index].C1 != CondX86::Br_None); |
2714 bool HasC2 = (TableFcmp[Index].C2 != CondX86::Br_None); | 2715 bool HasC2 = (TableFcmp[Index].C2 != CondX86::Br_None); |
2715 if (HasC1) { | 2716 if (HasC1) { |
2716 Src0 = legalize(Src0); | 2717 Src0 = legalize(Src0); |
2717 Operand *Src1RM = legalize(Src1, Legal_Reg | Legal_Mem); | 2718 Operand *Src1RM = legalize(Src1, Legal_Reg | Legal_Mem); |
2718 Variable *T = nullptr; | 2719 Variable *T = nullptr; |
2719 _mov(T, Src0); | 2720 _mov(T, Src0); |
2720 _ucomiss(T, Src1RM); | 2721 _ucomiss(T, Src1RM); |
| 2722 if (!HasC2) { |
| 2723 assert(TableFcmp[Index].Default); |
| 2724 _setcc(Dest, TableFcmp[Index].C1); |
| 2725 return; |
| 2726 } |
2721 } | 2727 } |
2722 Constant *Default = Ctx->getConstantInt32(TableFcmp[Index].Default); | 2728 Constant *Default = Ctx->getConstantInt32(TableFcmp[Index].Default); |
2723 _mov(Dest, Default); | 2729 _mov(Dest, Default); |
2724 if (HasC1) { | 2730 if (HasC1) { |
2725 InstX8632Label *Label = InstX8632Label::create(Func, this); | 2731 InstX8632Label *Label = InstX8632Label::create(Func, this); |
2726 _br(TableFcmp[Index].C1, Label); | 2732 _br(TableFcmp[Index].C1, Label); |
2727 if (HasC2) { | 2733 if (HasC2) { |
2728 _br(TableFcmp[Index].C2, Label); | 2734 _br(TableFcmp[Index].C2, Label); |
2729 } | 2735 } |
2730 Constant *NonDefault = Ctx->getConstantInt32(!TableFcmp[Index].Default); | 2736 Constant *NonDefault = Ctx->getConstantInt32(!TableFcmp[Index].Default); |
(...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5035 case FT_Asm: | 5041 case FT_Asm: |
5036 case FT_Iasm: { | 5042 case FT_Iasm: { |
5037 OstreamLocker L(Ctx); | 5043 OstreamLocker L(Ctx); |
5038 emitConstantPool<PoolTypeConverter<float>>(Ctx); | 5044 emitConstantPool<PoolTypeConverter<float>>(Ctx); |
5039 emitConstantPool<PoolTypeConverter<double>>(Ctx); | 5045 emitConstantPool<PoolTypeConverter<double>>(Ctx); |
5040 } break; | 5046 } break; |
5041 } | 5047 } |
5042 } | 5048 } |
5043 | 5049 |
5044 } // end of namespace Ice | 5050 } // end of namespace Ice |
OLD | NEW |