You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include <stdio.h>
-
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
void
gen_struct (void)
printf (" int line;\n");
printf (" int row;\n");
printf (" int col;\n");
- printf (" long long val;\n");
- printf (" long long check;\n");
+ printf (" unsigned64 val;\n");
+ printf (" unsigned64 check;\n");
printf ("} test_tuples;\n");
printf ("\n");
printf ("typedef struct _test_spec {\n");
else
bit <<= i;
if (bitsize == 32)
- bit = (unsigned) bit; /* truncate it! */
+ bit &= 0xffffffff; /* truncate it! */
/* write it out */
printf (" { __LINE__, ");
printf ("%d, %2d, ", -1, i);
printf ("%s (%2d), ", macro, i);
- printf ("UNSIGNED64 (0x%08lx%08lx), ",
- (long) (bit >> 32), (long) bit);
+ printf ("UNSIGNED64 (0x%016llx), ", bit);
printf ("},\n");
}
printf ("};\n");
mask |= bit;
}
if (bitsize == 32)
- mask = (unsigned long) mask;
+ mask &= 0xffffffff;
printf ("%d, %d, ", l, h);
printf ("%s%s (%2d, %2d), ", msb, macro, l, h);
- printf ("UNSIGNED64 (0x%08lx%08lx), ",
- (long) (mask >> 32), (long) mask);
+ printf ("UNSIGNED64 (0x%llx), ", mask);
}
else
printf ("-1, -1, ");
case 4:
fprintf (stderr, "Invalid <byte-order> argument\n");
break;
- default:
}
exit (1);
printf ("#define WITH_TARGET_WORD_BITSIZE %d\n", bitsize);
printf ("#define WITH_TARGET_WORD_MSB %d\n", msb);
- printf ("#define WITH_HOST_WORD_BITSIZE %d\n", sizeof (int) * 8);
+ printf ("#define WITH_HOST_WORD_BITSIZE %zu\n", sizeof (int) * 8);
printf ("#define WITH_TARGET_BYTE_ORDER %s\n", big_endian ? "BFD_ENDIAN_BIG" : "BFD_ENDIAN_LITTLE");
printf ("\n");
printf ("#define SIM_BITS_INLINE (ALL_H_INLINE)\n");
printf ("\n");
printf ("#define ASSERT(X) do { if (!(X)) abort(); } while (0)\n");
printf ("\n");
+ printf ("#define PACKAGE \"sim\"\n");
+ printf ("#include <stdlib.h>\n");
+ printf ("#include <string.h>\n");
printf ("#include \"sim-basics.h\"\n");
gen_struct ();
else
{
fprintf (stderr,
- "Unknown call passed to calc (%s, 0x%08lx%08lx, %d, %d)\n",
- call, (long)(val >> 32), (long)val, row, col);
+ "Unknown call passed to calc (%s, 0x%016llx, %d, %d)\n",
+ call, val, row, col);
abort ();
return val;
}
fprintf (stderr,
"%s:%d: ", __FILE__, __LINE__);
fprintf (stderr,
- " %s(0x%08lx%08lx,%d) == 0x%08lx%08lx wrong, != 0x%08lx%08lx\n",
- sexted, (long)(mask_0 >> 32), (long)mask_0, col,
- (long)(sext_0 >> 32), (long)sext_0,
- (long)(mask_1 >> 32), (long)mask_1);
+ " %s(0x%016llx,%d) == 0x%016llx wrong, != 0x%016llx\n",
+ sexted, mask_0, col, sext_0, mask_1);
errors ++;
}
if (sext_1 != mask_1)
fprintf (stderr,
"%s:%d: ", __FILE__, __LINE__);
fprintf (stderr,
- " %s(0x%08lx%08lx,%d) == 0x%08lx%08lx wrong, != 0x%08lx%08lx\n",
- sexted, (long)(mask_1 >> 32), (long)mask_1, col,
- (long)(sext_1 >> 32), (long)sext_1,
- (long)(mask_1 >> 32), (long)mask_1);
+ " %s(0x%016llx,%d) == 0x%016llx wrong, != 0x%016llx\n",
+ sexted, mask_1, col, sext_1, mask_1);
errors ++;
}
if (sext != msmask)
fprintf (stderr,
"%s:%d: ", __FILE__, __LINE__);
fprintf (stderr,
- " %s(0x%08lx%08lx,%d) == 0x%08lx%08lx wrong, != 0x%08lx%08lx (%s(%d,%d))\n",
- sexted, (long)(mask >> 32), (long)mask, col,
- (long)(sext >> 32), (long)sext,
- (long)(msmask >> 32), (long)msmask,
+ " %s(0x%016llx,%d) == 0x%016llx wrong, != 0x%016llx (%s(%d,%d))\n",
+ sexted, mask, col, sext, msmask,
msmasked, 0, (msb_nr ? nr_bits - col - 1 : col));
errors ++;
}
|| (shift != 0 && rot == mask && abs(row - col) != (nr_bits - 1)))
{
fprintf (stderr, "%s:%d: ", __FILE__, __LINE__);
- fprintf (stderr, " %s(%s(0x%08lx%08lx,%d) == 0x%08lx%08lx, %d) failed\n",
- roted, roted,
- (long)(mask >> 32), (long)mask, shift,
- (long)(urot >> 32), (long)urot, -shift);
+ fprintf (stderr, " %s(%s(0x%016llx,%d) == 0x%016llx, %d) failed\n",
+ roted, roted, mask, shift, urot, -shift);
errors ++;
}
}
if (mask != inst)
{
fprintf (stderr, "%s:%d: ", __FILE__, __LINE__);
- fprintf (stderr, " %s(%d,%d)=0x%08lx%08lx -> %s=0x%08lx%08lx -> %s=0x%08lx%08lx failed\n",
- masked, row, col, (long)(mask >> 32), (long)mask,
- extracted, (long)(extr >> 32), (long)extr,
- inserted, (long)(inst >> 32), (long)inst);
+ fprintf (stderr, " %s(%d,%d)=0x%016llx -> %s=0x%016llx -> %s=0x%016llx failed\n",
+ masked, row, col, mask, extracted, extr, inserted, inst);
errors ++;
}
}
fprintf (stderr, " (%d, %d)", tuple->row, tuple->col);
else
fprintf (stderr, " (%d)", tuple->col);
- fprintf (stderr, " == 0x%08lx%08lx wrong, != 0x%08lx%08lx\n",
- (long) (val >> 32), (long) val,
- (long) (check >> 32), (long) check);
+ fprintf (stderr, " == 0x%016llx wrong, != 0x%016llx\n",
+ val, check);
errors ++;
}
}