Click here to Skip to main content
16,017,881 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my cpp code is as bellow:

C++
vector<int64_t> negative(vector<int64_t> elems){
   vector<int64_t> results;
   for (auto &elem : elems){
       int64_t temp = 255 - elem > 0 ? 255 - elem : 0 ;
       results.push_back(temp);
   }
    return results;
}


I want to use SSE instead of looping over each element. how can I do that?

What I have tried:

I tried to do as bellow but I still loop over element and couldn't use SSE.

for (int64_t elem : elems)
{
    cout << "first: " << elem << endl;
    asm (
        "sub  $255, %[in1];"
        "neg %[out]"
        : [out] "=r" (elem), [sse] "=x" (elems)
        : [in1] "r" (elem)
    );
    cout << "second: " << elem << endl;
    results.push_back(elem);
}
Posted
Updated 14-Sep-22 14:38pm

1 solution

I can't help you but this article might : Generating Fractals with SSE/SSE2[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900