Author Topic: C++: SSE2 and NODEFAULTLIB  (Read 4019 times)

0 Members and 1 Guest are viewing this topic.

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
C++: SSE2 and NODEFAULTLIB
« on: August 02, 2012 »
Does anyone know if it's possible to use SSE2 extensions when using the NODEFAULTLIB flag? I'm just wondering if theres some neat workaround that will give me the speed advantage with minimal code size increase. Any suggestions would be great, thanks.
raizor

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: C++: SSE2 and NODEFAULTLIB
« Reply #1 on: August 02, 2012 »
I don't see why not.  The SSE compiler flags generate SSE instructions not function calls to libraries, as do the intrinsics.  You might need to code a few libraries of your own to fix link problems, e.g. long->float and float->long.  Depends on compile flags/VC version.

Jim
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: C++: SSE2 and NODEFAULTLIB
« Reply #2 on: August 03, 2012 »
When you enable sse code generation, VC tries to auto-vectorize (and it's not very good at it).
This ends up in two possible situations:
- It computes intermediate values in parallel,producing a single output value
- It computes four output values in parallel
The latter produces quite a bit of code-size overhead because it has to handle the non-multiple-of-4 cases.
« Last Edit: August 03, 2012 by hellfire »
Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: C++: SSE2 and NODEFAULTLIB
« Reply #3 on: August 03, 2012 »
Thanks guys, I've managed to get it working quite nicely and code size doesn't seem to have been affected too much. K++
raizor

Challenge Trophies Won: