home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / cross-test.c < prev    next >
Text File  |  1994-02-06  |  1KB  |  90 lines

  1. /* This small function uses all the arithmetic operators that
  2.    libgcc1.c can handle.  If you can link it, then
  3.    you have provided replacements for all the libgcc1.c functions that
  4.    your target machine needs.  */
  5.  
  6. int foo ();
  7. double dfoo ();
  8.  
  9. main ()
  10. {
  11.   int a = foo (), b = foo ();
  12.   unsigned int au = foo (), bu = foo ();
  13.   float af = dfoo (), bf = dfoo ();
  14.   double ad = dfoo (), bd = dfoo ();
  15.  
  16.   discard (a * b);
  17.   discard (a / b);
  18.   discard (a % b);
  19.  
  20.   discard (au / bu);
  21.   discard (au % bu);
  22.  
  23.   discard (a >> b);
  24.   discard (a << b);
  25.  
  26.   discard (au >> bu);
  27.   discard (au << bu);
  28.  
  29.   ddiscard (ad + bd);
  30.   ddiscard (ad - bd);
  31.   ddiscard (ad * bd);
  32.   ddiscard (ad / bd);
  33.   ddiscard (-ad);
  34.  
  35.   ddiscard (af + bf);
  36.   ddiscard (af - bf);
  37.   ddiscard (af * bf);
  38.   ddiscard (af / bf);
  39.   ddiscard (-af);
  40.  
  41.   discard ((int) ad);
  42.   discard ((int) af);
  43.  
  44.   ddiscard ((double) a);
  45.   ddiscard ((float) a);
  46.   ddiscard ((float) ad);
  47.  
  48.   discard (ad == bd);
  49.   discard (ad < bd);
  50.   discard (ad > bd);
  51.   discard (ad != bd);
  52.   discard (ad <= bd);
  53.   discard (ad >= bd);
  54.  
  55.   discard (af == bf);
  56.   discard (af < bf);
  57.   discard (af > bf);
  58.   discard (af != bf);
  59.   discard (af <= bf);
  60.   discard (af >= bf);
  61.  
  62.   return 0;
  63. }
  64.  
  65. discard (x)
  66.      int x;
  67. {}
  68.  
  69. ddiscard (x)
  70.      double x;
  71. {}
  72.  
  73. foo ()
  74. {
  75.   static int table[] = {20, 69, 4, 202};
  76.   static int idx;
  77.  
  78.   return table[idx++];
  79. }
  80.  
  81. double
  82. dfoo ()
  83. {
  84.   static double table[] = {20.4, 69.96, 4.4, 202.202};
  85.   static int idx;
  86.  
  87.   return table[idx++];
  88. }
  89.  
  90.