You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

lamch.c 6.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*********************************************************************/
  2. /* Copyright 2009, 2010 The University of Texas at Austin. */
  3. /* All rights reserved. */
  4. /* */
  5. /* Redistribution and use in source and binary forms, with or */
  6. /* without modification, are permitted provided that the following */
  7. /* conditions are met: */
  8. /* */
  9. /* 1. Redistributions of source code must retain the above */
  10. /* copyright notice, this list of conditions and the following */
  11. /* disclaimer. */
  12. /* */
  13. /* 2. Redistributions in binary form must reproduce the above */
  14. /* copyright notice, this list of conditions and the following */
  15. /* disclaimer in the documentation and/or other materials */
  16. /* provided with the distribution. */
  17. /* */
  18. /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
  19. /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
  20. /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
  21. /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
  22. /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
  23. /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
  24. /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  25. /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
  26. /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
  27. /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  28. /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  29. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
  30. /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  31. /* POSSIBILITY OF SUCH DAMAGE. */
  32. /* */
  33. /* The views and conclusions contained in the software and */
  34. /* documentation are those of the authors and should not be */
  35. /* interpreted as representing official policies, either expressed */
  36. /* or implied, of The University of Texas at Austin. */
  37. /*********************************************************************/
  38. #include "common.h"
  39. #if 0
  40. static FLOAT hdata[] __attribute__((aligned(128))) = {
  41. #ifdef XDOUBLE
  42. +0x1.0000000000000000P-00064L,
  43. +0x1.0000000000000000P-16382L,
  44. +0x1.0000000000000000P+00001L,
  45. +0x1.0000000000000000P-00063L,
  46. +0x1.0000000000000000P+00006L,
  47. +0x1.0000000000000000P+00000L,
  48. -0x1.ffe8000000000000P+00013L,
  49. +0x1.0000000000000000P-16382L,
  50. +0x1.0004000000000000P+00014L,
  51. +0x1.fffffffffffffffeP+16383L,
  52. #elif defined DOUBLE
  53. +0x1.0000000000000P-0053,
  54. +0x1.0000000000000P-1022,
  55. +0x1.0000000000000P+0001,
  56. +0x1.0000000000000P-0052,
  57. +0x1.a800000000000P+0005,
  58. +0x1.0000000000000P+0000,
  59. -0x1.fe80000000000P+0009,
  60. +0x1.0000000000000P-1022,
  61. +0x1.0000000000000P+0010,
  62. +0x1.fffffffffffffP+1023,
  63. #else
  64. +0x1.000000P-024f,
  65. +0x1.000000P-126f,
  66. +0x1.000000P+001f,
  67. +0x1.000000P-023f,
  68. +0x1.800000P+004f,
  69. +0x1.000000P+000f,
  70. -0x1.f40000P+006f,
  71. +0x1.000000P-126f,
  72. +0x1.000000P+007f,
  73. +0x1.fffffeP+127f,
  74. #endif
  75. };
  76. #endif
  77. static unsigned int idata[] __attribute__((aligned(128))) = {
  78. #if defined XDOUBLE
  79. #ifndef __BIG_ENDIAN__
  80. 0x00000000, 0x80000000, 0x00003fbf, 0x00000000,
  81. 0x00000000, 0x80000000, 0x00000001, 0x00000000,
  82. 0x00000000, 0x80000000, 0x00004000, 0x00000000,
  83. 0x00000000, 0x80000000, 0x00003fc0, 0x00000000,
  84. 0x00000000, 0x80000000, 0x00004005, 0x00000000,
  85. 0x00000000, 0x80000000, 0x00003fff, 0x00000000,
  86. 0x00000000, 0xff400000, 0x0000c00c, 0x00000000,
  87. 0x00000000, 0x80000000, 0x00000001, 0x00000000,
  88. 0x00000000, 0x80200000, 0x0000400d, 0x00000000,
  89. 0xffffffff, 0xffffffff, 0x00007ffe, 0x00000000,
  90. #else
  91. 0x00000000, 0x00003fbf, 0x80000000, 0x00000000,
  92. 0x00000000, 0x00000001, 0x80000000, 0x00000000,
  93. 0x00000000, 0x00004000, 0x80000000, 0x00000000,
  94. 0x00000000, 0x00003fc0, 0x80000000, 0x00000000,
  95. 0x00000000, 0x00004005, 0x80000000, 0x00000000,
  96. 0x00000000, 0x00003fff, 0x80000000, 0x00000000,
  97. 0x00000000, 0x0000c00c, 0xff400000, 0x00000000,
  98. 0x00000000, 0x00000001, 0x80000000, 0x00000000,
  99. 0x00000000, 0x0000400d, 0x80200000, 0x00000000,
  100. 0x00000000, 0x00007ffe, 0xffffffff, 0xffffffff,
  101. #endif
  102. #elif defined DOUBLE
  103. #ifndef __BIG_ENDIAN__
  104. 0x00000000, 0x3ca00000,
  105. 0x00000000, 0x00100000,
  106. 0x00000000, 0x40000000,
  107. 0x00000000, 0x3cb00000,
  108. 0x00000000, 0x404a8000,
  109. 0x00000000, 0x3ff00000,
  110. 0x00000000, 0xc08fe800,
  111. 0x00000000, 0x00100000,
  112. 0x00000000, 0x40900000,
  113. 0xffffffff, 0x7fefffff,
  114. #else
  115. 0x3ca00000, 0x00000000,
  116. 0x00100000, 0x00000000,
  117. 0x40000000, 0x00000000,
  118. 0x3cb00000, 0x00000000,
  119. 0x404a8000, 0x00000000,
  120. 0x3ff00000, 0x00000000,
  121. 0xc08fe800, 0x00000000,
  122. 0x00100000, 0x00000000,
  123. 0x40900000, 0x00000000,
  124. 0x7fefffff, 0xffffffff,
  125. #endif
  126. #else
  127. 0x33800000,
  128. 0x00800000,
  129. 0x40000000,
  130. 0x34000000,
  131. 0x41c00000,
  132. 0x3f800000,
  133. 0xc2fa0000,
  134. 0x00800000,
  135. 0x43000000,
  136. 0x7f7fffff,
  137. #endif
  138. };
  139. #ifdef NEED_F2CCONV
  140. double
  141. #else
  142. FLOAT
  143. #endif
  144. NAME(char *P){
  145. char p = *P;
  146. int pos;
  147. FLOAT *hdata = (FLOAT *)idata;
  148. TOUPPER(p);
  149. switch (p) {
  150. case 'E':
  151. pos = 0;
  152. break;
  153. case 'S':
  154. pos = 1;
  155. break;
  156. case 'B':
  157. pos = 2;
  158. break;
  159. case 'P':
  160. pos = 3;
  161. break;
  162. case 'N':
  163. pos = 4;
  164. break;
  165. case 'R':
  166. pos = 5;
  167. break;
  168. case 'M':
  169. pos = 6;
  170. break;
  171. case 'U':
  172. pos = 7;
  173. break;
  174. case 'L':
  175. pos = 8;
  176. break;
  177. case 'O':
  178. pos = 9;
  179. break;
  180. default:
  181. pos = 0;
  182. break;
  183. }
  184. return hdata[pos];
  185. }