-
Bug
-
Resolution: Fixed
-
High
-
Code Generation Tools
-
CODEGEN-7802
-
-
-
default
-
-
Some MMOVD32 instructions may have a read of the data-copied memory location too soon after the data-copy write.
MMOVD32 MR0,mem32 does below operations:
MR0 = [mem32];
[mem32+2] = [mem32]; data copy to mem32+2 location
The bug occurs when the MMOVD32's data-copy-write is read by a later MOV instruction within the next 3 instructions (read too soon after write).
See spruh18d table 9-16 for pipeline read-before-write issue.
Below example initializes struct of floats followed by math operations using several data members.
C code
typedef struct testfloats
testflt;
pragma DATA_SECTION(cla_sTest,"Cla1ToCpuMsgRAM");
testflt cla_sTest;
CLA code
cla_sTest.two = 2.0f;
cla_sTest.three = 3.0f;
cla_sTest.four = 4.0f;
cla_sTest.five = 5.0f;
cla_sTest.six = 6.0f;
cla_sTest.four = cla_sTest.five;
cla_sTest.five = cla_sTest.six;
; <--- adding __mnop() here will avoid the issue
cla_sTest.float = cla_sTest.two * cla_sTest.five
+ cla_sTest.three * cla_sTest.four;
CLA assembly
MMOVD32 MR0,@_cla_sTest+2 ; MR0=cla_sTest+2
cla_sTest+4=cla_sTest+2
MMOVD32 MR0,@_cla_sTest ; MR0=cla_sTest
cla_sTest+2=cla_sTest
MMOV32 MR0,@_cla_sTest+6 ; <-- need 2 MNOP's here
MMOV32 MR1,@_cla_sTest+2 ; cla_sTest+2 read too soon
MMOV32 MR2,@_cla_sTest+4 ; cla_sTest+4 read is good here
MMOV32 MR1,@_cla_sTest+8 ;
MMPYF32 MR0,MR1,MR0 MMPYF32 MR1,MR2,MR1 MADDF32 MR0,MR1,MR0 MMOV32 @_cla_sTest+16,MR0 |
---|
The 2nd MMOVD32 data copy to cla_sTest+2 needs 3 instructions between the write and any following reads from same memory location.