immortalvm / ivm-implementations

iVM contemporary implementations
5 stars 0 forks source link

Problems with ivm v0.35 #35

Closed elnv closed 3 years ago

elnv commented 3 years ago

During the testing of the last version of the compiler (1.1.rc1) we came accross some problems when assembling with ivm version 0.35. We are now testing some more complex benchmarks and in one of them, the results differs with ivm0.35.

Here is the benchmark smg2000.zip that can be compiled with ivm64-gcc -O2 -D_POSIX_SOURCE -DHYPRE_TIMING -DHYPRE_SEQUENTIAL -I. *.c -lm

The point is that when assembled with ivm0.32, we get the right results (can be compared with standar gcc output):

But, when using ivm0.35, the results differ (and apparently they are incorrect):

We have examining the resulting assembly, and the problem seems related with the transformations carried out by ivm0.35 after certain redundant push/pop are removed by one of the compiler optimizations.

Here you can find these two assembly codes, enabling and disabling this compiler optimization. The not optimized one works OK for ivm0.32 and ivm0.35, but ivm0.35 fails with the optimized version (which is also OK with ivm0.32):

asm.zip

Comparing the two assembly files, we observe many patterns like the next one, in which redundant push/pop have been removed near sigx instructions; this fact may be related with the failure of ivm0.35:

ivar-rummelhoff commented 3 years ago

Fixed in bc2593c.