|
1 | 1 | /*========================== begin_copyright_notice ============================ |
2 | 2 |
|
3 | | -Copyright (C) 2017-2023 Intel Corporation |
| 3 | +Copyright (C) 2017-2024 Intel Corporation |
4 | 4 |
|
5 | 5 | SPDX-License-Identifier: MIT |
6 | 6 |
|
@@ -400,9 +400,9 @@ void ScalarizeFunction::dispatchInstructionToScalarize(Instruction* I) |
400 | 400 | case Instruction::ShuffleVector: |
401 | 401 | scalarizeInstruction(dyn_cast<ShuffleVectorInst>(I)); |
402 | 402 | break; |
403 | | - //case Instruction::Call : |
404 | | - // scalarizeInstruction(dyn_cast<CallInst>(I)); |
405 | | - // break; |
| 403 | + case Instruction::Call : |
| 404 | + scalarizeInstruction(dyn_cast<CallInst>(I)); |
| 405 | + break; |
406 | 406 | case Instruction::Alloca: |
407 | 407 | scalarizeInstruction(dyn_cast<AllocaInst>(I)); |
408 | 408 | break; |
@@ -1024,7 +1024,52 @@ void ScalarizeFunction::scalarizeInstruction(CallInst* CI) |
1024 | 1024 | V_PRINT(scalarizer, "\t\tCall instruction\n"); |
1025 | 1025 | IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed"); |
1026 | 1026 |
|
1027 | | - recoverNonScalarizableInst(CI); |
| 1027 | + Function* CalledFunc = CI->getCalledFunction(); |
| 1028 | + if (CalledFunc && CalledFunc->getName().startswith("llvm.fshl")) |
| 1029 | + { |
| 1030 | + V_PRINT(scalarizer, "\t\tScalarizing fshl intrinsic\n"); |
| 1031 | + |
| 1032 | + IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getType()); |
| 1033 | + if (!instType) { |
| 1034 | + recoverNonScalarizableInst(CI); |
| 1035 | + return; |
| 1036 | + } |
| 1037 | + |
| 1038 | + SCMEntry* newEntry = getSCMEntry(CI); |
| 1039 | + |
| 1040 | + unsigned numElements = int_cast<unsigned>(instType->getNumElements()); |
| 1041 | + |
| 1042 | + SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH> operand0; |
| 1043 | + SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH> operand1; |
| 1044 | + SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH> operand2; |
| 1045 | + bool op0IsConst, op1IsConst, op2IsConst; |
| 1046 | + |
| 1047 | + obtainScalarizedValues(operand0, &op0IsConst, CI->getOperand(0), CI); |
| 1048 | + obtainScalarizedValues(operand1, &op1IsConst, CI->getOperand(1), CI); |
| 1049 | + obtainScalarizedValues(operand2, &op2IsConst, CI->getOperand(2), CI); |
| 1050 | + |
| 1051 | + SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH> newScalarizedInsts; |
| 1052 | + newScalarizedInsts.resize(numElements); |
| 1053 | + for (unsigned i = 0; i < numElements; i++) |
| 1054 | + { |
| 1055 | + Type* scalarType = operand0[i]->getType(); |
| 1056 | + Value* scalarFshl = CallInst::Create( |
| 1057 | + Intrinsic::getDeclaration(CI->getModule(), Intrinsic::fshl, { scalarType }), |
| 1058 | + { operand0[i], operand1[i], operand2[i] }, |
| 1059 | + CI->getName() + ".scalar", |
| 1060 | + CI |
| 1061 | + ); |
| 1062 | + newScalarizedInsts[i] = scalarFshl; |
| 1063 | + } |
| 1064 | + |
| 1065 | + updateSCMEntryWithValues(newEntry, &(newScalarizedInsts[0]), CI, true); |
| 1066 | + |
| 1067 | + m_removedInsts.insert(CI); |
| 1068 | + } |
| 1069 | + else |
| 1070 | + { |
| 1071 | + recoverNonScalarizableInst(CI); |
| 1072 | + } |
1028 | 1073 | } |
1029 | 1074 |
|
1030 | 1075 | void ScalarizeFunction::scalarizeInstruction(AllocaInst* AI) |
|
0 commit comments