@@ -711,7 +711,24 @@ internal class AssignmentGen(private val codeGen: IRCodeGen, private val express
711711
712712 private fun operatorMultiplyInplace (symbol : String? , array : PtArrayIndexer ? , constAddress : Int? , memory : PtMemoryByte ? , vmDt : IRDataType , operand : PtExpression ): IRCodeChunks ? {
713713 if (array!= null ) {
714- TODO (" * in array" )
714+ val eltSize = codeGen.program.memsizer.memorySize(array.type)
715+ val result = mutableListOf<IRCodeChunkBase >()
716+ if (array.splitWords)
717+ return operatorMultiplyInplaceSplitArray(array, operand)
718+ val eltDt = irType(array.type)
719+ val constIndex = array.index.asConstInteger()
720+ val constValue = operand.asConstInteger()
721+ if (constIndex!= null && constValue!= null ) {
722+ if (constValue!= 1 ) {
723+ val valueReg= codeGen.registers.nextFree()
724+ result + = IRCodeChunk (null , null ).also {
725+ it + = IRInstruction (Opcode .LOAD , eltDt, reg1= valueReg, immediate = constValue)
726+ it + = IRInstruction (Opcode .MULM , eltDt, reg1= valueReg, labelSymbol = array.variable.name, symbolOffset = constIndex* eltSize)
727+ }
728+ }
729+ return result
730+ }
731+ return null // TODO("inplace array * non-const")
715732 }
716733 if (constAddress== null && memory!= null )
717734 return null // TODO("optimized memory in-place *"")
@@ -813,6 +830,10 @@ internal class AssignmentGen(private val codeGen: IRCodeGen, private val express
813830 return result
814831 }
815832
833+ private fun operatorMultiplyInplaceSplitArray (array : PtArrayIndexer , operand : PtExpression ): IRCodeChunks ? {
834+ return null // TODO("inplace split word array *")
835+ }
836+
816837 private fun operatorMinusInplaceSplitArray (array : PtArrayIndexer , operand : PtExpression ): IRCodeChunks ? {
817838 val result = mutableListOf<IRCodeChunkBase >()
818839 val constIndex = array.index.asConstInteger()
0 commit comments