73_arm64.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. // This program is designed to test some arm64-specific things, such as the
  2. // calling convention, but should give the same results on any architecture.
  3. #include <stdarg.h>
  4. #include <stdint.h>
  5. #include <stdio.h>
  6. struct s1 { char x[1]; } s1 = { "0" };
  7. struct s2 { char x[2]; } s2 = { "12" };
  8. struct s3 { char x[3]; } s3 = { "345" };
  9. struct s4 { char x[4]; } s4 = { "6789" };
  10. struct s5 { char x[5]; } s5 = { "abcde" };
  11. struct s6 { char x[6]; } s6 = { "fghijk" };
  12. struct s7 { char x[7]; } s7 = { "lmnopqr" };
  13. struct s8 { char x[8]; } s8 = { "stuvwxyz" };
  14. struct s9 { char x[9]; } s9 = { "ABCDEFGHI" };
  15. struct s10 { char x[10]; } s10 = { "JKLMNOPQRS" };
  16. struct s11 { char x[11]; } s11 = { "TUVWXYZ0123" };
  17. struct s12 { char x[12]; } s12 = { "456789abcdef" };
  18. struct s13 { char x[13]; } s13 = { "ghijklmnopqrs" };
  19. struct s14 { char x[14]; } s14 = { "tuvwxyzABCDEFG" };
  20. struct s15 { char x[15]; } s15 = { "HIJKLMNOPQRSTUV" };
  21. struct s16 { char x[16]; } s16 = { "WXYZ0123456789ab" };
  22. struct s17 { char x[17]; } s17 = { "cdefghijklmnopqrs" };
  23. struct hfa11 { float a; } hfa11 = { 11.1 };
  24. struct hfa12 { float a, b; } hfa12 = { 12.1, 12.2 };
  25. struct hfa13 { float a, b, c; } hfa13 = { 13.1, 13.2, 13.3 };
  26. struct hfa14 { float a, b, c, d; } hfa14 = { 14.1, 14.2, 14.3, 14.4 };
  27. struct hfa21 { double a; } hfa21 = { 21.1 };
  28. struct hfa22 { double a, b; } hfa22 = { 22.1, 22.2 };
  29. struct hfa23 { double a, b, c; } hfa23 = { 23.1, 23.2, 23.3 };
  30. struct hfa24 { double a, b, c, d; } hfa24 = { 24.1, 24.2, 24.3, 24.4 };
  31. struct hfa31 { long double a; } hfa31 = { 31.1 };
  32. struct hfa32 { long double a, b; } hfa32 = { 32.1, 32.2 };
  33. struct hfa33 { long double a, b, c; } hfa33 = { 33.1, 33.2, 33.3 };
  34. struct hfa34 { long double a, b, c, d; } hfa34 = { 34.1, 34.2, 34.3, 34.4 };
  35. void fa_s1(struct s1 a) { printf("%.1s\n", a.x); }
  36. void fa_s2(struct s2 a) { printf("%.2s\n", a.x); }
  37. void fa_s3(struct s3 a) { printf("%.3s\n", a.x); }
  38. void fa_s4(struct s4 a) { printf("%.4s\n", a.x); }
  39. void fa_s5(struct s5 a) { printf("%.5s\n", a.x); }
  40. void fa_s6(struct s6 a) { printf("%.6s\n", a.x); }
  41. void fa_s7(struct s7 a) { printf("%.7s\n", a.x); }
  42. void fa_s8(struct s8 a) { printf("%.8s\n", a.x); }
  43. void fa_s9(struct s9 a) { printf("%.9s\n", a.x); }
  44. void fa_s10(struct s10 a) { printf("%.10s\n", a.x); }
  45. void fa_s11(struct s11 a) { printf("%.11s\n", a.x); }
  46. void fa_s12(struct s12 a) { printf("%.12s\n", a.x); }
  47. void fa_s13(struct s13 a) { printf("%.13s\n", a.x); }
  48. void fa_s14(struct s14 a) { printf("%.14s\n", a.x); }
  49. void fa_s15(struct s15 a) { printf("%.15s\n", a.x); }
  50. void fa_s16(struct s16 a) { printf("%.16s\n", a.x); }
  51. void fa_s17(struct s17 a) { printf("%.17s\n", a.x); }
  52. void fa_hfa11(struct hfa11 a)
  53. { printf("%.1f\n", a.a); }
  54. void fa_hfa12(struct hfa12 a)
  55. { printf("%.1f %.1f\n", a.a, a.a); }
  56. void fa_hfa13(struct hfa13 a)
  57. { printf("%.1f %.1f %.1f\n", a.a, a.b, a.c); }
  58. void fa_hfa14(struct hfa14 a)
  59. { printf("%.1f %.1f %.1f %.1f\n", a.a, a.b, a.c, a.d); }
  60. void fa_hfa21(struct hfa21 a)
  61. { printf("%.1f\n", a.a); }
  62. void fa_hfa22(struct hfa22 a)
  63. { printf("%.1f %.1f\n", a.a, a.a); }
  64. void fa_hfa23(struct hfa23 a)
  65. { printf("%.1f %.1f %.1f\n", a.a, a.b, a.c); }
  66. void fa_hfa24(struct hfa24 a)
  67. { printf("%.1f %.1f %.1f %.1f\n", a.a, a.b, a.c, a.d); }
  68. void fa_hfa31(struct hfa31 a)
  69. { printf("%.1Lf\n", a.a); }
  70. void fa_hfa32(struct hfa32 a)
  71. { printf("%.1Lf %.1Lf\n", a.a, a.a); }
  72. void fa_hfa33(struct hfa33 a)
  73. { printf("%.1Lf %.1Lf %.1Lf\n", a.a, a.b, a.c); }
  74. void fa_hfa34(struct hfa34 a)
  75. { printf("%.1Lf %.1Lf %.1Lf %.1Lf\n", a.a, a.b, a.c, a.d); }
  76. void fa1(struct s8 a, struct s9 b, struct s10 c, struct s11 d,
  77. struct s12 e, struct s13 f)
  78. {
  79. printf("%.3s %.3s %.3s %.3s %.3s %.3s\n", a.x, b.x, c.x, d.x, e.x, f.x);
  80. }
  81. void fa2(struct s9 a, struct s10 b, struct s11 c, struct s12 d,
  82. struct s13 e, struct s14 f)
  83. {
  84. printf("%.3s %.3s %.3s %.3s %.3s %.3s\n", a.x, b.x, c.x, d.x, e.x, f.x);
  85. }
  86. void fa3(struct hfa14 a, struct hfa23 b, struct hfa32 c)
  87. {
  88. printf("%.1f %.1f %.1f %.1f %.1Lf %.1Lf\n",
  89. a.a, a.d, b.a, b.c, c.a, c.b);
  90. }
  91. void fa4(struct s1 a, struct hfa14 b, struct s2 c, struct hfa24 d,
  92. struct s3 e, struct hfa34 f)
  93. {
  94. printf("%.1s %.1f %.1f %.2s %.1f %.1f %.3s %.1Lf %.1Lf\n",
  95. a.x, b.a, b.d, c.x, d.a, d.d, e.x, f.a, f.d);
  96. }
  97. void arg(void)
  98. {
  99. printf("Arguments:\n");
  100. fa_s1(s1);
  101. fa_s2(s2);
  102. fa_s3(s3);
  103. fa_s4(s4);
  104. fa_s5(s5);
  105. fa_s6(s6);
  106. fa_s7(s7);
  107. fa_s8(s8);
  108. fa_s9(s9);
  109. fa_s10(s10);
  110. fa_s11(s11);
  111. fa_s12(s12);
  112. fa_s13(s13);
  113. fa_s14(s14);
  114. fa_s15(s15);
  115. fa_s16(s16);
  116. fa_s17(s17);
  117. fa_hfa11(hfa11);
  118. fa_hfa12(hfa12);
  119. fa_hfa13(hfa13);
  120. fa_hfa14(hfa14);
  121. fa_hfa21(hfa21);
  122. fa_hfa22(hfa22);
  123. fa_hfa23(hfa23);
  124. fa_hfa24(hfa24);
  125. fa_hfa31(hfa31);
  126. fa_hfa32(hfa32);
  127. fa_hfa33(hfa33);
  128. fa_hfa34(hfa34);
  129. fa1(s8, s9, s10, s11, s12, s13);
  130. fa2(s9, s10, s11, s12, s13, s14);
  131. fa3(hfa14, hfa23, hfa32);
  132. fa4(s1, hfa14, s2, hfa24, s3, hfa34);
  133. }
  134. struct s1 fr_s1(void) { return s1; }
  135. struct s2 fr_s2(void) { return s2; }
  136. struct s3 fr_s3(void) { return s3; }
  137. struct s4 fr_s4(void) { return s4; }
  138. struct s5 fr_s5(void) { return s5; }
  139. struct s6 fr_s6(void) { return s6; }
  140. struct s7 fr_s7(void) { return s7; }
  141. struct s8 fr_s8(void) { return s8; }
  142. struct s9 fr_s9(void) { return s9; }
  143. struct s10 fr_s10(void) { return s10; }
  144. struct s11 fr_s11(void) { return s11; }
  145. struct s12 fr_s12(void) { return s12; }
  146. struct s13 fr_s13(void) { return s13; }
  147. struct s14 fr_s14(void) { return s14; }
  148. struct s15 fr_s15(void) { return s15; }
  149. struct s16 fr_s16(void) { return s16; }
  150. struct s17 fr_s17(void) { return s17; }
  151. struct hfa11 fr_hfa11(void) { return hfa11; }
  152. struct hfa12 fr_hfa12(void) { return hfa12; }
  153. struct hfa13 fr_hfa13(void) { return hfa13; }
  154. struct hfa14 fr_hfa14(void) { return hfa14; }
  155. struct hfa21 fr_hfa21(void) { return hfa21; }
  156. struct hfa22 fr_hfa22(void) { return hfa22; }
  157. struct hfa23 fr_hfa23(void) { return hfa23; }
  158. struct hfa24 fr_hfa24(void) { return hfa24; }
  159. struct hfa31 fr_hfa31(void) { return hfa31; }
  160. struct hfa32 fr_hfa32(void) { return hfa32; }
  161. struct hfa33 fr_hfa33(void) { return hfa33; }
  162. struct hfa34 fr_hfa34(void) { return hfa34; }
  163. void ret(void)
  164. {
  165. struct s1 t1 = fr_s1();
  166. struct s2 t2 = fr_s2();
  167. struct s3 t3 = fr_s3();
  168. struct s4 t4 = fr_s4();
  169. struct s5 t5 = fr_s5();
  170. struct s6 t6 = fr_s6();
  171. struct s7 t7 = fr_s7();
  172. struct s8 t8 = fr_s8();
  173. struct s9 t9 = fr_s9();
  174. struct s10 t10 = fr_s10();
  175. struct s11 t11 = fr_s11();
  176. struct s12 t12 = fr_s12();
  177. struct s13 t13 = fr_s13();
  178. struct s14 t14 = fr_s14();
  179. struct s15 t15 = fr_s15();
  180. struct s16 t16 = fr_s16();
  181. struct s17 t17 = fr_s17();
  182. printf("Return values:\n");
  183. printf("%.1s\n", t1.x);
  184. printf("%.2s\n", t2.x);
  185. printf("%.3s\n", t3.x);
  186. printf("%.4s\n", t4.x);
  187. printf("%.5s\n", t5.x);
  188. printf("%.6s\n", t6.x);
  189. printf("%.7s\n", t7.x);
  190. printf("%.8s\n", t8.x);
  191. printf("%.9s\n", t9.x);
  192. printf("%.10s\n", t10.x);
  193. printf("%.11s\n", t11.x);
  194. printf("%.12s\n", t12.x);
  195. printf("%.13s\n", t13.x);
  196. printf("%.14s\n", t14.x);
  197. printf("%.15s\n", t15.x);
  198. printf("%.16s\n", t16.x);
  199. printf("%.17s\n", t17.x);
  200. printf("%.1f\n", fr_hfa11().a);
  201. printf("%.1f %.1f\n", fr_hfa12().a, fr_hfa12().b);
  202. printf("%.1f %.1f\n", fr_hfa13().a, fr_hfa13().c);
  203. printf("%.1f %.1f\n", fr_hfa14().a, fr_hfa14().d);
  204. printf("%.1f\n", fr_hfa21().a);
  205. printf("%.1f %.1f\n", fr_hfa22().a, fr_hfa22().b);
  206. printf("%.1f %.1f\n", fr_hfa23().a, fr_hfa23().c);
  207. printf("%.1f %.1f\n", fr_hfa24().a, fr_hfa24().d);
  208. printf("%.1Lf\n", fr_hfa31().a);
  209. printf("%.1Lf %.1Lf\n", fr_hfa32().a, fr_hfa32().b);
  210. printf("%.1Lf %.1Lf\n", fr_hfa33().a, fr_hfa33().c);
  211. printf("%.1Lf %.1Lf\n", fr_hfa34().a, fr_hfa34().d);
  212. }
  213. int match(const char **s, const char *f)
  214. {
  215. const char *p = *s;
  216. for (p = *s; *f && *f == *p; f++, p++)
  217. ;
  218. if (!*f) {
  219. *s = p - 1;
  220. return 1;
  221. }
  222. return 0;
  223. }
  224. void myprintf(const char *format, ...)
  225. {
  226. const char *s;
  227. va_list ap;
  228. va_start(ap, format);
  229. for (s = format; *s; s++) {
  230. if (match(&s, "%7s")) {
  231. struct s7 t7 = va_arg(ap, struct s7);
  232. printf("%.7s", t7.x);
  233. }
  234. else if (match(&s, "%9s")) {
  235. struct s9 t9 = va_arg(ap, struct s9);
  236. printf("%.9s", t9.x);
  237. }
  238. else if (match(&s, "%hfa11")) {
  239. struct hfa11 x = va_arg(ap, struct hfa11);
  240. printf("%.1f,%.1f", x.a, x.a);
  241. }
  242. else if (match(&s, "%hfa12")) {
  243. struct hfa12 x = va_arg(ap, struct hfa12);
  244. printf("%.1f,%.1f", x.a, x.b);
  245. }
  246. else if (match(&s, "%hfa13")) {
  247. struct hfa13 x = va_arg(ap, struct hfa13);
  248. printf("%.1f,%.1f", x.a, x.c);
  249. }
  250. else if (match(&s, "%hfa14")) {
  251. struct hfa14 x = va_arg(ap, struct hfa14);
  252. printf("%.1f,%.1f", x.a, x.d);
  253. }
  254. else if (match(&s, "%hfa21")) {
  255. struct hfa21 x = va_arg(ap, struct hfa21);
  256. printf("%.1f,%.1f", x.a, x.a);
  257. }
  258. else if (match(&s, "%hfa22")) {
  259. struct hfa22 x = va_arg(ap, struct hfa22);
  260. printf("%.1f,%.1f", x.a, x.b);
  261. }
  262. else if (match(&s, "%hfa23")) {
  263. struct hfa23 x = va_arg(ap, struct hfa23);
  264. printf("%.1f,%.1f", x.a, x.c);
  265. }
  266. else if (match(&s, "%hfa24")) {
  267. struct hfa24 x = va_arg(ap, struct hfa24);
  268. printf("%.1f,%.1f", x.a, x.d);
  269. }
  270. else if (match(&s, "%hfa31")) {
  271. struct hfa31 x = va_arg(ap, struct hfa31);
  272. printf("%.1Lf,%.1Lf", x.a, x.a);
  273. }
  274. else if (match(&s, "%hfa32")) {
  275. struct hfa32 x = va_arg(ap, struct hfa32);
  276. printf("%.1Lf,%.1Lf", x.a, x.b);
  277. }
  278. else if (match(&s, "%hfa33")) {
  279. struct hfa33 x = va_arg(ap, struct hfa33);
  280. printf("%.1Lf,%.1Lf", x.a, x.c);
  281. }
  282. else if (match(&s, "%hfa34")) {
  283. struct hfa34 x = va_arg(ap, struct hfa34);
  284. printf("%.1Lf,%.1Lf", x.a, x.d);
  285. }
  286. else
  287. putchar(*s);
  288. }
  289. putchar('\n');
  290. }
  291. void stdarg(void)
  292. {
  293. printf("stdarg:\n");
  294. myprintf("%9s %9s %9s %9s %9s %9s", s9, s9, s9, s9, s9, s9);
  295. myprintf("%7s %9s %9s %9s %9s %9s", s7, s9, s9, s9, s9, s9);
  296. myprintf("HFA long double:");
  297. myprintf("%hfa34 %hfa34 %hfa34 %hfa34", hfa34, hfa34, hfa34, hfa34);
  298. myprintf("%hfa33 %hfa34 %hfa34 %hfa34", hfa33, hfa34, hfa34, hfa34);
  299. myprintf("%hfa32 %hfa34 %hfa34 %hfa34", hfa32, hfa34, hfa34, hfa34);
  300. myprintf("%hfa31 %hfa34 %hfa34 %hfa34", hfa31, hfa34, hfa34, hfa34);
  301. myprintf("%hfa32 %hfa33 %hfa33 %hfa33 %hfa33",
  302. hfa32, hfa33, hfa33, hfa33, hfa33);
  303. myprintf("%hfa31 %hfa33 %hfa33 %hfa33 %hfa33",
  304. hfa31, hfa33, hfa33, hfa33, hfa33);
  305. myprintf("%hfa33 %hfa33 %hfa33 %hfa33",
  306. hfa33, hfa33, hfa33, hfa33);
  307. myprintf("%hfa34 %hfa32 %hfa32 %hfa32 %hfa32",
  308. hfa34, hfa32, hfa32, hfa32, hfa32);
  309. myprintf("%hfa33 %hfa32 %hfa32 %hfa32 %hfa32",
  310. hfa33, hfa32, hfa32, hfa32, hfa32);
  311. myprintf("%hfa34 %hfa32 %hfa31 %hfa31 %hfa31 %hfa31",
  312. hfa34, hfa32, hfa31, hfa31, hfa31, hfa31);
  313. myprintf("HFA double:");
  314. myprintf("%hfa24 %hfa24 %hfa24 %hfa24", hfa24, hfa24, hfa24, hfa24);
  315. myprintf("%hfa23 %hfa24 %hfa24 %hfa24", hfa23, hfa24, hfa24, hfa24);
  316. myprintf("%hfa22 %hfa24 %hfa24 %hfa24", hfa22, hfa24, hfa24, hfa24);
  317. myprintf("%hfa21 %hfa24 %hfa24 %hfa24", hfa21, hfa24, hfa24, hfa24);
  318. myprintf("%hfa22 %hfa23 %hfa23 %hfa23 %hfa23",
  319. hfa22, hfa23, hfa23, hfa23, hfa23);
  320. myprintf("%hfa21 %hfa23 %hfa23 %hfa23 %hfa23",
  321. hfa21, hfa23, hfa23, hfa23, hfa23);
  322. myprintf("%hfa23 %hfa23 %hfa23 %hfa23",
  323. hfa23, hfa23, hfa23, hfa23);
  324. myprintf("%hfa24 %hfa22 %hfa22 %hfa22 %hfa22",
  325. hfa24, hfa22, hfa22, hfa22, hfa22);
  326. myprintf("%hfa23 %hfa22 %hfa22 %hfa22 %hfa22",
  327. hfa23, hfa22, hfa22, hfa22, hfa22);
  328. myprintf("%hfa24 %hfa22 %hfa21 %hfa21 %hfa21 %hfa21",
  329. hfa24, hfa22, hfa21, hfa21, hfa21, hfa21);
  330. myprintf("HFA float:");
  331. myprintf("%hfa14 %hfa14 %hfa14 %hfa14", hfa14, hfa14, hfa14, hfa14);
  332. myprintf("%hfa13 %hfa14 %hfa14 %hfa14", hfa13, hfa14, hfa14, hfa14);
  333. myprintf("%hfa12 %hfa14 %hfa14 %hfa14", hfa12, hfa14, hfa14, hfa14);
  334. myprintf("%hfa11 %hfa14 %hfa14 %hfa14", hfa11, hfa14, hfa14, hfa14);
  335. myprintf("%hfa12 %hfa13 %hfa13 %hfa13 %hfa13",
  336. hfa12, hfa13, hfa13, hfa13, hfa13);
  337. myprintf("%hfa11 %hfa13 %hfa13 %hfa13 %hfa13",
  338. hfa11, hfa13, hfa13, hfa13, hfa13);
  339. myprintf("%hfa13 %hfa13 %hfa13 %hfa13",
  340. hfa13, hfa13, hfa13, hfa13);
  341. myprintf("%hfa14 %hfa12 %hfa12 %hfa12 %hfa12",
  342. hfa14, hfa12, hfa12, hfa12, hfa12);
  343. myprintf("%hfa13 %hfa12 %hfa12 %hfa12 %hfa12",
  344. hfa13, hfa12, hfa12, hfa12, hfa12);
  345. myprintf("%hfa14 %hfa12 %hfa11 %hfa11 %hfa11 %hfa11",
  346. hfa14, hfa12, hfa11, hfa11, hfa11, hfa11);
  347. }
  348. void pll(unsigned long long x)
  349. {
  350. printf("%llx\n", x);
  351. }
  352. void movi(void)
  353. {
  354. printf("MOVI:\n");
  355. pll(0);
  356. pll(0xabcd);
  357. pll(0xabcd0000);
  358. pll(0xabcd00000000);
  359. pll(0xabcd000000000000);
  360. pll(0xffffabcd);
  361. pll(0xabcdffff);
  362. pll(0xffffffffffffabcd);
  363. pll(0xffffffffabcdffff);
  364. pll(0xffffabcdffffffff);
  365. pll(0xabcdffffffffffff);
  366. pll(0xaaaaaaaa);
  367. pll(0x5555555555555555);
  368. pll(0x77777777);
  369. pll(0x3333333333333333);
  370. pll(0xf8f8f8f8);
  371. pll(0x1e1e1e1e1e1e1e1e);
  372. pll(0x3f803f80);
  373. pll(0x01ff01ff01ff01ff);
  374. pll(0x007fffc0);
  375. pll(0x03fff80003fff800);
  376. pll(0x0007fffffffffe00);
  377. pll(0xabcd1234);
  378. pll(0xabcd00001234);
  379. pll(0xabcd000000001234);
  380. pll(0xabcd12340000);
  381. pll(0xabcd000012340000);
  382. pll(0xabcd123400000000);
  383. pll(0xffffffffabcd1234);
  384. pll(0xffffabcdffff1234);
  385. pll(0xabcdffffffff1234);
  386. pll(0xffffabcd1234ffff);
  387. pll(0xabcdffff1234ffff);
  388. pll(0xabcd1234ffffffff);
  389. pll(0xffffef0123456789);
  390. pll(0xabcdef012345ffff);
  391. pll(0xabcdef0123456789);
  392. }
  393. static uint32_t addip0(uint32_t x) { return x + 0; }
  394. static uint64_t sublp0(uint64_t x) { return x - 0; }
  395. static uint32_t addip123(uint32_t x) { return x + 123; }
  396. static uint64_t addlm123(uint64_t x) { return x + -123; }
  397. static uint64_t sublp4095(uint64_t x) { return x - 4095; }
  398. static uint32_t subim503808(uint32_t x) { return x - -503808; }
  399. static uint64_t addp12345(uint64_t x) { return x + 12345; }
  400. static uint32_t subp12345(uint32_t x) { return x - 12345; }
  401. static uint32_t mvni(uint32_t x) { return 0xffffffff - x; }
  402. static uint64_t negl(uint64_t x) { return 0 - x; }
  403. static uint32_t rsbi123(uint32_t x) { return 123 - x; }
  404. static uint64_t rsbl123(uint64_t x) { return 123 - x; }
  405. static uint32_t andi0(uint32_t x) { return x & 0; }
  406. static uint64_t andlm1(uint64_t x) { return x & -1; }
  407. static uint64_t orrl0(uint64_t x) { return x | 0; }
  408. static uint32_t orrim1(uint32_t x) { return x | -1; }
  409. static uint32_t eori0(uint32_t x) { return x ^ 0; }
  410. static uint64_t eorlm1(uint64_t x) { return x ^ -1; }
  411. static uint32_t and0xf0(uint32_t x) { return x & 0xf0; }
  412. static uint64_t orr0xf0(uint64_t x) { return x | 0xf0; }
  413. static uint64_t eor0xf0(uint64_t x) { return x ^ 0xf0; }
  414. static uint32_t lsli0(uint32_t x) { return x << 0; }
  415. static uint32_t lsri0(uint32_t x) { return x >> 0; }
  416. static int64_t asrl0(int64_t x) { return x >> 0; }
  417. static uint32_t lsli1(uint32_t x) { return x << 1; }
  418. static uint32_t lsli31(uint32_t x) { return x << 31; }
  419. static uint64_t lsll1(uint64_t x) { return x << 1; }
  420. static uint64_t lsll63(uint64_t x) { return x << 63; }
  421. static uint32_t lsri1(uint32_t x) { return x >> 1; }
  422. static uint32_t lsri31(uint32_t x) { return x >> 31; }
  423. static uint64_t lsrl1(uint64_t x) { return x >> 1; }
  424. static uint64_t lsrl63(uint64_t x) { return x >> 63; }
  425. static int32_t asri1(int32_t x) { return x >> 1; }
  426. static int32_t asri31(int32_t x) { return x >> 31; }
  427. static int64_t asrl1(int64_t x) { return x >> 1; }
  428. static int64_t asrl63(int64_t x) { return x >> 63; }
  429. void opi(void)
  430. {
  431. int x = 1000;
  432. pll(addip0(x));
  433. pll(sublp0(x));
  434. pll(addip123(x));
  435. pll(addlm123(x));
  436. pll(sublp4095(x));
  437. pll(subim503808(x));
  438. pll(addp12345(x));
  439. pll(subp12345(x));
  440. pll(mvni(x));
  441. pll(negl(x));
  442. pll(rsbi123(x));
  443. pll(rsbl123(x));
  444. pll(andi0(x));
  445. pll(andlm1(x));
  446. pll(orrl0(x));
  447. pll(orrim1(x));
  448. pll(eori0(x));
  449. pll(eorlm1(x));
  450. pll(and0xf0(x));
  451. pll(orr0xf0(x));
  452. pll(eor0xf0(x));
  453. pll(lsli0(x));
  454. pll(lsri0(x));
  455. pll(asrl0(x));
  456. pll(lsli1(x));
  457. pll(lsli31(x));
  458. pll(lsll1(x));
  459. pll(lsll63(x));
  460. pll(lsri1(x));
  461. pll(lsri31(x));
  462. pll(lsrl1(x));
  463. pll(lsrl63(x));
  464. pll(asri1(x));
  465. pll(asri31(x));
  466. pll(asrl1(x));
  467. pll(asrl63(x));
  468. }
  469. void pcs(void)
  470. {
  471. arg();
  472. ret();
  473. stdarg();
  474. movi();
  475. opi();
  476. }
  477. int main()
  478. {
  479. pcs();
  480. return 0;
  481. }