1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

アセンブラAdvent Calendar 2018

Day 19

paizaでインラインアセンブラ

Last updated at Posted at 2018-09-21

#概要
x64で、インラインアセンブラやってみた。

#サンプルコード

足し算。

#include <stdio.h>

int test(int a, int b)
{
    int ret = 0;
    __asm__ volatile ("add %1, %2; mov %2, %0;" : "=r" (ret) : "r" (a), "r" (b) : );  
    return ret;
}
int main(void)
{
    int a = 100;
    int b = 200;
    printf ("%d", test(a, b));
}


#成果物

以上。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?