Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. fabs with SSE

fabs with SSE

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 9 Offline
    9 Offline
    9ine
    wrote on last edited by
    #1

    How to encode fabs with SSE assuming 4 floating points are already in __m128 register? It is better to use SSE2 or 3 but alternatives for latest SSE will be also acknowledged

    9ine

    C O 2 Replies Last reply
    0
    • 9 9ine

      How to encode fabs with SSE assuming 4 floating points are already in __m128 register? It is better to use SSE2 or 3 but alternatives for latest SSE will be also acknowledged

      9ine

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      see here: http://www.songho.ca/misc/sse/sse.html[^]

      image processing toolkits | batch image processing

      1 Reply Last reply
      0
      • 9 9ine

        How to encode fabs with SSE assuming 4 floating points are already in __m128 register? It is better to use SSE2 or 3 but alternatives for latest SSE will be also acknowledged

        9ine

        O Offline
        O Offline
        Ozer Karaagac
        wrote on last edited by
        #3

        Resetting sign bit;

        __declspec(align(16)) float arrFlt[4] = { -10.0, -20.0, -0.0, -3.0 };
        __declspec(align(16)) int mask[4] = { 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff };

        _asm lea eax, arrFlt
        _asm movaps xmm0, xmmword ptr [eax]
        _asm andps xmm0, xmmword ptr mask
        _asm movaps xmmword ptr [eax], xmm0

        Or with intrinsics;

        _mm_store_ps(arrFlt, _mm_and_ps(_mm_load_ps(arrFlt), _mm_load_ps((float*)mask)));

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups