Hi,

SMS transformation would change kernel loop iteration count
as new_loop_count = ori_loop_count - stage_count.

With doloop optimization, loop_count will hold in count_reg
in loop entry.

The loop count adjustment instruction could generate as

    count_reg = count_reg - stage_count

before entry the loop

or modify the loop count initial instruction
if loop count could know while compile time

    count_reg = new_loop_count_constant

To remove the dependency on doloop pass, we need to generate
loop adjustment instruction without doloop pass.

Without doloop pass, there might have count_reg reference
instruction in the loop. Therefore, we couldn't modify
loop count initial value to adjust loop count.

If there is count_reg reference in the loop, we modify loop
end condition to adjust loop count.

Function loop_iteration_adjust_by_replace in the patch try to
replace constant end condition in comparison instruction.

Function gen_loop_iteration_adjust in the patch will generate
loop end condition adjustment instruction if loop end condition
hold in a register.

If there is no count_reg reference in the loop, we will modify
loop count initial value as before.

Thanks, 
Shiva

Attachment: 0004-update-kernel-loop-iteration-adjustment-instruction-.patch
Description: 0004-update-kernel-loop-iteration-adjustment-instruction-.patch

Reply via email to