{"action":"closed","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/17885","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/17885/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/17885/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/17885/events","html_url":"https://github.com/rust-lang/rust/issues/17885","id":45354781,"number":17885,"title":"asm!: constraints to select specific registers are undocumented","user":{"login":"nodakai","id":90726,"avatar_url":"https://avatars.githubusercontent.com/u/90726?v=3","gravatar_id":"","url":"https://api.github.com/users/nodakai","html_url":"https://github.com/nodakai","followers_url":"https://api.github.com/users/nodakai/followers","following_url":"https://api.github.com/users/nodakai/following{/other_user}","gists_url":"https://api.github.com/users/nodakai/gists{/gist_id}","starred_url":"https://api.github.com/users/nodakai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodakai/subscriptions","organizations_url":"https://api.github.com/users/nodakai/orgs","repos_url":"https://api.github.com/users/nodakai/repos","events_url":"https://api.github.com/users/nodakai/events{/privacy}","received_events_url":"https://api.github.com/users/nodakai/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-inline-assembly","name":"A-inline-assembly","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-10-09T11:24:52Z","updated_at":"2015-09-28T18:07:42Z","closed_at":"2015-09-28T18:07:42Z","body":"None of the \"a\" -- \"d\" constraints (to use the `eax` -- `edx` registers) works as expected.\r\n\r\n```rust\r\n#![feature(asm)]\r\n\r\nfn main() {\r\n    let x: u32;\r\n    unsafe {\r\n        asm!( \"xor $0, $0\" : \"=r\"(x) );\r\n//      asm!( \"xor $0, $0\" : \"=a\"(x) );\r\n    };\r\n    println!(\"{}\", x);\r\n}\r\n```\r\n\r\nIf I enable the commented-out line, I get:\r\n\r\n```\r\nerror: couldn't allocate output register for constraint 'a' at line 20\r\n```\r\n\r\nBut Clang/LLVM 3.0 (Ubuntu 12.04 package) understands them:\r\n\r\n```c\r\nint main(void) {\r\n    int x;\r\n    __asm__ __volatile__ ( \"xor %0, %0\" : \"=a\"(x) );\r\n    __asm__ __volatile__ ( \"xor %0, %0\" : \"=b\"(x) );\r\n    __asm__ __volatile__ ( \"xor %0, %0\" : \"=c\"(x) );\r\n    __asm__ __volatile__ ( \"xor %0, %0\" : \"=d\"(x) );\r\n    return 0;\r\n}\r\n```\r\n\r\n```\r\n00000000004004c0 <main>:\r\n  4004c0:       53                      push   %rbx\r\n  4004c1:       31 c0                   xor    %eax,%eax\r\n  4004c3:       31 db                   xor    %ebx,%ebx\r\n  4004c5:       31 c9                   xor    %ecx,%ecx\r\n  4004c7:       31 d2                   xor    %edx,%edx\r\n  4004c9:       31 c0                   xor    %eax,%eax\r\n  4004cb:       5b                      pop    %rbx\r\n  4004cc:       c3                      retq   \r\n  4004cd:       90                      nop\r\n  4004ce:       90                      nop\r\n  4004cf:       90                      nop\r\n```\r\n"}}