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

131 lines
5.6KB

  1. #ifndef _IA64INTRIN_H_INCLUDED
  2. #define _IA64INTRIN_H_INCLUDED
  3. /* Actually, everything is a compiler builtin, but just so
  4. there's no confusion... */
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. extern void __sync_synchronize (void);
  9. extern int __sync_val_compare_and_swap_si (int *, int, int);
  10. extern long __sync_val_compare_and_swap_di (long *, long, long);
  11. #define __sync_val_compare_and_swap(PTR, OLD, NEW) \
  12. ((sizeof (*(PTR)) == sizeof(int)) \
  13. ? (__typeof__(*(PTR))) \
  14. __sync_val_compare_and_swap_si((int *)(PTR),(int)(OLD),(int)(NEW)) \
  15. : (__typeof__(*(PTR))) \
  16. __sync_val_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW)))
  17. extern int __sync_bool_compare_and_swap_si (int *, int, int);
  18. extern int __sync_bool_compare_and_swap_di (long *, long, long);
  19. #define __sync_bool_compare_and_swap(PTR, OLD, NEW) \
  20. ((sizeof (*(PTR)) == sizeof(int)) \
  21. ? __sync_bool_compare_and_swap_si((int *)(PTR),(int)(OLD),(int)(NEW)) \
  22. : __sync_bool_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW)))
  23. extern void __sync_lock_release_si (int *);
  24. extern void __sync_lock_release_di (long *);
  25. #define __sync_lock_release(PTR) \
  26. ((sizeof (*(PTR)) == sizeof(int)) \
  27. ? __sync_lock_release_si((int *)(PTR)) \
  28. : __sync_lock_release_di((long *)(PTR)))
  29. extern int __sync_lock_test_and_set_si (int *, int);
  30. extern long __sync_lock_test_and_set_di (long *, long);
  31. #define __sync_lock_test_and_set(PTR,VAL) \
  32. ((sizeof (*(PTR)) == sizeof(int)) \
  33. ? (__typeof__(*(PTR))) __sync_lock_test_and_set_si((int *)(PTR),(int)(VAL)) \
  34. : (__typeof__(*(PTR))) __sync_lock_test_and_set_di((long *)(PTR),(long)(VAL)))
  35. extern int __sync_fetch_and_add_si (int *, int);
  36. extern long __sync_fetch_and_add_di (long *, long);
  37. #define __sync_fetch_and_add(PTR,VAL) \
  38. ((sizeof (*(PTR)) == sizeof(int)) \
  39. ? (__typeof__(*(PTR))) __sync_fetch_and_add_si((int *)(PTR),(int)(VAL)) \
  40. : (__typeof__(*(PTR))) __sync_fetch_and_add_di((long *)(PTR),(long)(VAL)))
  41. extern int __sync_fetch_and_sub_si (int *, int);
  42. extern long __sync_fetch_and_sub_di (long *, long);
  43. #define __sync_fetch_and_sub(PTR,VAL) \
  44. ((sizeof (*(PTR)) == sizeof(int)) \
  45. ? (__typeof__(*(PTR))) __sync_fetch_and_sub_si((int *)(PTR),(int)(VAL)) \
  46. : (__typeof__(*(PTR))) __sync_fetch_and_sub_di((long *)(PTR),(long)(VAL)))
  47. extern int __sync_fetch_and_and_si (int *, int);
  48. extern long __sync_fetch_and_and_di (long *, long);
  49. #define __sync_fetch_and_and(PTR,VAL) \
  50. ((sizeof (*(PTR)) == sizeof(int)) \
  51. ? (__typeof__(*(PTR))) __sync_fetch_and_and_si((int *)(PTR),(int)(VAL)) \
  52. : (__typeof__(*(PTR))) __sync_fetch_and_and_di((long *)(PTR),(long)(VAL)))
  53. extern int __sync_fetch_and_or_si (int *, int);
  54. extern long __sync_fetch_and_or_di (long *, long);
  55. #define __sync_fetch_and_or(PTR,VAL) \
  56. ((sizeof (*(PTR)) == sizeof(int)) \
  57. ? (__typeof__(*(PTR))) __sync_fetch_and_or_si((int *)(PTR),(int)(VAL)) \
  58. : (__typeof__(*(PTR))) __sync_fetch_and_or_di((long *)(PTR),(long)(VAL)))
  59. extern int __sync_fetch_and_xor_si (int *, int);
  60. extern long __sync_fetch_and_xor_di (long *, long);
  61. #define __sync_fetch_and_xor(PTR,VAL) \
  62. ((sizeof (*(PTR)) == sizeof(int)) \
  63. ? (__typeof__(*(PTR))) __sync_fetch_and_xor_si((int *)(PTR),(int)(VAL)) \
  64. : (__typeof__(*(PTR))) __sync_fetch_and_xor_di((long *)(PTR),(long)(VAL)))
  65. extern int __sync_fetch_and_nand_si (int *, int);
  66. extern long __sync_fetch_and_nand_di (long *, long);
  67. #define __sync_fetch_and_nand(PTR,VAL) \
  68. ((sizeof (*(PTR)) == sizeof(int)) \
  69. ? (__typeof__(*(PTR))) __sync_fetch_and_nand_si((int *)(PTR),(int)(VAL)) \
  70. : (__typeof__(*(PTR))) __sync_fetch_and_nand_di((long *)(PTR),(long)(VAL)))
  71. extern int __sync_add_and_fetch_si (int *, int);
  72. extern long __sync_add_and_fetch_di (long *, long);
  73. #define __sync_add_and_fetch(PTR,VAL) \
  74. ((sizeof (*(PTR)) == sizeof(int)) \
  75. ? (__typeof__(*(PTR))) __sync_add_and_fetch_si((int *)(PTR),(int)(VAL)) \
  76. : (__typeof__(*(PTR))) __sync_add_and_fetch_di((long *)(PTR),(long)(VAL)))
  77. extern int __sync_sub_and_fetch_si (int *, int);
  78. extern long __sync_sub_and_fetch_di (long *, long);
  79. #define __sync_sub_and_fetch(PTR,VAL) \
  80. ((sizeof (*(PTR)) == sizeof(int)) \
  81. ? (__typeof__(*(PTR))) __sync_sub_and_fetch_si((int *)(PTR),(int)(VAL)) \
  82. : (__typeof__(*(PTR))) __sync_sub_and_fetch_di((long *)(PTR),(long)(VAL)))
  83. extern int __sync_and_and_fetch_si (int *, int);
  84. extern long __sync_and_and_fetch_di (long *, long);
  85. #define __sync_and_and_fetch(PTR,VAL) \
  86. ((sizeof (*(PTR)) == sizeof(int)) \
  87. ? (__typeof__(*(PTR))) __sync_and_and_fetch_si((int *)(PTR),(int)(VAL)) \
  88. : (__typeof__(*(PTR))) __sync_and_and_fetch_di((long *)(PTR),(long)(VAL)))
  89. extern int __sync_or_and_fetch_si (int *, int);
  90. extern long __sync_or_and_fetch_di (long *, long);
  91. #define __sync_or_and_fetch(PTR,VAL) \
  92. ((sizeof (*(PTR)) == sizeof(int)) \
  93. ? (__typeof__(*(PTR))) __sync_or_and_fetch_si((int *)(PTR),(int)(VAL)) \
  94. : (__typeof__(*(PTR))) __sync_or_and_fetch_di((long *)(PTR),(long)(VAL)))
  95. extern int __sync_xor_and_fetch_si (int *, int);
  96. extern long __sync_xor_and_fetch_di (long *, long);
  97. #define __sync_xor_and_fetch(PTR,VAL) \
  98. ((sizeof (*(PTR)) == sizeof(int)) \
  99. ? (__typeof__(*(PTR))) __sync_xor_and_fetch_si((int *)(PTR),(int)(VAL)) \
  100. : (__typeof__(*(PTR))) __sync_xor_and_fetch_di((long *)(PTR),(long)(VAL)))
  101. extern int __sync_nand_and_fetch_si (int *, int);
  102. extern long __sync_nand_and_fetch_di (long *, long);
  103. #define __sync_nand_and_fetch(PTR,VAL) \
  104. ((sizeof (*(PTR)) == sizeof(int)) \
  105. ? (__typeof__(*(PTR))) __sync_nand_and_fetch_si((int *)(PTR),(int)(VAL)) \
  106. : (__typeof__(*(PTR))) __sync_nand_and_fetch_di((long *)(PTR),(long)(VAL)))
  107. #ifdef __cplusplus
  108. }
  109. #endif
  110. #endif