mwvdlee ·
When generating ASM for loop() code, a "cmp eax,0" gets inserted before a "jnz", even though the previous "add eax,-1" would already set the zero register itself.
streamout out; loop(128) { out = 1; }
Get translated to:
streamout out; float F1=1;
push eax; mov eax,128; start0: push eax; //Assignment> sLeft=F1 movaps xmm0,F1; movaps out,xmm0; pop eax; add eax,-1; cmp eax,0; jnz start0; pop eax;
But you could just drop the "cmp eax,0;" from the generated code.
streamout out; float F1=1;
push eax; mov eax,128; start0: push eax; //Assignment> sLeft=F1 movaps xmm0,F1; movaps out,xmm0; pop eax; add eax,-1; jnz start0; pop eax;
Same applies to the hop() operation, that one also generatrs an "cmp eax,0" before "jnz"
I think this minor optimization could be included into SM itself as it's generic and always valid.