Wireshark-dev: Re: [Wireshark-dev] SIMD optimizations with CMake
From: Anders Broman <anders.broman@xxxxxxxxxxxx>
Date: Thu, 12 Jun 2014 14:29:35 +0000
Hi,
There is a discussion about it in the tread with subject "Re: [Wireshark-dev] How to define HAVE_SSE42 with autotools?"
I'm not sure the current status is entirely correct but it works for me :-) and does not break the build boots.

I.e. it should be refined...

>a) Is this correct?
Your interpretation - I think so, the way its implemented as per above probably not.

>b) Is there any check whether the compiler actually supports these flags?
Yes it should be in the macros

>c) Are there any provisions for cross-compiling?
No - no idea what that entails...

Regards
Anders

-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Joerg Mayer
Sent: den 12 juni 2014 16:20
To: wireshark-dev@xxxxxxxxxxxxx
Subject: [Wireshark-dev] SIMD optimizations with CMake

Hi,

I'm planning to add the SIMD optimization that was recently added to autofoo to cmake as well. The current solution looks a bit weird to me, so maybe I have read the existing code incorrectly or misunderstood the ideas behind the current solution:

Current situation:
- Runtime: If the code has been compiled with SSE support then there is a
  runtime check whether the current cpu supports the optimizations. If not,
  a non-sse code path is taken.
- Compile time: The C-compiler in wsutil/ is told to use the optimization
  flags discovered at configuration time. HAVE_SSE4_2 is the only flag curently
  used in the following files: ws_mempbrk.h and ./ws_mempbrk_sse42.c whether
  to enable the code or not.
- Configuration time: The aclocal-fallback/ax_XXX.m4 files check whether the
  *current host cpu* supports theses extensions and sets the HAVE_xxx and
  SIMD_FLAGS (which then get added to ws_util/-CLFAGS) variables accodingly.

Questions:
a) Is this correct?
b) Is there any check whether the compiler actually supports these flags?
c) Are there any provisions for cross-compiling?

Cmake only needs to redo the configuration time stuff, so I looked at it and didn't understand the design. What I intend to do is to just test whether the current compiler supports the extensions via adding the following flags to
WIRESHARK_C_FLAGS: -faltivec, -mmmx, -msse, -msse2, -msse3, -mssse3, -msse4.1, -msse4.2, -mavx and then creating the necessary HAVE_xxx variables.
Is there a good reason not to take this path (note: I have a cpu that only supports sse_4.1 so I can only do limited testing).

Thanks
   Jörg
-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that works. Some say that should read Microsoft instead of technology.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe