Renaming methods
To ease the naming we put the sse methods the same as the sse instructions it uses.
This commit is contained in:
parent
3806e6d47e
commit
60d069924d
4 changed files with 9 additions and 7 deletions
|
@ -2,7 +2,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
//X86 Assembly to add two 128 bit numbers in the form of packed integers 32bit
|
//X86 Assembly to add two 128 bit numbers in the form of packed integers 32bit
|
||||||
void Core::Cpu::SSE::sum_128(UInt *a,UInt *b) {
|
void Core::Cpu::SSE::paddw(UInt *a,UInt *b) {
|
||||||
asm(
|
asm(
|
||||||
"movdqa %0, %%xmm1\n"
|
"movdqa %0, %%xmm1\n"
|
||||||
"paddw %1, %%xmm1\n"
|
"paddw %1, %%xmm1\n"
|
||||||
|
@ -14,7 +14,7 @@ void Core::Cpu::SSE::sum_128(UInt *a,UInt *b) {
|
||||||
|
|
||||||
|
|
||||||
//X86 Assembly to add two 128 bit numbers in the form of packed long 64bit
|
//X86 Assembly to add two 128 bit numbers in the form of packed long 64bit
|
||||||
void Core::Cpu::SSE::sum_128(ULong *a,ULong *b) {
|
void Core::Cpu::SSE::paddd(ULong *a,ULong *b) {
|
||||||
asm(
|
asm(
|
||||||
"movdqa %0, %%xmm1\n"
|
"movdqa %0, %%xmm1\n"
|
||||||
"paddd %1, %%xmm1\n"
|
"paddd %1, %%xmm1\n"
|
||||||
|
|
|
@ -11,8 +11,8 @@ namespace Core {
|
||||||
namespace Cpu {
|
namespace Cpu {
|
||||||
class SSE {
|
class SSE {
|
||||||
public:
|
public:
|
||||||
static void sum_128(UInt *a,UInt *b);
|
static void paddw(UInt *a,UInt *b);
|
||||||
static void sum_128(ULong *a,ULong *b);
|
static void paddd(ULong *a,ULong *b);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Core {
|
||||||
cout << ",";
|
cout << ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cout << std << endl;
|
cout << std::dec << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
6
sse.cpp
6
sse.cpp
|
@ -28,6 +28,8 @@ int main(int argc, char** argcv){
|
||||||
Utils::int128BitToLong(v1_128,v1_128_l);
|
Utils::int128BitToLong(v1_128,v1_128_l);
|
||||||
Utils::int128BitToLong(v2_128,v2_128_l);
|
Utils::int128BitToLong(v2_128,v2_128_l);
|
||||||
|
|
||||||
|
SSE::paddw(v1_128,v2_128);
|
||||||
|
|
||||||
long int start,end;
|
long int start,end;
|
||||||
|
|
||||||
Utils::printHex(v1_128,Utils::INT_LEN_128);
|
Utils::printHex(v1_128,Utils::INT_LEN_128);
|
||||||
|
@ -45,14 +47,14 @@ int main(int argc, char** argcv){
|
||||||
|
|
||||||
start = gettime();
|
start = gettime();
|
||||||
for(int i=0;i<MAX_ITER;i++){
|
for(int i=0;i<MAX_ITER;i++){
|
||||||
SSE::sum_128(v1_128,v2_128);
|
SSE::paddw(v1_128,v2_128);
|
||||||
}
|
}
|
||||||
end = gettime();
|
end = gettime();
|
||||||
cout << "SSE Approach paddw: " << end-start << endl;
|
cout << "SSE Approach paddw: " << end-start << endl;
|
||||||
|
|
||||||
start = gettime();
|
start = gettime();
|
||||||
for(int i=0;i<MAX_ITER;i++){
|
for(int i=0;i<MAX_ITER;i++){
|
||||||
SSE::sum_128(v1_128_l,v2_128_l);
|
SSE::paddd(v1_128_l,v2_128_l);
|
||||||
}
|
}
|
||||||
end = gettime();
|
end = gettime();
|
||||||
cout << "SSE Approach paddd: " << end-start << endl;
|
cout << "SSE Approach paddd: " << end-start << endl;
|
||||||
|
|
Loading…
Reference in a new issue