Results 1 to 4 of 4

Thread: [RESOLVED] How to use SSE2 do ar1 porduct ar2

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2017
    Posts
    236

    Resolved [RESOLVED] How to use SSE2 do ar1 porduct ar2

    hi~ all

    (1) please tell me how to use VisualStudio SSE2 vectors for the following code


    (2) whether there are any wrap lib like directxmath can be easy used ???

    thank you!


    Code:
    double __stdcall sum_ar1_dot_ar2(double *ar1, double *ar2 ,long lb , long ub ) {
    
    	double sum = 0;
    	for (long w = lb; w <= ub; w++)
    	{
     		sum += ar1[w] * ar2[w];
    	}
    	return sum;
    }
    Last edited by quickbbbb; Dec 4th, 2021 at 06:27 AM.

  2. #2

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2017
    Posts
    236

    Re: How to use SSE2 do ar1 porduct ar2

    Quote Originally Posted by wqweto View Post
    You should probably just compile this exact code with /arch:sse2 and peek at disassembly.

    Here is a similar question at SO: Dot Product of Vectors with SIMD

    cheers,
    </wqw>
    OK
    Thank You !

  4. #4
    Fanatic Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    996

    Re: [RESOLVED] How to use SSE2 do ar1 porduct ar2

    For VS, have a look at Properties/c++/Code Generation/Enable Enhanced Instruction Set. This allows usage of SSE(2) and AVX(2) instructions if the CPU supports them.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width