Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Support C++ translation units #3

Open
hfp opened this issue Aug 21, 2019 · 4 comments
Open

Support C++ translation units #3

hfp opened this issue Aug 21, 2019 · 4 comments

Comments

@hfp
Copy link

hfp commented Aug 21, 2019

Immintrin-debug is implemented in C which is also desired (given that C code should be able to make use of this project). However, using the Immintrin-debug header file in a C++ translation unit will cause at least compiler errors (as C++ is less permissive). Anyhow, a lot of warnings are also present with C code at higher warning levels (let alone extra and/or pedantic warnings).

How to reproduce:

To translate using a C++ translation unit:

  • cd /path/to/libxsmm; make test-cpp

To compile with a lot of warning flags:

  • C++ translation: cd /path/to/libxsmm; make PEDANTIC=2 test-cpp
  • C89 translation: cd /path/to/libxsmm; make PEDANTIC=2

Immintrin-debug may switch to some more sophisticated function-decoration at least with respect to "static" and "inline" (different meanings in C++ and C; for the latter "inline" for instance was only introduced in C99 and may be emulated prior to this standard).

I understand that not all of the above warnings will be resolved easily (nor they should as effort is not justified). However, it should work with C++ translation units.


Btw, compilers (regardless of C and C++) may or may not allow intrinsics with/without prototype functions plus if prototypes are present they may differ slightly between Intel and GNU intrinsic headers (aka void* vs e.g. float* in some places etc.). For the latter, casts may assume target signature with float* (or stronger type in general) even if say Intel's prototype has void* (assuming the stronger type works with any compiler as type-"promotion" [demotion] to void* is applied automatically and considered safe).

@izard
Copy link
Contributor

izard commented Aug 22, 2019

Thank you for the bug report Hans! The bug report comes in three parts: 1. C++ compile errors. 2. C89 compatibility. 3. Compile warnings at higher warning levels.

  1. C++ compile error is a recent regression I'll fix with the highest priority.
  2. I don't know how to make it C89 compatible while still having it as a .h file only. (Adding .c file and compile step with changes you suggested will fix it of course, but I can't do that now (can discuss offline))
  3. Then will see if/how I can deal with pedantic warnings.

izard added a commit that referenced this issue Aug 27, 2019
@izard
Copy link
Contributor

izard commented Aug 28, 2019

I've committed fixes (type casts) that make it compile for me with c++ icc and gcc (with default warning levels only).

@hfp
Copy link
Author

hfp commented Aug 29, 2019

Thank you!

I found some more missing AVX-512 intrinsics:

  • _mm512_cmp_epi32_mask
  • _mm512_mask_blend_ps
  • _mm512_and_epi32

There are may be more. I will build a more complete list.

@izard
Copy link
Contributor

izard commented Sep 3, 2019

added __mm512_adn, all 512 blends. Can't add cmp - have to add manually as parser does not process TRUE and FALSE cases in switch.

izard added a commit that referenced this issue Sep 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants