{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/76895042","id":76895042,"diff_hunk":"@@ -850,6 +850,88 @@ GenTree* DecomposeLongs::DecomposeArith(LIR::Use& use)\n }\n \n //------------------------------------------------------------------------\n+// DecomposeShift: Decompose GT_LSH, GT_RSH, GT_RSZ. For shift nodes, we need to use\n+// the shift helper functions, so we here convert the shift into a helper call by\n+// pulling its arguments out of linear order and making them the args to a call, then\n+// replacing the original node with the new call.\n+//\n+// Arguments:\n+//    use - the LIR::Use object for the def that needs to be decomposed.\n+//\n+// Return Value:\n+//    The next node to process.\n+//\n+GenTree* DecomposeLongs::DecomposeShift(LIR::Use& use)\n+{\n+    assert(use.IsInitialized());\n+\n+    GenTree* tree   = use.Def();\n+    GenTree* gtLong = tree->gtGetOp1();\n+    genTreeOps oper = tree->OperGet();\n+\n+    assert((oper == GT_LSH) || (oper == GT_RSH) || (oper == GT_RSZ));\n+\n+    unsigned blockWeight = m_block->getBBWeight(m_compiler);\n+\n+    LIR::Use loOp1Use(BlockRange(), &gtLong->gtOp.gtOp1, gtLong);\n+    loOp1Use.ReplaceWithLclVar(m_compiler, blockWeight);\n+\n+    LIR::Use hiOp1Use(BlockRange(), &gtLong->gtOp.gtOp2, gtLong);\n+    hiOp1Use.ReplaceWithLclVar(m_compiler, blockWeight);\n+\n+    LIR::Use shiftWidthUse(BlockRange(), &tree->gtOp.gtOp2, tree);\n+    shiftWidthUse.ReplaceWithLclVar(m_compiler, blockWeight);\n+\n+    GenTree* loOp1 = gtLong->gtGetOp1();\n+    GenTree* hiOp1 = gtLong->gtGetOp2();\n+\n+    GenTree* shiftWidthOp = tree->gtGetOp2();\n+\n+    BlockRange().Remove(gtLong);\n+    BlockRange().Remove(loOp1);\n+    BlockRange().Remove(hiOp1);\n+\n+    BlockRange().Remove(shiftWidthOp);\n+\n+    // TODO-X86-CQ: If the shift operand is a GT_CNS_INT, we should pipe the instructions through to codegen\n+    // and generate the shift instructions ourselves there, rather than replacing it with a helper call.\n+\n+    unsigned helper;\n+\n+    switch (oper)\n+    {\n+        case GT_LSH:\n+            helper = CORINFO_HELP_LLSH;\n+            break;\n+        case GT_RSH:\n+            helper = CORINFO_HELP_LRSH;\n+            break;\n+        case GT_RSZ:\n+            helper = CORINFO_HELP_LRSZ;\n+            break;\n+        default:\n+            unreached();\n+    }\n+\n+    GenTreeArgList* argList = m_compiler->gtNewArgList(loOp1, hiOp1, shiftWidthOp);\n+\n+    GenTree* call = m_compiler->gtNewHelperCallNode(helper, TYP_LONG, 0, argList);\n+\n+    GenTreeCall*    callNode    = call->AsCall();\n+    ReturnTypeDesc* retTypeDesc = callNode->GetReturnTypeDesc();\n+    retTypeDesc->Reset();\n+    retTypeDesc->InitializeLongReturnType(m_compiler);\n+    callNode->ClearOtherRegs();\n+\n+    call = m_compiler->fgMorphArgs(callNode);\n+    BlockRange().InsertAfter(tree, LIR::SeqTree(m_compiler, call));\n+    \n+    BlockRange().Remove(tree);\n+    use.ReplaceWith(m_compiler, call);","path":"src/jit/decomposelongs.cpp","position":90,"original_position":90,"commit_id":"9cf3b6f28ecd886dceee00e193ea76028db3986b","original_commit_id":"9cf3b6f28ecd886dceee00e193ea76028db3986b","user":{"login":"sivarv","id":11184808,"avatar_url":"https://avatars.githubusercontent.com/u/11184808?v=3","gravatar_id":"","url":"https://api.github.com/users/sivarv","html_url":"https://github.com/sivarv","followers_url":"https://api.github.com/users/sivarv/followers","following_url":"https://api.github.com/users/sivarv/following{/other_user}","gists_url":"https://api.github.com/users/sivarv/gists{/gist_id}","starred_url":"https://api.github.com/users/sivarv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sivarv/subscriptions","organizations_url":"https://api.github.com/users/sivarv/orgs","repos_url":"https://api.github.com/users/sivarv/repos","events_url":"https://api.github.com/users/sivarv/events{/privacy}","received_events_url":"https://api.github.com/users/sivarv/received_events","type":"User","site_admin":false},"body":"Thanks.  I have missed to notice that DecomposeNode() is returning the next node to be processed.","created_at":"2016-08-30T22:54:00Z","updated_at":"2016-08-30T22:54:00Z","html_url":"https://github.com/dotnet/coreclr/pull/6988#discussion_r76895042","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/6988","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/76895042"},"html":{"href":"https://github.com/dotnet/coreclr/pull/6988#discussion_r76895042"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/6988"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/6988","id":83339927,"html_url":"https://github.com/dotnet/coreclr/pull/6988","diff_url":"https://github.com/dotnet/coreclr/pull/6988.diff","patch_url":"https://github.com/dotnet/coreclr/pull/6988.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/6988","number":6988,"state":"open","locked":false,"title":"Implement DecomposeShift","user":{"login":"adiaaida","id":9666644,"avatar_url":"https://avatars.githubusercontent.com/u/9666644?v=3","gravatar_id":"","url":"https://api.github.com/users/adiaaida","html_url":"https://github.com/adiaaida","followers_url":"https://api.github.com/users/adiaaida/followers","following_url":"https://api.github.com/users/adiaaida/following{/other_user}","gists_url":"https://api.github.com/users/adiaaida/gists{/gist_id}","starred_url":"https://api.github.com/users/adiaaida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adiaaida/subscriptions","organizations_url":"https://api.github.com/users/adiaaida/orgs","repos_url":"https://api.github.com/users/adiaaida/repos","events_url":"https://api.github.com/users/adiaaida/events{/privacy}","received_events_url":"https://api.github.com/users/adiaaida/received_events","type":"User","site_admin":false},"body":"This change adds support for GT_LSH, GT_RSH, and GT_RSZ for x86 longs.\r\nThese nodes are implemented via helpers, so in decompose, we must remove\r\nthe shift node from the tree and replace it with a call to the helper.\r\nAdditionally, these helpers require that the long operand is in EAX:EDX,\r\nso rather than adding a GT_LONG to the call arg list like we would\r\nnormally, we split the high and low parts of the arg and mark them as\r\nnon-standard args in gtMorphArgs to force the low part to be in EAX and\r\nthe high part to be in EDX. The shift amount is already defaulted to ECX,\r\nwhich is where the helper expects it to be.","created_at":"2016-08-30T20:20:27Z","updated_at":"2016-08-30T22:54:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4f90a8083da551ac1b43b30336bb5e60c0558434","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/6988/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/6988/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/6988/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/9cf3b6f28ecd886dceee00e193ea76028db3986b","head":{"label":"adiaaida:shiftLong","ref":"shiftLong","sha":"9cf3b6f28ecd886dceee00e193ea76028db3986b","user":{"login":"adiaaida","id":9666644,"avatar_url":"https://avatars.githubusercontent.com/u/9666644?v=3","gravatar_id":"","url":"https://api.github.com/users/adiaaida","html_url":"https://github.com/adiaaida","followers_url":"https://api.github.com/users/adiaaida/followers","following_url":"https://api.github.com/users/adiaaida/following{/other_user}","gists_url":"https://api.github.com/users/adiaaida/gists{/gist_id}","starred_url":"https://api.github.com/users/adiaaida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adiaaida/subscriptions","organizations_url":"https://api.github.com/users/adiaaida/orgs","repos_url":"https://api.github.com/users/adiaaida/repos","events_url":"https://api.github.com/users/adiaaida/events{/privacy}","received_events_url":"https://api.github.com/users/adiaaida/received_events","type":"User","site_admin":false},"repo":{"id":31043145,"name":"coreclr","full_name":"adiaaida/coreclr","owner":{"login":"adiaaida","id":9666644,"avatar_url":"https://avatars.githubusercontent.com/u/9666644?v=3","gravatar_id":"","url":"https://api.github.com/users/adiaaida","html_url":"https://github.com/adiaaida","followers_url":"https://api.github.com/users/adiaaida/followers","following_url":"https://api.github.com/users/adiaaida/following{/other_user}","gists_url":"https://api.github.com/users/adiaaida/gists{/gist_id}","starred_url":"https://api.github.com/users/adiaaida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adiaaida/subscriptions","organizations_url":"https://api.github.com/users/adiaaida/orgs","repos_url":"https://api.github.com/users/adiaaida/repos","events_url":"https://api.github.com/users/adiaaida/events{/privacy}","received_events_url":"https://api.github.com/users/adiaaida/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adiaaida/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR. It is an execution engine for .NET apps, performing functions such as IL byte code loading, compilation to machine code and garbage collection. The repo contains the complete up-to-date CoreCLR codebase.","fork":true,"url":"https://api.github.com/repos/adiaaida/coreclr","forks_url":"https://api.github.com/repos/adiaaida/coreclr/forks","keys_url":"https://api.github.com/repos/adiaaida/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adiaaida/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adiaaida/coreclr/teams","hooks_url":"https://api.github.com/repos/adiaaida/coreclr/hooks","issue_events_url":"https://api.github.com/repos/adiaaida/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/adiaaida/coreclr/events","assignees_url":"https://api.github.com/repos/adiaaida/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/adiaaida/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/adiaaida/coreclr/tags","blobs_url":"https://api.github.com/repos/adiaaida/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adiaaida/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adiaaida/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/adiaaida/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adiaaida/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/adiaaida/coreclr/languages","stargazers_url":"https://api.github.com/repos/adiaaida/coreclr/stargazers","contributors_url":"https://api.github.com/repos/adiaaida/coreclr/contributors","subscribers_url":"https://api.github.com/repos/adiaaida/coreclr/subscribers","subscription_url":"https://api.github.com/repos/adiaaida/coreclr/subscription","commits_url":"https://api.github.com/repos/adiaaida/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/adiaaida/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/adiaaida/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/adiaaida/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/adiaaida/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/adiaaida/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adiaaida/coreclr/merges","archive_url":"https://api.github.com/repos/adiaaida/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adiaaida/coreclr/downloads","issues_url":"https://api.github.com/repos/adiaaida/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/adiaaida/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/adiaaida/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/adiaaida/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adiaaida/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/adiaaida/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/adiaaida/coreclr/deployments","created_at":"2015-02-19T23:48:03Z","updated_at":"2016-01-25T21:55:06Z","pushed_at":"2016-08-30T22:10:33Z","git_url":"git://github.com/adiaaida/coreclr.git","ssh_url":"git@github.com:adiaaida/coreclr.git","clone_url":"https://github.com/adiaaida/coreclr.git","svn_url":"https://github.com/adiaaida/coreclr","homepage":"","size":103497,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"cda9b0fc9a5f206b391b1bd104e43bd6c29aad7f","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":30092893,"name":"coreclr","full_name":"dotnet/coreclr","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":false,"url":"https://api.github.com/repos/dotnet/coreclr","forks_url":"https://api.github.com/repos/dotnet/coreclr/forks","keys_url":"https://api.github.com/repos/dotnet/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/coreclr/teams","hooks_url":"https://api.github.com/repos/dotnet/coreclr/hooks","issue_events_url":"https://api.github.com/repos/dotnet/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/coreclr/events","assignees_url":"https://api.github.com/repos/dotnet/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/coreclr/tags","blobs_url":"https://api.github.com/repos/dotnet/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/coreclr/languages","stargazers_url":"https://api.github.com/repos/dotnet/coreclr/stargazers","contributors_url":"https://api.github.com/repos/dotnet/coreclr/contributors","subscribers_url":"https://api.github.com/repos/dotnet/coreclr/subscribers","subscription_url":"https://api.github.com/repos/dotnet/coreclr/subscription","commits_url":"https://api.github.com/repos/dotnet/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/coreclr/merges","archive_url":"https://api.github.com/repos/dotnet/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/coreclr/downloads","issues_url":"https://api.github.com/repos/dotnet/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/coreclr/deployments","created_at":"2015-01-30T22:10:02Z","updated_at":"2016-08-30T20:55:33Z","pushed_at":"2016-08-30T22:53:11Z","git_url":"git://github.com/dotnet/coreclr.git","ssh_url":"git@github.com:dotnet/coreclr.git","clone_url":"https://github.com/dotnet/coreclr.git","svn_url":"https://github.com/dotnet/coreclr","homepage":"https://docs.microsoft.com/dotnet/","size":115872,"stargazers_count":6842,"watchers_count":6842,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1622,"mirror_url":null,"open_issues_count":954,"forks":1622,"open_issues":954,"watchers":6842,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/6988"},"html":{"href":"https://github.com/dotnet/coreclr/pull/6988"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/6988"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/6988/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/6988/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/6988/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/9cf3b6f28ecd886dceee00e193ea76028db3986b"}}}}
{"actor":{"display_login":"sivarv"}}