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 3041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3052 default: | 3052 default: |
3053 llvm_unreachable("Unexpected Bitcast dest type"); | 3053 llvm_unreachable("Unexpected Bitcast dest type"); |
3054 case IceType_i8: { | 3054 case IceType_i8: { |
3055 llvm::report_fatal_error("Helper call was expected"); | 3055 llvm::report_fatal_error("Helper call was expected"); |
3056 } break; | 3056 } break; |
3057 case IceType_i16: { | 3057 case IceType_i16: { |
3058 llvm::report_fatal_error("Helper call was expected"); | 3058 llvm::report_fatal_error("Helper call was expected"); |
3059 } break; | 3059 } break; |
3060 case IceType_i32: | 3060 case IceType_i32: |
3061 case IceType_f32: { | 3061 case IceType_f32: { |
3062 Operand *Src0RM = legalize(Src0, Legal_Reg | Legal_Mem); | 3062 Variable *Src0R = legalizeToReg(Src0); |
3063 Type SrcType = Src0RM->getType(); | 3063 Variable *T = makeReg(DestTy); |
3064 assert((DestTy == IceType_i32 && SrcType == IceType_f32) || | 3064 _movd(T, Src0R); |
3065 (DestTy == IceType_f32 && SrcType == IceType_i32)); | 3065 _mov(Dest, T); |
3066 // a.i32 = bitcast b.f32 ==> | |
3067 // t.f32 = b.f32 | |
3068 // s.f32 = spill t.f32 | |
3069 // a.i32 = s.f32 | |
3070 Variable *T = nullptr; | |
3071 // TODO: Should be able to force a spill setup by calling legalize() with | |
3072 // Legal_Mem and not Legal_Reg or Legal_Imm. | |
3073 SpillVariable *SpillVar = Func->makeVariable<SpillVariable>(SrcType); | |
3074 SpillVar->setLinkedTo(Dest); | |
3075 Variable *Spill = SpillVar; | |
3076 Spill->setMustNotHaveReg(); | |
3077 _mov(T, Src0RM); | |
3078 _mov(Spill, T); | |
3079 _mov(Dest, Spill); | |
3080 } break; | 3066 } break; |
3081 case IceType_i64: { | 3067 case IceType_i64: { |
3082 assert(Src0->getType() == IceType_f64); | 3068 assert(Src0->getType() == IceType_f64); |
3083 if (Traits::Is64Bit) { | 3069 if (Traits::Is64Bit) { |
3084 Variable *Src0R = legalizeToReg(Src0); | 3070 Variable *Src0R = legalizeToReg(Src0); |
3085 Variable *T = makeReg(IceType_i64); | 3071 Variable *T = makeReg(IceType_i64); |
3086 _movd(T, Src0R); | 3072 _movd(T, Src0R); |
3087 _mov(Dest, T); | 3073 _mov(Dest, T); |
3088 } else { | 3074 } else { |
3089 Operand *Src0RM = legalize(Src0, Legal_Reg | Legal_Mem); | 3075 Operand *Src0RM = legalize(Src0, Legal_Reg | Legal_Mem); |
(...skipping 4890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7980 emitGlobal(*Var, SectionSuffix); | 7966 emitGlobal(*Var, SectionSuffix); |
7981 } | 7967 } |
7982 } | 7968 } |
7983 } break; | 7969 } break; |
7984 } | 7970 } |
7985 } | 7971 } |
7986 } // end of namespace X86NAMESPACE | 7972 } // end of namespace X86NAMESPACE |
7987 } // end of namespace Ice | 7973 } // end of namespace Ice |
7988 | 7974 |
7989 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 7975 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
OLD | NEW |