| 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 6043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6054 SearchSpanStack.emplace(Span.Begin, Span.Size / 2, Label); | 6054 SearchSpanStack.emplace(Span.Begin, Span.Size / 2, Label); |
| 6055 SearchSpanStack.emplace(PivotIndex, Span.Size - (Span.Size / 2), nullptr); | 6055 SearchSpanStack.emplace(PivotIndex, Span.Size - (Span.Size / 2), nullptr); |
| 6056 DoneCmp = true; | 6056 DoneCmp = true; |
| 6057 break; | 6057 break; |
| 6058 } | 6058 } |
| 6059 } | 6059 } |
| 6060 | 6060 |
| 6061 _br(DefaultTarget); | 6061 _br(DefaultTarget); |
| 6062 } | 6062 } |
| 6063 | 6063 |
| 6064 template <typename TraitsType> | |
| 6065 void TargetX86Base<TraitsType>::scalarizeArithmetic(InstArithmetic::OpKind Kind, | |
| 6066 Variable *Dest, | |
| 6067 Operand *Src0, | |
| 6068 Operand *Src1) { | |
| 6069 assert(isVectorType(Dest->getType())); | |
| 6070 Type Ty = Dest->getType(); | |
| 6071 Type ElementTy = typeElementType(Ty); | |
| 6072 SizeT NumElements = typeNumElements(Ty); | |
| 6073 | |
| 6074 Operand *T = Ctx->getConstantUndef(Ty); | |
| 6075 for (SizeT I = 0; I < NumElements; ++I) { | |
| 6076 Constant *Index = Ctx->getConstantInt32(I); | |
| 6077 | |
| 6078 // Extract the next two inputs. | |
| 6079 Variable *Op0 = Func->makeVariable(ElementTy); | |
| 6080 Context.insert<InstExtractElement>(Op0, Src0, Index); | |
| 6081 Variable *Op1 = Func->makeVariable(ElementTy); | |
| 6082 Context.insert<InstExtractElement>(Op1, Src1, Index); | |
| 6083 | |
| 6084 // Perform the arithmetic as a scalar operation. | |
| 6085 Variable *Res = Func->makeVariable(ElementTy); | |
| 6086 auto *Arith = Context.insert<InstArithmetic>(Kind, Res, Op0, Op1); | |
| 6087 // We might have created an operation that needed a helper call. | |
| 6088 genTargetHelperCallFor(Arith); | |
| 6089 | |
| 6090 // Insert the result into position. | |
| 6091 Variable *DestT = Func->makeVariable(Ty); | |
| 6092 Context.insert<InstInsertElement>(DestT, T, Res, Index); | |
| 6093 T = DestT; | |
| 6094 } | |
| 6095 | |
| 6096 Context.insert<InstAssign>(Dest, T); | |
| 6097 } | |
| 6098 | |
| 6099 /// The following pattern occurs often in lowered C and C++ code: | 6064 /// The following pattern occurs often in lowered C and C++ code: |
| 6100 /// | 6065 /// |
| 6101 /// %cmp = fcmp/icmp pred <n x ty> %src0, %src1 | 6066 /// %cmp = fcmp/icmp pred <n x ty> %src0, %src1 |
| 6102 /// %cmp.ext = sext <n x i1> %cmp to <n x ty> | 6067 /// %cmp.ext = sext <n x i1> %cmp to <n x ty> |
| 6103 /// | 6068 /// |
| 6104 /// We can eliminate the sext operation by copying the result of pcmpeqd, | 6069 /// We can eliminate the sext operation by copying the result of pcmpeqd, |
| 6105 /// pcmpgtd, or cmpps (which produce sign extended results) to the result of the | 6070 /// pcmpgtd, or cmpps (which produce sign extended results) to the result of the |
| 6106 /// sext operation. | 6071 /// sext operation. |
| 6107 template <typename TraitsType> | 6072 template <typename TraitsType> |
| 6108 void TargetX86Base<TraitsType>::eliminateNextVectorSextInstruction( | 6073 void TargetX86Base<TraitsType>::eliminateNextVectorSextInstruction( |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7453 emitGlobal(*Var, SectionSuffix); | 7418 emitGlobal(*Var, SectionSuffix); |
| 7454 } | 7419 } |
| 7455 } | 7420 } |
| 7456 } break; | 7421 } break; |
| 7457 } | 7422 } |
| 7458 } | 7423 } |
| 7459 } // end of namespace X86NAMESPACE | 7424 } // end of namespace X86NAMESPACE |
| 7460 } // end of namespace Ice | 7425 } // end of namespace Ice |
| 7461 | 7426 |
| 7462 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 7427 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |