Skip to content

Instantly share code, notes, and snippets.

@febnug
Last active August 21, 2021 08:08
Show Gist options
  • Save febnug/ef36b1836117fc613f539f5ae4b1006c to your computer and use it in GitHub Desktop.
Save febnug/ef36b1836117fc613f539f5ae4b1006c to your computer and use it in GitHub Desktop.
// (c) 2021 - Febriyanto Nugroho
// compile dengan : gcc -o sqrt-SSE sqrt-SSE.c -masm=intel
#include <stdio.h>
int main(void) {
int nilai = 5;
__asm__ __volatile__("cvtsi2sd xmm0, ebx\n"
"sqrtsd xmm0, xmm0\n"
"cvttsd2si ebx, xmm0\n"
: "=b"(nilai) // ebx itu input
: "b"(nilai) // output ebx
);
printf("%d\n", nilai);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment