@@ -4383,6 +4383,9 @@ void EmitPass::BinaryUnary(llvm::Instruction* inst, const SSource source[2], con
43834383    case Instruction::FMul:
43844384        Mul(source, modifier);
43854385        break;
4386+     case Instruction::FAdd:
4387+         Add(source, modifier);
4388+         break;
43864389    case Instruction::Call:
43874390        EmitAluIntrinsic(cast<CallInst>(inst), source, modifier);
43884391        break;
@@ -4637,6 +4640,44 @@ void EmitPass::FPTrunc(const SSource sources[2], const DstModifier& modifier) {
46374640    }
46384641}
46394642
4643+ 
4644+ void EmitPass::Add(const SSource sources[2], const DstModifier& modifier)
4645+ {
4646+     CVariable* src[2];
4647+     for (int i = 0; i < 2; ++i)
4648+     {
4649+         src[i] = GetSrcVariable(sources[i]);
4650+     }
4651+ 
4652+     if (IGC_IS_FLAG_ENABLED(EnableVectorEmitter) && sources[0].value->getType()->isVectorTy() && sources[1].value->getType()->isVectorTy()) {
4653+ 
4654+         unsigned int VectorSize = 0;
4655+         if (llvm::isa<Instruction>(sources[0].value))
4656+             VectorSize = getVectorSize(llvm::cast<Instruction>(sources[0].value));
4657+ 
4658+         for (unsigned int i = 0; i < VectorSize; ++i) {
4659+             SetSourceModifiers(0, sources[0]);
4660+             SetSourceModifiers(1, sources[1]);
4661+ 
4662+             if (src[0]->IsUniform())
4663+                 m_encoder->SetSrcSubReg(0, i);
4664+             else
4665+                 m_encoder->SetSrcSubVar(0, i);
4666+             if (src[1]->IsUniform())
4667+                 m_encoder->SetSrcSubReg(1, i);
4668+             else
4669+                 m_encoder->SetSrcSubVar(1, i);
4670+ 
4671+             m_encoder->SetDstSubVar(i);
4672+             m_encoder->Add(m_destination, src[0], src[1]);
4673+             m_encoder->Push();
4674+         }
4675+         return;
4676+     }
4677+ 
4678+     Binary(EOPCODE_ADD, sources, modifier);
4679+ }
4680+ 
46404681void EmitPass::Mul(const SSource sources[2], const DstModifier& modifier)
46414682{
46424683    CVariable* src[2];
0 commit comments