{"action":"opened","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/2714","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/2714/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/2714/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/2714/events","html_url":"https://github.com/dotnet/coreclr/issues/2714","id":127185522,"number":2714,"title":"RyuJIT could use mov reg32, reg32 to cast from uint to ulong","user":{"login":"mikedn","id":9973420,"avatar_url":"https://avatars.githubusercontent.com/u/9973420?v=3","gravatar_id":"","url":"https://api.github.com/users/mikedn","html_url":"https://github.com/mikedn","followers_url":"https://api.github.com/users/mikedn/followers","following_url":"https://api.github.com/users/mikedn/following{/other_user}","gists_url":"https://api.github.com/users/mikedn/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedn/subscriptions","organizations_url":"https://api.github.com/users/mikedn/orgs","repos_url":"https://api.github.com/users/mikedn/repos","events_url":"https://api.github.com/users/mikedn/events{/privacy}","received_events_url":"https://api.github.com/users/mikedn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-18T09:28:00Z","updated_at":"2016-01-18T09:28:00Z","closed_at":null,"body":"Casts from `uint` to `ulong` are implemented with `and reg32, 0xffffffff`:\r\n```C#\r\nclass Program {\r\n    static ulong ul;\r\n    static void Main(string[] args) {\r\n        ul = (ulong)(uint)args.Length + 42;\r\n    }\r\n}\r\n```\r\ngenerates\r\n```\r\nG_M44928_IG02:\r\n       8B4108               mov      eax, dword ptr [rcx+8]\r\n       25FFFFFFFF           and      eax, 0xFFFFFFFF\r\n       4883C002             add      rax, 2\r\n       488905DD49EAFF       mov      qword ptr [reloc classVar[0xffa25008]], rax\r\n```\r\nA shorter/faster `mov eax, eax` could be used instead.\r\n\r\nOf course, no cast is actually needed because it was already done by the previous `mov`. But that's likely more complicated to detect and optimize."}}