ippcpsgx_disp00418.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "ippcp.h"
  2. #define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg
  3. #ifndef NULL
  4. #ifdef __cplusplus
  5. #define NULL 0
  6. #else
  7. #define NULL ((void *)0)
  8. #endif
  9. #endif
  10. #if defined (_M_AMD64) || defined (__x86_64__)
  11. #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ )
  12. #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER )
  13. IPPAPI(IppStatus, y8_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
  14. IPPAPI(IppStatus, l9_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
  15. IPPFUN(IppStatus,sgx_disp_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
  16. {
  17. Ipp64u features;
  18. ippcpGetCpuFeatures( &features );
  19. if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { /* HasweLl ia32=H9, x64=L9 */
  20. return l9_ippsGFpNeg( pA, pR, pGFp );
  21. } else
  22. if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { /* Nehalem or Westmer = PenrYn + SSE42 + ?CLMUL + ?AES + ?SHA */
  23. return y8_ippsGFpNeg( pA, pR, pGFp );
  24. } else
  25. return ippStsCpuNotSupportedErr;
  26. }
  27. #else
  28. IPPAPI(IppStatus, p8_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
  29. IPPAPI(IppStatus, h9_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
  30. IPPFUN(IppStatus,sgx_disp_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
  31. {
  32. Ipp64u features;
  33. ippcpGetCpuFeatures( &features );
  34. if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { /* HasweLl ia32=H9, x64=L9 */
  35. return h9_ippsGFpNeg( pA, pR, pGFp );
  36. } else
  37. if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { /* Nehalem or Westmer = PenrYn + SSE42 + ?CLMUL + ?AES + ?SHA */
  38. return p8_ippsGFpNeg( pA, pR, pGFp );
  39. } else
  40. return ippStsCpuNotSupportedErr;
  41. }
  42. #endif