home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / gnuc / gnulib / rcs / gnulib.c,v < prev    next >
Encoding:
Text File  |  1992-07-04  |  9.8 KB  |  622 lines

  1. head    1.1;
  2. access;
  3. symbols
  4.     version39-41:1.1;
  5. locks;
  6. comment    @ * @;
  7.  
  8.  
  9. 1.1
  10. date    92.06.08.19.47.59;    author mwild;    state Exp;
  11. branches;
  12. next    ;
  13.  
  14.  
  15. desc
  16. @initial checkin
  17. @
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @/* Subroutines needed by GCC output code on some machines.  */
  26. /* Compile this file with the Unix C compiler!  */
  27. /* Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  28.  
  29. This file is part of GNU CC.
  30.  
  31. GNU CC is free software; you can redistribute it and/or modify
  32. it under the terms of the GNU General Public License as published by
  33. the Free Software Foundation; either version 1, or (at your option)
  34. any later version.
  35.  
  36. GNU CC is distributed in the hope that it will be useful,
  37. but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  39. GNU General Public License for more details.
  40.  
  41. You should have received a copy of the GNU General Public License
  42. along with GNU CC; see the file COPYING.  If not, write to
  43. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  44.  
  45. /* As a special exception, if you link this library with files
  46.    compiled with GCC to produce an executable, this does not cause
  47.    the resulting executable to be covered by the GNU General Public License.
  48.    This exception does not however invalidate any other reasons why
  49.    the executable file might be covered by the GNU General Public License.  */
  50.  
  51. #include "config.h"
  52.  
  53. /* On some machines, cc is really GCC.  For these machines, we can't
  54.    expect these functions to be properly compiled unless GCC open codes
  55.    the operation (which is precisely when the function won't be used).
  56.    So allow tm-*.h to specify ways of accomplishing the operations
  57.    by defining the macros perform_*.
  58.  
  59.    On a machine where cc is some other compiler, there is usually no
  60.    reason to define perform_*.  The other compiler normally has other ways
  61.    of implementing all of these operations.
  62.  
  63.    In some cases a certain machine may come with GCC installed as cc
  64.    or may have some other compiler.  Then it may make sense for tm-*.h
  65.    to define perform_* only if __GNUC__ is defined.  */
  66.  
  67. #ifndef perform_mulsi3
  68. #define perform_mulsi3(a, b) return a * b
  69. #endif
  70.  
  71. #ifndef perform_divsi3
  72. #define perform_divsi3(a, b) return a / b
  73. #endif
  74.  
  75. #ifndef perform_udivsi3
  76. #define perform_udivsi3(a, b) return a / b
  77. #endif
  78.  
  79. #ifndef perform_modsi3
  80. #define perform_modsi3(a, b) return a % b
  81. #endif
  82.  
  83. #ifndef perform_umodsi3
  84. #define perform_umodsi3(a, b) return a % b
  85. #endif
  86.  
  87. #ifndef perform_lshrsi3
  88. #define perform_lshrsi3(a, b) return a >> b
  89. #endif
  90.  
  91. #ifndef perform_lshlsi3
  92. #define perform_lshlsi3(a, b) return a << b
  93. #endif
  94.  
  95. #ifndef perform_ashrsi3
  96. #define perform_ashrsi3(a, b) return a << b
  97. #endif
  98.  
  99. #ifndef perform_ashlsi3
  100. #define perform_ashlsi3(a, b) return a >> b
  101. #endif
  102.  
  103. #ifndef perform_adddf3
  104. #define perform_adddf3(a, b) return a + b
  105. #endif
  106.  
  107. #ifndef perform_subdf3
  108. #define perform_subdf3(a, b) return a - b
  109. #endif
  110.  
  111. #ifndef perform_muldf3
  112. #define perform_muldf3(a, b) return a * b
  113. #endif
  114.  
  115. #ifndef perform_divdf3
  116. #define perform_divdf3(a, b) return a / b
  117. #endif
  118.  
  119. #ifndef perform_addsf3
  120. #define perform_addsf3(a, b) return INTIFY (a + b)
  121. #endif
  122.  
  123. #ifndef perform_subsf3
  124. #define perform_subsf3(a, b) return INTIFY (a - b)
  125. #endif
  126.  
  127. #ifndef perform_mulsf3
  128. #define perform_mulsf3(a, b) return INTIFY (a * b)
  129. #endif
  130.  
  131. #ifndef perform_divsf3
  132. #define perform_divsf3(a, b) return INTIFY (a / b)
  133. #endif
  134.  
  135. #ifndef perform_negdf2
  136. #define perform_negdf2(a) return -a
  137. #endif
  138.  
  139. #ifndef perform_negsf2
  140. #define perform_negsf2(a) return INTIFY (-a)
  141. #endif
  142.  
  143. #ifndef perform_fixsfsi
  144. #define perform_fixsfsi(a) return (SItype) a
  145. #endif
  146.  
  147. #ifndef perform_floatsidf
  148. #define perform_floatsidf(a) return (double) a
  149. #endif
  150.  
  151. #ifndef perform_floatsisf
  152. #define perform_floatsisf(a)  return INTIFY ((float) a)
  153. #endif
  154.  
  155. #ifndef perform_extendsfdf2
  156. #define perform_extendsfdf2(a)  return a
  157. #endif
  158.  
  159. #ifndef perform_truncdfsf2
  160. #define perform_truncdfsf2(a)  return INTIFY (a)
  161. #endif
  162.  
  163. #ifndef perform_eqdf2
  164. #define perform_eqdf2(a, b) return !(a == b)
  165. #endif
  166.  
  167. #ifndef perform_nedf2
  168. #define perform_nedf2(a, b) return a != b
  169. #endif
  170.  
  171. #ifndef perform_gtdf2
  172. #define perform_gtdf2(a, b) return a > b
  173. #endif
  174.  
  175. #ifndef perform_gedf2
  176. #define perform_gedf2(a, b) return (a >= b) - 1
  177. #endif
  178.  
  179. #ifndef perform_ltdf2
  180. #define perform_ltdf2(a, b) return -(a < b)
  181. #endif
  182.  
  183. #ifndef perform_ledf2
  184. #define perform_ledf2(a, b) return 1 - (a <= b)
  185. #endif
  186.  
  187. #ifndef perform_eqsf2
  188. #define perform_eqsf2(a, b) return !(a == b)
  189. #endif
  190.  
  191. #ifndef perform_nesf2
  192. #define perform_nesf2(a, b) return a != b
  193. #endif
  194.  
  195. #ifndef perform_gtsf2
  196. #define perform_gtsf2(a, b) return a > b
  197. #endif
  198.  
  199. #ifndef perform_gesf2
  200. #define perform_gesf2(a, b) return (a >= b) - 1
  201. #endif
  202.  
  203. #ifndef perform_ltsf2
  204. #define perform_ltsf2(a, b) return -(a < b)
  205. #endif
  206.  
  207. #ifndef perform_lesf2
  208. #define perform_lesf2(a, b) return 1 - (a >= b);
  209. #endif
  210.  
  211. /* In case config.h defined it.  */
  212. #undef abort
  213.  
  214. /* Define the C data type to use for an SImode value.  */
  215.  
  216. #ifndef SItype
  217. #define SItype long int
  218. #endif
  219.  
  220. /* Define the type to be used for returning an SF mode value
  221.    and the method for turning a float into that type.
  222.    These definitions work for machines where an SF value is
  223.    returned in the same register as an int.  */
  224.  
  225. #ifndef SFVALUE  
  226. #define SFVALUE int
  227. #endif
  228.  
  229. #ifndef INTIFY
  230. #define INTIFY(FLOATVAL)  (intify.f = (FLOATVAL), intify.i)
  231. #endif
  232.  
  233. union flt_or_int { int i; float f; };
  234.  
  235.  
  236. #ifdef L_mulsi3
  237. SItype
  238. __mulsi3 (a, b)
  239.      SItype a, b;
  240. {
  241.   perform_mulsi3 (a, b);
  242. }
  243. #endif
  244.  
  245. #ifdef L_udivsi3
  246. SItype
  247. __udivsi3 (a, b)
  248.      unsigned SItype a, b;
  249. {
  250.   perform_udivsi3 (a, b);
  251. }
  252. #endif
  253.  
  254. #ifdef L_divsi3
  255. SItype
  256. __divsi3 (a, b)
  257.      SItype a, b;
  258. {
  259.   perform_divsi3 (a, b);
  260. }
  261. #endif
  262.  
  263. #ifdef L_umodsi3
  264. SItype
  265. __umodsi3 (a, b)
  266.      unsigned SItype a, b;
  267. {
  268.   perform_umodsi3 (a, b);
  269. }
  270. #endif
  271.  
  272. #ifdef L_modsi3
  273. SItype
  274. __modsi3 (a, b)
  275.      SItype a, b;
  276. {
  277.   perform_modsi3 (a, b);
  278. }
  279. #endif
  280.  
  281. #ifdef L_lshrsi3
  282. SItype
  283. __lshrsi3 (a, b)
  284.      unsigned SItype a, b;
  285. {
  286.   perform_lshrsi3 (a, b);
  287. }
  288. #endif
  289.  
  290. #ifdef L_lshlsi3
  291. SItype
  292. __lshlsi3 (a, b)
  293.      unsigned SItype a, b;
  294. {
  295.   perform_lshlsi3 (a, b);
  296. }
  297. #endif
  298.  
  299. #ifdef L_ashrsi3
  300. SItype
  301. __ashrsi3 (a, b)
  302.      SItype a, b;
  303. {
  304.   perform_ashrsi3 (a, b);
  305. }
  306. #endif
  307.  
  308. #ifdef L_ashlsi3
  309. SItype
  310. __ashlsi3 (a, b)
  311.      SItype a, b;
  312. {
  313.   perform_ashlsi3 (a, b);
  314. }
  315. #endif
  316.  
  317. #ifdef L_divdf3
  318. double
  319. __divdf3 (a, b)
  320.      double a, b;
  321. {
  322.   perform_divdf3 (a, b);
  323. }
  324. #endif
  325.  
  326. #ifdef L_muldf3
  327. double
  328. __muldf3 (a, b)
  329.      double a, b;
  330. {
  331.   perform_muldf3 (a, b);
  332. }
  333. #endif
  334.  
  335. #ifdef L_negdf2
  336. double
  337. __negdf2 (a)
  338.      double a;
  339. {
  340.   perform_negdf2 (a);
  341. }
  342. #endif
  343.  
  344. #ifdef L_adddf3
  345. double
  346. __adddf3 (a, b)
  347.      double a, b;
  348. {
  349.   perform_adddf3 (a, b);
  350. }
  351. #endif
  352.  
  353. #ifdef L_subdf3
  354. double
  355. __subdf3 (a, b)
  356.      double a, b;
  357. {
  358.   perform_subdf3 (a, b);
  359. }
  360. #endif
  361.  
  362. #ifdef L_cmpdf2
  363. SItype
  364. __cmpdf2 (a, b)
  365.      double a, b;
  366. {
  367. #ifdef perform_cmpdf2
  368.   perform_cmpdf2 (a, b);
  369. #else
  370.   if (a > b)
  371.     return 1;
  372.   else if (a < b)
  373.     return -1;
  374.   return 0;
  375. #endif
  376. }
  377. #endif
  378.  
  379. #ifdef L_eqdf2
  380. SItype
  381. __eqdf2 (a, b)
  382.      double a, b;
  383. {
  384.   /* Value == 0 iff a == b.  */
  385.   perform_eqdf2 (a, b);
  386. }
  387. #endif
  388.  
  389. #ifdef L_nedf2
  390. SItype
  391. __nedf2 (a, b)
  392.      double a, b;
  393. {
  394.   /* Value != 0 iff a != b.  */
  395.   perform_nedf2 (a, b);
  396. }
  397. #endif
  398.  
  399. #ifdef L_gtdf2
  400. SItype
  401. __gtdf2 (a, b)
  402.      double a, b;
  403. {
  404.   /* Value > 0 iff a > b.  */
  405.   perform_gtdf2 (a, b);
  406. }
  407. #endif
  408.  
  409. #ifdef L_gedf2
  410. SItype
  411. __gedf2 (a, b)
  412.      double a, b;
  413. {
  414.   /* Value >= 0 iff a >= b.  */
  415.   perform_gedf2 (a, b);
  416. }
  417. #endif
  418.  
  419. #ifdef L_ltdf2
  420. SItype
  421. __ltdf2 (a, b)
  422.      double a, b;
  423. {
  424.   /* Value < 0 iff a < b.  */
  425.   perform_ltdf2 (a, b);
  426. }
  427. #endif
  428.  
  429. #ifdef L_ledf2
  430. SItype
  431. __ledf2 (a, b)
  432.      double a, b;
  433. {
  434.   /* Value <= 0 iff a <= b.  */
  435.   perform_ledf2 (a, b);
  436. }
  437. #endif
  438.  
  439. #ifdef L_fixdfsi
  440. SItype
  441. __fixdfsi (a)
  442.      double a;
  443. {
  444.   return (SItype) a;
  445. }
  446. #endif
  447.  
  448. #ifdef L_fixsfsi
  449. SItype
  450. __fixsfsi (a)
  451.      union flt_or_int a;
  452. {
  453.   perform_fixsfsi (a.f);
  454. }
  455. #endif
  456.  
  457. #ifdef L_floatsidf
  458. double
  459. __floatsidf (a)
  460.      SItype a;
  461. {
  462.   perform_floatsidf (a);
  463. }
  464. #endif
  465.  
  466. #ifdef L_floatsisf
  467. SFVALUE
  468. __floatsisf (a)
  469.      SItype a;
  470. {
  471.   union flt_or_int intify;
  472.   perform_floatsisf (a);
  473. }
  474. #endif
  475.  
  476. #ifdef L_addsf3
  477. SFVALUE
  478. __addsf3 (a, b)
  479.      union flt_or_int a, b;
  480. {
  481.   union flt_or_int intify;
  482.   perform_addsf3 (a.f, b.f);
  483. }
  484. #endif
  485.  
  486. #ifdef L_negsf2
  487. SFVALUE
  488. __negsf2 (a)
  489.      union flt_or_int a;
  490. {
  491.   union flt_or_int intify;
  492.   perform_negsf2 (a.f);
  493. }
  494. #endif
  495.  
  496. #ifdef L_subsf3
  497. SFVALUE
  498. __subsf3 (a, b)
  499.      union flt_or_int a, b;
  500. {
  501.   union flt_or_int intify;
  502.   perform_subsf3 (a.f, b.f);
  503. }
  504. #endif
  505.  
  506. #ifdef L_cmpsf2
  507. SItype
  508. __cmpsf2 (a, b)
  509.      union flt_or_int a, b;
  510. {
  511. #ifdef perform_cmpsf2
  512.   perform_cmpsf2 (a.f, b.f);
  513. #else
  514.   if (a.f > b.f)
  515.     return 1;
  516.   else if (a.f < b.f)
  517.     return -1;
  518.   return 0;
  519. #endif
  520. }
  521. #endif
  522.  
  523. #ifdef L_eqsf2
  524. SItype
  525. __eqsf2 (a, b)
  526.      union flt_or_int a, b;
  527. {
  528.   /* Value == 0 iff a == b.  */
  529.   perform_eqsf2 (a.f, b.f);
  530. }
  531. #endif
  532.  
  533. #ifdef L_nesf2
  534. SItype
  535. __nesf2 (a, b)
  536.      union flt_or_int a, b;
  537. {
  538.   /* Value != 0 iff a != b.  */
  539.   perform_nesf2 (a.f, b.f);
  540. }
  541. #endif
  542.  
  543. #ifdef L_gtsf2
  544. SItype
  545. __gtsf2 (a, b)
  546.      union flt_or_int a, b;
  547. {
  548.   /* Value > 0 iff a > b.  */
  549.   perform_gtsf2 (a.f, b.f);
  550. }
  551. #endif
  552.  
  553. #ifdef L_gesf2
  554. SItype
  555. __gesf2 (a, b)
  556.      union flt_or_int a, b;
  557. {
  558.   /* Value >= 0 iff a >= b.  */
  559.   perform_gesf2 (a.f, b.f);
  560. }
  561. #endif
  562.  
  563. #ifdef L_ltsf2
  564. SItype
  565. __ltsf2 (a, b)
  566.      union flt_or_int a, b;
  567. {
  568.   /* Value < 0 iff a < b.  */
  569.   perform_ltsf2 (a.f, b.f);
  570. }
  571. #endif
  572.  
  573. #ifdef L_lesf2
  574. SItype
  575. __lesf2 (a, b)
  576.      union flt_or_int a, b;
  577. {
  578.   /* Value <= 0 iff a <= b.  */
  579.   perform_lesf2 (a.f, b.f);
  580. }
  581. #endif
  582.  
  583. #ifdef L_mulsf3
  584. SFVALUE
  585. __mulsf3 (a, b)
  586.      union flt_or_int a, b;
  587. {
  588.   union flt_or_int intify;
  589.   perform_mulsf3 (a.f, b.f);
  590. }
  591. #endif
  592.  
  593. #ifdef L_divsf3
  594. SFVALUE
  595. __divsf3 (a, b)
  596.      union flt_or_int a, b;
  597. {
  598.   union flt_or_int intify;
  599.   perform_divsf3 (a.f, b.f);
  600. }
  601. #endif
  602.  
  603. #ifdef L_truncdfsf2
  604. SFVALUE
  605. __truncdfsf2 (a)
  606.      double a;
  607. {
  608.   union flt_or_int intify;
  609.   perform_truncdfsf2 (a);
  610. }
  611. #endif
  612.  
  613. #ifdef L_extendsfdf2
  614. double
  615. __extendsfdf2 (a)
  616.      union flt_or_int a;
  617. {
  618.   perform_extendsfdf2 (a.f);
  619. }
  620. #endif
  621. @
  622.