Discussion:
Mips :delay slot filler with store.
Umesh Kalappa
2018-10-25 14:11:43 UTC
Permalink
Hi All,

For the below C code

Test.u32pt = u32PtLen;
Test.u32pn = u32PtCnt;
Test.pstpk = pstPt;
Test.psteo = pstEgrInfo;
Test.e = 1;
Test.pstfi = pstFi ;

return foo(&Test, AclAction);

where "Test" is the struct type .

the generated code for mips (with -fno-delayed-branch) :

Test.u32pt = u32PtLen;
370: afb50084 sw s5,132(sp)
Test.u32pn = u32PtCnt;
374: afb60080 sw s6,128(sp)
Test.pstpk = pstPt;
Test.psteo = pstEgrInfo;
Test.e = 1;
Test.pstfi = pstFi ;

return foo(&Test, AclAction)
378: 0c000000 jal 0 <FSVC_Egr_L4ACLfoo>
37c: 00000000 nop

with -fdelayed-branch(gcc 4.8.1) the generated code is

Test.u32pt = u32PtLen;
370: afb50084 sw s5,132(sp)
Test.pstpk = pstPt;
Test.psteo = pstEgrInfo;
Test.e = 1;
Test.pstfi = pstFi ;

return foo(&Test, AclAction)
378: 0c000000 jal 0 <FSVC_Egr_L4ACLfoo>
Test.u32pn = u32PtCnt;
374: afb60080 sw s6,128(sp)

can filler place the "sw s6,128(sp)" in the delay slot ,is
that legal and if not why it so ?

Thank you
~Umesh
Andrew Pinski
2018-10-25 18:51:37 UTC
Permalink
Post by Umesh Kalappa
Hi All,
For the below C code
Test.u32pt = u32PtLen;
Test.u32pn = u32PtCnt;
Test.pstpk = pstPt;
Test.psteo = pstEgrInfo;
Test.e = 1;
Test.pstfi = pstFi ;
return foo(&Test, AclAction);
where "Test" is the struct type .
Test.u32pt = u32PtLen;
370: afb50084 sw s5,132(sp)
Test.u32pn = u32PtCnt;
374: afb60080 sw s6,128(sp)
Test.pstpk = pstPt;
Test.psteo = pstEgrInfo;
Test.e = 1;
Test.pstfi = pstFi ;
return foo(&Test, AclAction)
378: 0c000000 jal 0 <FSVC_Egr_L4ACLfoo>
37c: 00000000 nop
with -fdelayed-branch(gcc 4.8.1) the generated code is
Test.u32pt = u32PtLen;
370: afb50084 sw s5,132(sp)
Test.pstpk = pstPt;
Test.psteo = pstEgrInfo;
Test.e = 1;
Test.pstfi = pstFi ;
return foo(&Test, AclAction)
378: 0c000000 jal 0 <FSVC_Egr_L4ACLfoo>
Test.u32pn = u32PtCnt;
374: afb60080 sw s6,128(sp)
can filler place the "sw s6,128(sp)" in the delay slot ,is
that legal and if not why it so ?
Yes it is legal as stores to the stack don't "trap" in normal cases.

Thanks,
Andrew
Post by Umesh Kalappa
Thank you
~Umesh
Loading...