float4_ref.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. /*
  2. * Copyright 2010-2012 Branimir Karadzic. All rights reserved.
  3. * License: http://www.opensource.org/licenses/BSD-2-Clause
  4. */
  5. #ifndef __BX_FLOAT4_REF_H__
  6. #define __BX_FLOAT4_REF_H__
  7. #include <math.h> // sqrtf
  8. namespace bx
  9. {
  10. typedef union float4_t
  11. {
  12. int32_t ixyzw[4];
  13. uint32_t uxyzw[4];
  14. float fxyzw[4];
  15. } float4_t;
  16. #define ELEMx 0
  17. #define ELEMy 1
  18. #define ELEMz 2
  19. #define ELEMw 3
  20. #define IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
  21. BX_FLOAT4_INLINE float4_t float4_swiz_##_x##_y##_z##_w(float4_t _a) \
  22. { \
  23. float4_t result; \
  24. result.ixyzw[0] = _a.ixyzw[ELEM##_x]; \
  25. result.ixyzw[1] = _a.ixyzw[ELEM##_y]; \
  26. result.ixyzw[2] = _a.ixyzw[ELEM##_z]; \
  27. result.ixyzw[3] = _a.ixyzw[ELEM##_w]; \
  28. return result; \
  29. }
  30. #include "float4_swizzle.inl"
  31. #undef IMPLEMENT_SWIZZLE
  32. #undef ELEMw
  33. #undef ELEMz
  34. #undef ELEMy
  35. #undef ELEMx
  36. #define IMPLEMENT_TEST(_xyzw, _mask) \
  37. BX_FLOAT4_INLINE bool float4_test_any_##_xyzw(float4_t _test) \
  38. { \
  39. uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
  40. | ( (_test.uxyzw[2]>>31)<<2) \
  41. | ( (_test.uxyzw[1]>>31)<<1) \
  42. | (_test.uxyzw[0]>>31) \
  43. ; \
  44. return 0 != (tmp&(_mask) ); \
  45. } \
  46. \
  47. BX_FLOAT4_INLINE bool float4_test_all_##_xyzw(float4_t _test) \
  48. { \
  49. uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
  50. | ( (_test.uxyzw[2]>>31)<<2) \
  51. | ( (_test.uxyzw[1]>>31)<<1) \
  52. | (_test.uxyzw[0]>>31) \
  53. ; \
  54. return (_mask) == (tmp&(_mask) ); \
  55. }
  56. IMPLEMENT_TEST(x , 0x1);
  57. IMPLEMENT_TEST(y , 0x2);
  58. IMPLEMENT_TEST(xy , 0x3);
  59. IMPLEMENT_TEST(z , 0x4);
  60. IMPLEMENT_TEST(xz , 0x5);
  61. IMPLEMENT_TEST(yz , 0x6);
  62. IMPLEMENT_TEST(xyz , 0x7);
  63. IMPLEMENT_TEST(w , 0x8);
  64. IMPLEMENT_TEST(xw , 0x9);
  65. IMPLEMENT_TEST(yw , 0xa);
  66. IMPLEMENT_TEST(xyw , 0xb);
  67. IMPLEMENT_TEST(zw , 0xc);
  68. IMPLEMENT_TEST(xzw , 0xd);
  69. IMPLEMENT_TEST(yzw , 0xe);
  70. IMPLEMENT_TEST(xyzw , 0xf);
  71. #undef IMPLEMENT_TEST
  72. BX_FLOAT4_INLINE float4_t float4_shuf_xyAB(float4_t _a, float4_t _b)
  73. {
  74. float4_t result;
  75. result.uxyzw[0] = _a.uxyzw[0];
  76. result.uxyzw[1] = _a.uxyzw[1];
  77. result.uxyzw[2] = _b.uxyzw[0];
  78. result.uxyzw[3] = _b.uxyzw[1];
  79. return result;
  80. }
  81. BX_FLOAT4_INLINE float4_t float4_shuf_ABxy(float4_t _a, float4_t _b)
  82. {
  83. float4_t result;
  84. result.uxyzw[0] = _b.uxyzw[0];
  85. result.uxyzw[1] = _b.uxyzw[1];
  86. result.uxyzw[2] = _a.uxyzw[0];
  87. result.uxyzw[3] = _a.uxyzw[1];
  88. return result;
  89. }
  90. BX_FLOAT4_INLINE float4_t float4_shuf_CDzw(float4_t _a, float4_t _b)
  91. {
  92. float4_t result;
  93. result.uxyzw[0] = _b.uxyzw[2];
  94. result.uxyzw[1] = _b.uxyzw[3];
  95. result.uxyzw[2] = _a.uxyzw[2];
  96. result.uxyzw[3] = _a.uxyzw[3];
  97. return result;
  98. }
  99. BX_FLOAT4_INLINE float4_t float4_shuf_zwCD(float4_t _a, float4_t _b)
  100. {
  101. float4_t result;
  102. result.uxyzw[0] = _a.uxyzw[2];
  103. result.uxyzw[1] = _a.uxyzw[3];
  104. result.uxyzw[2] = _b.uxyzw[2];
  105. result.uxyzw[3] = _b.uxyzw[3];
  106. return result;
  107. }
  108. BX_FLOAT4_INLINE float4_t float4_shuf_xAyB(float4_t _a, float4_t _b)
  109. {
  110. float4_t result;
  111. result.uxyzw[0] = _a.uxyzw[0];
  112. result.uxyzw[1] = _b.uxyzw[0];
  113. result.uxyzw[2] = _a.uxyzw[1];
  114. result.uxyzw[3] = _b.uxyzw[1];
  115. return result;
  116. }
  117. BX_FLOAT4_INLINE float4_t float4_shuf_yBxA(float4_t _a, float4_t _b)
  118. {
  119. float4_t result;
  120. result.uxyzw[0] = _a.uxyzw[1];
  121. result.uxyzw[1] = _b.uxyzw[1];
  122. result.uxyzw[2] = _a.uxyzw[0];
  123. result.uxyzw[3] = _b.uxyzw[0];
  124. return result;
  125. }
  126. BX_FLOAT4_INLINE float4_t float4_shuf_zCwD(float4_t _a, float4_t _b)
  127. {
  128. float4_t result;
  129. result.uxyzw[0] = _a.uxyzw[2];
  130. result.uxyzw[1] = _b.uxyzw[2];
  131. result.uxyzw[2] = _a.uxyzw[3];
  132. result.uxyzw[3] = _b.uxyzw[3];
  133. return result;
  134. }
  135. BX_FLOAT4_INLINE float4_t float4_shuf_CzDw(float4_t _a, float4_t _b)
  136. {
  137. float4_t result;
  138. result.uxyzw[0] = _b.uxyzw[2];
  139. result.uxyzw[1] = _a.uxyzw[2];
  140. result.uxyzw[2] = _b.uxyzw[3];
  141. result.uxyzw[3] = _a.uxyzw[3];
  142. return result;
  143. }
  144. BX_FLOAT4_INLINE float float4_x(float4_t _a)
  145. {
  146. return _a.fxyzw[0];
  147. }
  148. BX_FLOAT4_INLINE float float4_y(float4_t _a)
  149. {
  150. return _a.fxyzw[1];
  151. }
  152. BX_FLOAT4_INLINE float float4_z(float4_t _a)
  153. {
  154. return _a.fxyzw[2];
  155. }
  156. BX_FLOAT4_INLINE float float4_w(float4_t _a)
  157. {
  158. return _a.fxyzw[3];
  159. }
  160. BX_FLOAT4_INLINE float4_t float4_ld(const void* _ptr)
  161. {
  162. return *reinterpret_cast<const float4_t*>(_ptr);
  163. }
  164. BX_FLOAT4_INLINE void float4_st(void* _ptr, float4_t _a)
  165. {
  166. *reinterpret_cast<float4_t*>(_ptr) = _a;
  167. }
  168. BX_FLOAT4_INLINE void float4_stream(void* _ptr, float4_t _a)
  169. {
  170. *reinterpret_cast<float4_t*>(_ptr) = _a;
  171. }
  172. BX_FLOAT4_INLINE float4_t float4_ld(float _x, float _y, float _z, float _w)
  173. {
  174. float4_t result;
  175. result.fxyzw[0] = _x;
  176. result.fxyzw[1] = _y;
  177. result.fxyzw[2] = _z;
  178. result.fxyzw[3] = _w;
  179. return result;
  180. }
  181. BX_FLOAT4_INLINE float4_t float4_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w)
  182. {
  183. float4_t result;
  184. result.uxyzw[0] = _x;
  185. result.uxyzw[1] = _y;
  186. result.uxyzw[2] = _z;
  187. result.uxyzw[3] = _w;
  188. return result;
  189. }
  190. BX_FLOAT4_INLINE float4_t float4_splat(const void* _ptr)
  191. {
  192. float val = *reinterpret_cast<const float*>(_ptr);
  193. return float4_ld(val, val, val, val);
  194. }
  195. BX_FLOAT4_INLINE float4_t float4_splat(float _a)
  196. {
  197. return float4_ld(_a, _a, _a, _a);
  198. }
  199. BX_FLOAT4_INLINE float4_t float4_isplat(uint32_t _a)
  200. {
  201. return float4_ild(_a, _a, _a, _a);
  202. }
  203. BX_FLOAT4_INLINE float4_t float4_zero()
  204. {
  205. return float4_ild(0, 0, 0, 0);
  206. }
  207. BX_FLOAT4_INLINE float4_t float4_itof(float4_t _a)
  208. {
  209. float4_t result;
  210. result.fxyzw[0] = (float)result.ixyzw[0];
  211. result.fxyzw[1] = (float)result.ixyzw[1];
  212. result.fxyzw[2] = (float)result.ixyzw[2];
  213. result.fxyzw[3] = (float)result.ixyzw[3];
  214. return result;
  215. }
  216. BX_FLOAT4_INLINE float4_t float4_ftoi(float4_t _a)
  217. {
  218. float4_t result;
  219. result.ixyzw[0] = (int)result.fxyzw[0];
  220. result.ixyzw[1] = (int)result.fxyzw[1];
  221. result.ixyzw[2] = (int)result.fxyzw[2];
  222. result.ixyzw[3] = (int)result.fxyzw[3];
  223. return result;
  224. }
  225. BX_FLOAT4_INLINE float4_t float4_round(float4_t _a)
  226. {
  227. const float4_t tmp = float4_ftoi(_a);
  228. const float4_t result = float4_itof(tmp);
  229. return result;
  230. }
  231. BX_FLOAT4_INLINE float4_t float4_add(float4_t _a, float4_t _b)
  232. {
  233. float4_t result;
  234. result.fxyzw[0] = _a.fxyzw[0] + _b.fxyzw[0];
  235. result.fxyzw[1] = _a.fxyzw[1] + _b.fxyzw[1];
  236. result.fxyzw[2] = _a.fxyzw[2] + _b.fxyzw[2];
  237. result.fxyzw[3] = _a.fxyzw[3] + _b.fxyzw[3];
  238. return result;
  239. }
  240. BX_FLOAT4_INLINE float4_t float4_sub(float4_t _a, float4_t _b)
  241. {
  242. float4_t result;
  243. result.fxyzw[0] = _a.fxyzw[0] - _b.fxyzw[0];
  244. result.fxyzw[1] = _a.fxyzw[1] - _b.fxyzw[1];
  245. result.fxyzw[2] = _a.fxyzw[2] - _b.fxyzw[2];
  246. result.fxyzw[3] = _a.fxyzw[3] - _b.fxyzw[3];
  247. return result;
  248. }
  249. BX_FLOAT4_INLINE float4_t float4_mul(float4_t _a, float4_t _b)
  250. {
  251. float4_t result;
  252. result.fxyzw[0] = _a.fxyzw[0] * _b.fxyzw[0];
  253. result.fxyzw[1] = _a.fxyzw[1] * _b.fxyzw[1];
  254. result.fxyzw[2] = _a.fxyzw[2] * _b.fxyzw[2];
  255. result.fxyzw[3] = _a.fxyzw[3] * _b.fxyzw[3];
  256. return result;
  257. }
  258. BX_FLOAT4_INLINE float4_t float4_div(float4_t _a, float4_t _b)
  259. {
  260. float4_t result;
  261. result.fxyzw[0] = _a.fxyzw[0] * _b.fxyzw[0];
  262. result.fxyzw[1] = _a.fxyzw[1] * _b.fxyzw[1];
  263. result.fxyzw[2] = _a.fxyzw[2] * _b.fxyzw[2];
  264. result.fxyzw[3] = _a.fxyzw[3] * _b.fxyzw[3];
  265. return result;
  266. }
  267. BX_FLOAT4_INLINE float4_t float4_rcp_est(float4_t _a)
  268. {
  269. float4_t result;
  270. result.fxyzw[0] = 1.0f / _a.fxyzw[0];
  271. result.fxyzw[1] = 1.0f / _a.fxyzw[1];
  272. result.fxyzw[2] = 1.0f / _a.fxyzw[2];
  273. result.fxyzw[3] = 1.0f / _a.fxyzw[3];
  274. return result;
  275. }
  276. BX_FLOAT4_INLINE float4_t float4_sqrt(float4_t _a)
  277. {
  278. float4_t result;
  279. result.fxyzw[0] = sqrtf(_a.fxyzw[0]);
  280. result.fxyzw[1] = sqrtf(_a.fxyzw[1]);
  281. result.fxyzw[2] = sqrtf(_a.fxyzw[2]);
  282. result.fxyzw[3] = sqrtf(_a.fxyzw[3]);
  283. return result;
  284. }
  285. BX_FLOAT4_INLINE float4_t float4_rsqrt_est(float4_t _a)
  286. {
  287. float4_t result;
  288. result.fxyzw[0] = 1.0f / sqrtf(_a.fxyzw[0]);
  289. result.fxyzw[1] = 1.0f / sqrtf(_a.fxyzw[1]);
  290. result.fxyzw[2] = 1.0f / sqrtf(_a.fxyzw[2]);
  291. result.fxyzw[3] = 1.0f / sqrtf(_a.fxyzw[3]);
  292. return result;
  293. }
  294. BX_FLOAT4_INLINE float4_t float4_cmpeq(float4_t _a, float4_t _b)
  295. {
  296. float4_t result;
  297. result.ixyzw[0] = _a.fxyzw[0] == _b.fxyzw[0] ? 0xffffffff : 0x0;
  298. result.ixyzw[1] = _a.fxyzw[1] == _b.fxyzw[1] ? 0xffffffff : 0x0;
  299. result.ixyzw[2] = _a.fxyzw[2] == _b.fxyzw[2] ? 0xffffffff : 0x0;
  300. result.ixyzw[3] = _a.fxyzw[3] == _b.fxyzw[3] ? 0xffffffff : 0x0;
  301. return result;
  302. }
  303. BX_FLOAT4_INLINE float4_t float4_cmplt(float4_t _a, float4_t _b)
  304. {
  305. float4_t result;
  306. result.ixyzw[0] = _a.fxyzw[0] < _b.fxyzw[0] ? 0xffffffff : 0x0;
  307. result.ixyzw[1] = _a.fxyzw[1] < _b.fxyzw[1] ? 0xffffffff : 0x0;
  308. result.ixyzw[2] = _a.fxyzw[2] < _b.fxyzw[2] ? 0xffffffff : 0x0;
  309. result.ixyzw[3] = _a.fxyzw[3] < _b.fxyzw[3] ? 0xffffffff : 0x0;
  310. return result;
  311. }
  312. BX_FLOAT4_INLINE float4_t float4_cmple(float4_t _a, float4_t _b)
  313. {
  314. float4_t result;
  315. result.ixyzw[0] = _a.fxyzw[0] <= _b.fxyzw[0] ? 0xffffffff : 0x0;
  316. result.ixyzw[1] = _a.fxyzw[1] <= _b.fxyzw[1] ? 0xffffffff : 0x0;
  317. result.ixyzw[2] = _a.fxyzw[2] <= _b.fxyzw[2] ? 0xffffffff : 0x0;
  318. result.ixyzw[3] = _a.fxyzw[3] <= _b.fxyzw[3] ? 0xffffffff : 0x0;
  319. return result;
  320. }
  321. BX_FLOAT4_INLINE float4_t float4_cmpgt(float4_t _a, float4_t _b)
  322. {
  323. float4_t result;
  324. result.ixyzw[0] = _a.fxyzw[0] > _b.fxyzw[0] ? 0xffffffff : 0x0;
  325. result.ixyzw[1] = _a.fxyzw[1] > _b.fxyzw[1] ? 0xffffffff : 0x0;
  326. result.ixyzw[2] = _a.fxyzw[2] > _b.fxyzw[2] ? 0xffffffff : 0x0;
  327. result.ixyzw[3] = _a.fxyzw[3] > _b.fxyzw[3] ? 0xffffffff : 0x0;
  328. return result;
  329. }
  330. BX_FLOAT4_INLINE float4_t float4_cmpge(float4_t _a, float4_t _b)
  331. {
  332. float4_t result;
  333. result.ixyzw[0] = _a.fxyzw[0] >= _b.fxyzw[0] ? 0xffffffff : 0x0;
  334. result.ixyzw[1] = _a.fxyzw[1] >= _b.fxyzw[1] ? 0xffffffff : 0x0;
  335. result.ixyzw[2] = _a.fxyzw[2] >= _b.fxyzw[2] ? 0xffffffff : 0x0;
  336. result.ixyzw[3] = _a.fxyzw[3] >= _b.fxyzw[3] ? 0xffffffff : 0x0;
  337. return result;
  338. }
  339. BX_FLOAT4_INLINE float4_t float4_min(float4_t _a, float4_t _b)
  340. {
  341. float4_t result;
  342. result.fxyzw[0] = _a.fxyzw[0] < _b.fxyzw[0] ? _a.fxyzw[0] : _b.fxyzw[0];
  343. result.fxyzw[1] = _a.fxyzw[1] < _b.fxyzw[1] ? _a.fxyzw[1] : _b.fxyzw[1];
  344. result.fxyzw[2] = _a.fxyzw[2] < _b.fxyzw[2] ? _a.fxyzw[2] : _b.fxyzw[2];
  345. result.fxyzw[3] = _a.fxyzw[3] < _b.fxyzw[3] ? _a.fxyzw[3] : _b.fxyzw[3];
  346. return result;
  347. }
  348. BX_FLOAT4_INLINE float4_t float4_max(float4_t _a, float4_t _b)
  349. {
  350. float4_t result;
  351. result.fxyzw[0] = _a.fxyzw[0] > _b.fxyzw[0] ? _a.fxyzw[0] : _b.fxyzw[0];
  352. result.fxyzw[1] = _a.fxyzw[1] > _b.fxyzw[1] ? _a.fxyzw[1] : _b.fxyzw[1];
  353. result.fxyzw[2] = _a.fxyzw[2] > _b.fxyzw[2] ? _a.fxyzw[2] : _b.fxyzw[2];
  354. result.fxyzw[3] = _a.fxyzw[3] > _b.fxyzw[3] ? _a.fxyzw[3] : _b.fxyzw[3];
  355. return result;
  356. }
  357. BX_FLOAT4_INLINE float4_t float4_and(float4_t _a, float4_t _b)
  358. {
  359. float4_t result;
  360. result.uxyzw[0] = _a.uxyzw[0] & _b.uxyzw[0];
  361. result.uxyzw[1] = _a.uxyzw[1] & _b.uxyzw[1];
  362. result.uxyzw[2] = _a.uxyzw[2] & _b.uxyzw[2];
  363. result.uxyzw[3] = _a.uxyzw[3] & _b.uxyzw[3];
  364. return result;
  365. }
  366. BX_FLOAT4_INLINE float4_t float4_andc(float4_t _a, float4_t _b)
  367. {
  368. float4_t result;
  369. result.uxyzw[0] = _a.uxyzw[0] & ~_b.uxyzw[0];
  370. result.uxyzw[1] = _a.uxyzw[1] & ~_b.uxyzw[1];
  371. result.uxyzw[2] = _a.uxyzw[2] & ~_b.uxyzw[2];
  372. result.uxyzw[3] = _a.uxyzw[3] & ~_b.uxyzw[3];
  373. return result;
  374. }
  375. BX_FLOAT4_INLINE float4_t float4_or(float4_t _a, float4_t _b)
  376. {
  377. float4_t result;
  378. result.uxyzw[0] = _a.uxyzw[0] | _b.uxyzw[0];
  379. result.uxyzw[1] = _a.uxyzw[1] | _b.uxyzw[1];
  380. result.uxyzw[2] = _a.uxyzw[2] | _b.uxyzw[2];
  381. result.uxyzw[3] = _a.uxyzw[3] | _b.uxyzw[3];
  382. return result;
  383. }
  384. BX_FLOAT4_INLINE float4_t float4_xor(float4_t _a, float4_t _b)
  385. {
  386. float4_t result;
  387. result.uxyzw[0] = _a.uxyzw[0] ^ _b.uxyzw[0];
  388. result.uxyzw[1] = _a.uxyzw[1] ^ _b.uxyzw[1];
  389. result.uxyzw[2] = _a.uxyzw[2] ^ _b.uxyzw[2];
  390. result.uxyzw[3] = _a.uxyzw[3] ^ _b.uxyzw[3];
  391. return result;
  392. }
  393. BX_FLOAT4_INLINE float4_t float4_sll(float4_t _a, int _count)
  394. {
  395. float4_t result;
  396. result.uxyzw[0] = _a.uxyzw[0] << _count;
  397. result.uxyzw[1] = _a.uxyzw[1] << _count;
  398. result.uxyzw[2] = _a.uxyzw[2] << _count;
  399. result.uxyzw[3] = _a.uxyzw[3] << _count;
  400. return result;
  401. }
  402. BX_FLOAT4_INLINE float4_t float4_srl(float4_t _a, int _count)
  403. {
  404. float4_t result;
  405. result.uxyzw[0] = _a.uxyzw[0] >> _count;
  406. result.uxyzw[1] = _a.uxyzw[1] >> _count;
  407. result.uxyzw[2] = _a.uxyzw[2] >> _count;
  408. result.uxyzw[3] = _a.uxyzw[3] >> _count;
  409. return result;
  410. }
  411. BX_FLOAT4_INLINE float4_t float4_sra(float4_t _a, int _count)
  412. {
  413. float4_t result;
  414. result.ixyzw[0] = _a.ixyzw[0] >> _count;
  415. result.ixyzw[1] = _a.ixyzw[1] >> _count;
  416. result.ixyzw[2] = _a.ixyzw[2] >> _count;
  417. result.ixyzw[3] = _a.ixyzw[3] >> _count;
  418. return result;
  419. }
  420. BX_FLOAT4_INLINE float4_t float4_iadd(float4_t _a, float4_t _b)
  421. {
  422. float4_t result;
  423. result.ixyzw[0] = _a.ixyzw[0] + _b.ixyzw[0];
  424. result.ixyzw[1] = _a.ixyzw[1] + _b.ixyzw[1];
  425. result.ixyzw[2] = _a.ixyzw[2] + _b.ixyzw[2];
  426. result.ixyzw[3] = _a.ixyzw[3] + _b.ixyzw[3];
  427. return result;
  428. }
  429. BX_FLOAT4_INLINE float4_t float4_isub(float4_t _a, float4_t _b)
  430. {
  431. float4_t result;
  432. result.ixyzw[0] = _a.ixyzw[0] - _b.ixyzw[0];
  433. result.ixyzw[1] = _a.ixyzw[1] - _b.ixyzw[1];
  434. result.ixyzw[2] = _a.ixyzw[2] - _b.ixyzw[2];
  435. result.ixyzw[3] = _a.ixyzw[3] - _b.ixyzw[3];
  436. return result;
  437. }
  438. } // namespace bx
  439. #define float4_shuf_xAzC float4_shuf_xAzC_ni
  440. #define float4_shuf_yBwD float4_shuf_yBwD_ni
  441. #define float4_rcp float4_rcp_ni
  442. #define float4_orx float4_orx_ni
  443. #define float4_orc float4_orc_ni
  444. #define float4_neg float4_neg_ni
  445. #define float4_madd float4_madd_ni
  446. #define float4_nmsub float4_nmsub_ni
  447. #define float4_div_nr float4_div_nr_ni
  448. #define float4_selb float4_selb_ni
  449. #define float4_sels float4_sels_ni
  450. #define float4_not float4_not_ni
  451. #define float4_abs float4_abs_ni
  452. #define float4_clamp float4_clamp_ni
  453. #define float4_lerp float4_lerp_ni
  454. #define float4_rsqrt float4_rsqrt_ni
  455. #define float4_rsqrt_nr float4_rsqrt_nr_ni
  456. #define float4_rsqrt_carmack float4_rsqrt_carmack_ni
  457. #define float4_sqrt_nr float4_sqrt_nr_ni
  458. #define float4_log2 float4_log2_ni
  459. #define float4_exp2 float4_exp2_ni
  460. #define float4_pow float4_pow_ni
  461. #define float4_cross3 float4_cross3_ni
  462. #define float4_normalize3 float4_normalize3_ni
  463. #define float4_dot3 float4_dot3_ni
  464. #define float4_dot float4_dot_ni
  465. #define float4_ceil float4_ceil_ni
  466. #define float4_floor float4_floor_ni
  467. #include "float4_ni.h"
  468. #endif // __BX_FLOAT4_REF_H__