{"id":6359,"date":"2017-02-21T23:40:53","date_gmt":"2017-02-21T14:40:53","guid":{"rendered":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6359"},"modified":"2017-02-21T23:40:53","modified_gmt":"2017-02-21T14:40:53","slug":"clang-%e3%81%ae%e3%82%a4%e3%83%b3%e3%83%a9%e3%82%a4%e3%83%b3%e3%82%a2%e3%82%bb%e3%83%b3%e3%83%96%e3%83%a9%e3%81%a7-intel-%e8%a8%98%e6%b3%95%e3%82%92%e4%bd%bf%e3%81%86-%ef%bc%88%e3%81%9d%e3%81%ae-2","status":"publish","type":"post","link":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6359","title":{"rendered":"Clang \u306e\u30a4\u30f3\u30e9\u30a4\u30f3\u30a2\u30bb\u30f3\u30d6\u30e9\u3067 Intel \u8a18\u6cd5\u3092\u4f7f\u3046 \uff08\u305d\u306e\uff13\uff09"},"content":{"rendered":"<p><a href=\"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6340\">\u305d\u306e\uff12<\/a>\u306e\u7d9a\u304d<\/p>\n<p>Intel \u8a18\u6cd5\u3068 Input Operand \uff08\u306e\u4e00\u90e8\u306e\u5236\u7d04\uff09\u306f\u4f75\u7528\u3067\u304d\u306a\u3044\u308f\u3051\u3067\u3059\u304c\u3001\u624b\u6301\u3061\u306e\u30bd\u30fc\u30b9\u3092 AT&amp;T \u8a18\u6cd5\u306b\u5909\u63db\u3059\u308b\u306e\u3082\uff81\uff6e\uff70\u5927\u5909\u306a\u306e\u3067\u5225\u306e\u65b9\u6cd5\u3092\u3002<\/p>\n<p><!--more--><\/p>\n<p>x86 \u306e\u5834\u5408\u3001\u3053\u3046\u3044\u3046\u3082\u306e\u3092\u66f8\u3051\u307e\u3059\u3002<\/p>\n<blockquote>\n<pre>\r\nint foo(int x)\r\n{\r\n        int ret;\r\n        asm volatile(\r\n                \".intel_syntax\\n\"\r\n                \"mov  eax, ecx\\n\"\r\n                : \"=a\"(ret)\r\n                : \"c\"(x) );\r\n        return ret;\r\n}\r\n<\/pre>\n<\/blockquote>\n<p><code>\"c\"(x)<\/code> \u306b\u3088\u3063\u3066 ecx \u306b x \u306e\u5024\u3092\u5165\u308c\u3066\u304b\u3089\u30a4\u30f3\u30e9\u30a4\u30f3\u30a2\u30bb\u30f3\u30d6\u30ea\u30d6\u30ed\u30c3\u30af\u304c\u633f\u5165\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u65b9\u6cd5\u3060\u3068\u3001\u30a4\u30f3\u30e9\u30a4\u30f3\u30a2\u30bb\u30f3\u30d6\u30ea\u30d6\u30ed\u30c3\u30af\u5185\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u5bfe\u3057\u3066\u30aa\u30da\u30e9\u30f3\u30c9\u3092\u57cb\u3081\u8fbc\u3080\u51e6\u7406\u306f\u8d77\u3053\u3089\u306a\u3044\u305f\u3081\u3001Clang \u3067\u3082\u5bfe\u5fdc\u3067\u304d\u307e\u3059\u3002c \u4ee5\u5916\u306b\u3082 a b d S D \u304c\u4f7f\u3048\u308b\u306e\u3067\u3001\u5408\u8a086\u3064\u306e\u30aa\u30da\u30e9\u30f3\u30c9\u3092\u30ec\u30b8\u30b9\u30bf\u3067\u6e21\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u6b8b\u5ff5\u306a\u304c\u3089 ebp \u306f\u4f7f\u3048\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u306e\u65b9\u6cd5\u3092\u53d6\u308b\u5834\u5408\u306e\u6b20\u70b9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>x86 \u306e\u5834\u5408\u30016\u3064\u307e\u3067\u3057\u304b\u6e21\u305b\u306a\u3044\u30027\u3064\u4ee5\u4e0a\u6e21\u3059\u306b\u306f\u4e00\u65e6\u914d\u5217\u306b\u66f8\u3044\u3066\u304a\u3044\u3066\u3001\u30a2\u30c9\u30ec\u30b9\u3092\u30ec\u30b8\u30b9\u30bf\u6e21\u3057\u3059\u308b\u3068\u3044\u3063\u305f\u5de5\u592b\u304c\u5fc5\u8981\u3002<\/li>\n<li>x64 \u306e\u5834\u5408\u3001\u30ec\u30b8\u30b9\u30bf\u306f\u305f\u304f\u3055\u3093\u3042\u308b\u306e\u306714\u500b\u307e\u3067\u6e21\u305b\u308b\u304c\u3001r8 \u4ee5\u964d\u3092\u4f7f\u3046\u5834\u5408\u306f Input Operands \u306f\u4f7f\u3048\u305a\u3001<a href=\"https:\/\/gcc.gnu.org\/onlinedocs\/gcc\/Explicit-Register-Variables.html\">explicit register variable<\/a> \u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308b\uff08\u66f8\u304d\u65b9\u304c\u9055\u3063\u3066\u304f\u308b\uff09<\/li>\n<li>\u30a2\u30bb\u30f3\u30d6\u30ea\u30d6\u30ed\u30c3\u30af\u306e\u5148\u982d\u3067\u306f\u4e0d\u8981\u3060\u3051\u3069\u9014\u4e2d\u3067\u5fc5\u8981\u306b\u306a\u3063\u3066\u304f\u308b\u30e1\u30e2\u30ea\u30aa\u30da\u30e9\u30f3\u30c9\u3092\u6271\u3048\u306a\u3044\u3002\u30ec\u30b8\u30b9\u30bf\u3067\u53d7\u3051\u53d6\u3063\u3066 push \u3057\u3066\u7f6e\u3044\u3066\u304a\u304f\u3001\u3068\u3044\u3063\u305f\u5de5\u592b\u304c\u5fc5\u8981<\/li>\n<\/ul>\n<p>\u601d\u3063\u305f\u3088\u308a\u5927\u5909\u3058\u3083\u306a\u304b\u3063\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u305d\u306e\uff12\u306e\u7d9a\u304d Intel \u8a18\u6cd5\u3068 Input Operand \uff08\u306e\u4e00\u90e8\u306e\u5236\u7d04\uff09\u306f\u4f75\u7528\u3067\u304d\u306a\u3044\u308f\u3051\u3067\u3059\u304c\u3001\u624b\u6301\u3061\u306e\u30bd\u30fc\u30b9\u3092 AT&amp;T \u8a18\u6cd5\u306b\u5909\u63db\u3059\u308b\u306e\u3082\uff81\uff6e\uff70\u5927\u5909\u306a\u306e\u3067\u5225\u306e\u65b9\u6cd5\u3092\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-6359","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6359"}],"version-history":[{"count":1,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6359\/revisions"}],"predecessor-version":[{"id":6360,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6359\/revisions\/6360"}],"wp:attachment":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6359"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}