Refactoring

This commit is contained in:
balhau@balhau.net 2021-12-26 11:45:29 +00:00
parent c5917b2e1a
commit 98e52f2579
No known key found for this signature in database
GPG key ID: 1E666F326A121830
2 changed files with 8 additions and 6 deletions

View file

@ -5,7 +5,7 @@
#include <iostream>
void cpu::SSE::add_128(UChar *a,UChar *b){
asm volatile (
asmv(
"movdqa %0,%%xmm1\n"
"paddb %1,%%xmm1\n"
"movdqa %%xmm1,%0"
@ -16,7 +16,7 @@
//X86 Assembly to add two 128 bit numbers in the form of packed integers 32bit
void cpu::SSE::add_128(UInt *a,UInt *b) {
asm volatile (
asmv(
"movdqa %0,%%xmm1\n"
"paddw %1,%%xmm1\n"
"movdqa %%xmm1, %0"
@ -28,7 +28,7 @@
//X86 Assembly to add two 128 bit numbers in the form of packed long 64bit
void cpu::SSE::add_128(ULong *a,ULong *b) {
asm volatile (
asmv(
"movdqa %0,%%xmm1\n"
"paddd %1,%%xmm1\n"
"movdqa %%xmm1, %0"
@ -39,7 +39,7 @@
//X86 Assembly to add two 256 bit numbers in the form of packed byte vector
void cpu::SSE::add_256(UChar *a,UChar *b) {
asm volatile (
asmv(
"vmovdqu %0,%%ymm1\n"
"vmovdqu %1,%%ymm2\n"
"vpaddb %%ymm3,%%ymm2,%%ymm1\n"
@ -51,7 +51,7 @@
//X86 Assembly to add two 256 bit numbers in the form of packed int 32bit
void cpu::SSE::add_256(UInt *a,UInt *b) {
asm volatile(
asmv(
"vmovdqu %0,%%ymm1\n"
"vmovdqu %1,%%ymm2\n"
"vpaddw %%ymm1, %%ymm2, %%ymm1\n"
@ -64,7 +64,7 @@
//X86 Assembly to add two 256 bit numbers in the form of packed long 64bit
//Here we are using vmovdqu instead of vmovdqa because memory is not aligned.
void cpu::SSE::add_256(ULong *a,ULong *b) {
asm volatile(
asmv(
"vmovdqu %0, %%ymm1\n"
"vmovdqu %1, %%ymm2\n"
"vpaddd %%ymm1,%%ymm2,%%ymm1\n"

View file

@ -17,3 +17,5 @@
#define ARCH_X86
#endif
//Redefine asm volatile as asmv to make inline assembly less verbose
#define asmv asm volatile