| Index: src/IceTargetLowering.cpp
|
| diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
|
| index 75886d6dd8997693d240c6e878ec52f416402358..267f08b6b2ca2312a8dc2412fc7de96c3a4449c9 100644
|
| --- a/src/IceTargetLowering.cpp
|
| +++ b/src/IceTargetLowering.cpp
|
| @@ -703,34 +703,12 @@ bool TargetLowering::shouldOptimizeMemIntrins() {
|
| void TargetLowering::scalarizeArithmetic(InstArithmetic::OpKind Kind,
|
| Variable *Dest, Operand *Src0,
|
| Operand *Src1) {
|
| - assert(isVectorType(Dest->getType()));
|
| - Type Ty = Dest->getType();
|
| - Type ElementTy = typeElementType(Ty);
|
| - SizeT NumElements = typeNumElements(Ty);
|
| -
|
| - Operand *T = Ctx->getConstantUndef(Ty);
|
| - for (SizeT I = 0; I < NumElements; ++I) {
|
| - Constant *Index = Ctx->getConstantInt32(I);
|
| -
|
| - // Extract the next two inputs.
|
| - Variable *Op0 = Func->makeVariable(ElementTy);
|
| - Context.insert<InstExtractElement>(Op0, Src0, Index);
|
| - Variable *Op1 = Func->makeVariable(ElementTy);
|
| - Context.insert<InstExtractElement>(Op1, Src1, Index);
|
| -
|
| - // Perform the arithmetic as a scalar operation.
|
| - Variable *Res = Func->makeVariable(ElementTy);
|
| - auto *Arith = Context.insert<InstArithmetic>(Kind, Res, Op0, Op1);
|
| - // We might have created an operation that needed a helper call.
|
| - genTargetHelperCallFor(Arith);
|
| -
|
| - // Insert the result into position.
|
| - Variable *DestT = Func->makeVariable(Ty);
|
| - Context.insert<InstInsertElement>(DestT, T, Res, Index);
|
| - T = DestT;
|
| - }
|
| -
|
| - Context.insert<InstAssign>(Dest, T);
|
| + scalarizeInstruction(Dest, Src0, Src1,
|
| + [this, Kind](Variable *Dest, Variable *Src0,
|
| + Variable *Src1) {
|
| + return Context.insert<InstArithmetic>(Kind, Dest, Src0,
|
| + Src1);
|
| + });
|
| }
|
|
|
| void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C,
|
|
|