diff options
| author | Daniel Glöckner <daniel-gl@gmx.net> | 2009-05-07 00:23:06 +0200 |
|---|---|---|
| committer | grischka <grischka> | 2009-05-11 18:54:14 +0200 |
| commit | 530b77e3659b0cea5763f55f0d5a65bfd96881f5 (patch) | |
| tree | 4483a8c6d04f85c0d9f3fcfec9de414e8301994c | |
| parent | ca4b4a52add51e44a47d7ed1f12e51dd3ee3cd69 (diff) | |
| download | tinycc-530b77e3659b0cea5763f55f0d5a65bfd96881f5.tar.gz tinycc-530b77e3659b0cea5763f55f0d5a65bfd96881f5.tar.bz2 | |
ARM: fix big immediate offset construction
The loop constructs to iterate over the non-overlapping, even
positions of two or three bytes in a word were broken.
This patch fixes the loops. It has been verified to generate the
72 combinations for two and the 80 combinations for three bytes.
| -rw-r--r-- | arm-gen.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -260,7 +260,7 @@ void stuff_const_harder(unsigned long op,unsigned long v) { for(i=1;i<16;i++) a[i]=(a[i-1]>>2)|(a[i-1]<<30); for(i=0;i<12;i++) - for(j=i+4;i<13+i;i++) + for(j=i<4?i+12:15;j>=i+4;j--) if((v&(a[i]|a[j]))==v) { o(stuff_const(op,v&a[i])); o(stuff_const(o2,v&a[j])); @@ -270,15 +270,15 @@ void stuff_const_harder(unsigned long op,unsigned long v) { n2=o2^0xC00000; nv=-v; for(i=0;i<12;i++) - for(j=i+4;i<13+i;i++) + for(j=i<4?i+12:15;j>=i+4;j--) if((nv&(a[i]|a[j]))==nv) { o(stuff_const(no,nv&a[i])); o(stuff_const(n2,nv&a[j])); return; } for(i=0;i<8;i++) - for(j=i+4;i<12;i++) - for(k=j+4;k<13+i;i++) + for(j=i+4;j<12;j++) + for(k=i<4?i+12:15;k>=j+4;k--) if((v&(a[i]|a[j]|a[k]))==v) { o(stuff_const(op,v&a[i])); o(stuff_const(o2,v&a[j])); @@ -288,8 +288,8 @@ void stuff_const_harder(unsigned long op,unsigned long v) { no=op^0xC00000; nv=-v; for(i=0;i<8;i++) - for(j=i+4;i<12;i++) - for(k=j+4;k<13+i;i++) + for(j=i+4;j<12;j++) + for(k=i<4?i+12:15;k>=j+4;k--) if((nv&(a[i]|a[j]|a[k]))==nv) { o(stuff_const(no,nv&a[i])); o(stuff_const(n2,nv&a[j])); |
