{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/167062322","pull_request_review_id":95226949,"id":167062322,"diff_hunk":"@@ -428,6 +474,63 @@ void CodeGen::genHWIntrinsic_R_R_RM_I(GenTreeHWIntrinsic* node, instruction ins)\n     }\n }\n \n+template <typename HWIntrinsicSwitchCaseBody>\n+void CodeGen::genJumpTableFallback(unsigned                  maxImmValue,\n+                                   regNumber                 nonConstImmReg,\n+                                   regNumber                 baseReg,\n+                                   regNumber                 offsReg,\n+                                   HWIntrinsicSwitchCaseBody emitSwCase)\n+{\n+    assert(nonConstImmReg != REG_NA);\n+    emitter* emit = getEmitter();\n+\n+    const int   maxByte = 256;\n+    BasicBlock* jmpTable[maxByte];\n+\n+    unsigned jmpTableBase = emit->emitBBTableDataGenBeg(maxImmValue, true);\n+    unsigned jmpTableOffs = 0;\n+\n+    // Emit the jump table\n+    for (unsigned i = 0; i < maxImmValue; i++)\n+    {\n+        jmpTable[i] = genCreateTempLabel();\n+        JITDUMP(\"            DD      L_M%03u_BB%02u\\n\", Compiler::s_compMethodsCount, jmpTable[i]->bbNum);\n+        emit->emitDataGenData(i, jmpTable[i]);\n+    }\n+\n+    emit->emitDataGenEnd();\n+\n+    if (maxImmValue < maxByte - 1)\n+    {\n+        emit->emitIns_R_I(INS_cmp, EA_4BYTE, nonConstImmReg, maxImmValue);\n+        emitJumpKind jge = genJumpKindForOper(GT_GE, CK_UNSIGNED);\n+        genJumpToThrowHlpBlk(jge, SCK_ARG_RNG_EXCPN);","path":"src/jit/hwintrinsiccodegenxarch.cpp","position":147,"original_position":147,"commit_id":"b847cb0382a5f88a3f216432bb5b58ddcbfa2535","original_commit_id":"b847cb0382a5f88a3f216432bb5b58ddcbfa2535","user":{"login":"tannergooding","id":10487869,"avatar_url":"https://avatars3.githubusercontent.com/u/10487869?v=4","gravatar_id":"","url":"https://api.github.com/users/tannergooding","html_url":"https://github.com/tannergooding","followers_url":"https://api.github.com/users/tannergooding/followers","following_url":"https://api.github.com/users/tannergooding/following{/other_user}","gists_url":"https://api.github.com/users/tannergooding/gists{/gist_id}","starred_url":"https://api.github.com/users/tannergooding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tannergooding/subscriptions","organizations_url":"https://api.github.com/users/tannergooding/orgs","repos_url":"https://api.github.com/users/tannergooding/repos","events_url":"https://api.github.com/users/tannergooding/events{/privacy}","received_events_url":"https://api.github.com/users/tannergooding/received_events","type":"User","site_admin":false},"body":"I thought we determined that, we could also do this as:\r\n```C#\r\nresult Intrinsic(op1, op2)\r\n{\r\n    RangeCheck();\r\n    return Intrinsic(op1, op2);\r\n}\r\n```\r\n\r\nWhich only leaves the switch table up to the JIT.","created_at":"2018-02-08T20:47:13Z","updated_at":"2018-02-08T20:47:13Z","html_url":"https://github.com/dotnet/coreclr/pull/16183#discussion_r167062322","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/16183","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/167062322"},"html":{"href":"https://github.com/dotnet/coreclr/pull/16183#discussion_r167062322"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/16183"}},"in_reply_to_id":167037587},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/16183","id":166922864,"html_url":"https://github.com/dotnet/coreclr/pull/16183","diff_url":"https://github.com/dotnet/coreclr/pull/16183.diff","patch_url":"https://github.com/dotnet/coreclr/pull/16183.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/16183","number":16183,"state":"open","locked":false,"title":"[WIP] Update the table-driven framework to support x86 imm-intrinsics","user":{"login":"fiigii","id":1263030,"avatar_url":"https://avatars1.githubusercontent.com/u/1263030?v=4","gravatar_id":"","url":"https://api.github.com/users/fiigii","html_url":"https://github.com/fiigii","followers_url":"https://api.github.com/users/fiigii/followers","following_url":"https://api.github.com/users/fiigii/following{/other_user}","gists_url":"https://api.github.com/users/fiigii/gists{/gist_id}","starred_url":"https://api.github.com/users/fiigii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiigii/subscriptions","organizations_url":"https://api.github.com/users/fiigii/orgs","repos_url":"https://api.github.com/users/fiigii/repos","events_url":"https://api.github.com/users/fiigii/events{/privacy}","received_events_url":"https://api.github.com/users/fiigii/received_events","type":"User","site_admin":false},"body":"This PR updates the table-driven framework to support x86 imm-intrinsics. After this update, implementing imm-intrinsics just needs one-line definition in `hwintrinsiclistxarch.h`.\r\n\r\nThis PR implements certain imm-intrinsics which have special semanctics\r\n1. `Avx.Compare\\CompareScalar` just accepts imm-value in 0-31. Out of range argument will trigger `ArgumentOutOfRangeException`.\r\n2. `Avx2\\Sse2.ShiftLeftLogical\\ShiftRightLogical\\ShiftRightArithmetic` never throw any exception\r\n    - that will be converted to `shift* ymm, ymm, xmm` (or `shift* xmm, xmm`)form when the imm-arg is not a constant. For example, `Avx2.ShiftLeftLogical(v, i)` would generate `vmovd   xmm1, edi;  vpsllw  ymm0, ymm0, xmm1` instead of the jumptable fallback.\r\n    - `ShiftLeftLogical\\ShiftRightLogical` will be converted to `SetZeroVector256\\128` on out of range imm-arg.\r\n    - `ShiftRightArithmetic`'s imm-arg will be normalized to the maximum valid value on out of range imm-arg.\r\n3. `Avx2\\Sse2.ShiftLeftLogical128BitLane` will be converted to `SetZeroVector256\\128` on out of range imm-arg.","created_at":"2018-02-02T22:58:55Z","updated_at":"2018-02-08T20:47:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c313ca3f3d9bb75750c15704060c45584dc5c5fb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/16183/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/16183/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/16183/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/b847cb0382a5f88a3f216432bb5b58ddcbfa2535","head":{"label":"fiigii:refactor-imm","ref":"refactor-imm","sha":"b847cb0382a5f88a3f216432bb5b58ddcbfa2535","user":{"login":"fiigii","id":1263030,"avatar_url":"https://avatars1.githubusercontent.com/u/1263030?v=4","gravatar_id":"","url":"https://api.github.com/users/fiigii","html_url":"https://github.com/fiigii","followers_url":"https://api.github.com/users/fiigii/followers","following_url":"https://api.github.com/users/fiigii/following{/other_user}","gists_url":"https://api.github.com/users/fiigii/gists{/gist_id}","starred_url":"https://api.github.com/users/fiigii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiigii/subscriptions","organizations_url":"https://api.github.com/users/fiigii/orgs","repos_url":"https://api.github.com/users/fiigii/repos","events_url":"https://api.github.com/users/fiigii/events{/privacy}","received_events_url":"https://api.github.com/users/fiigii/received_events","type":"User","site_admin":false},"repo":{"id":81883824,"name":"coreclr","full_name":"fiigii/coreclr","owner":{"login":"fiigii","id":1263030,"avatar_url":"https://avatars1.githubusercontent.com/u/1263030?v=4","gravatar_id":"","url":"https://api.github.com/users/fiigii","html_url":"https://github.com/fiigii","followers_url":"https://api.github.com/users/fiigii/followers","following_url":"https://api.github.com/users/fiigii/following{/other_user}","gists_url":"https://api.github.com/users/fiigii/gists{/gist_id}","starred_url":"https://api.github.com/users/fiigii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiigii/subscriptions","organizations_url":"https://api.github.com/users/fiigii/orgs","repos_url":"https://api.github.com/users/fiigii/repos","events_url":"https://api.github.com/users/fiigii/events{/privacy}","received_events_url":"https://api.github.com/users/fiigii/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fiigii/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":true,"url":"https://api.github.com/repos/fiigii/coreclr","forks_url":"https://api.github.com/repos/fiigii/coreclr/forks","keys_url":"https://api.github.com/repos/fiigii/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fiigii/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fiigii/coreclr/teams","hooks_url":"https://api.github.com/repos/fiigii/coreclr/hooks","issue_events_url":"https://api.github.com/repos/fiigii/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/fiigii/coreclr/events","assignees_url":"https://api.github.com/repos/fiigii/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/fiigii/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/fiigii/coreclr/tags","blobs_url":"https://api.github.com/repos/fiigii/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fiigii/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fiigii/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/fiigii/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fiigii/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/fiigii/coreclr/languages","stargazers_url":"https://api.github.com/repos/fiigii/coreclr/stargazers","contributors_url":"https://api.github.com/repos/fiigii/coreclr/contributors","subscribers_url":"https://api.github.com/repos/fiigii/coreclr/subscribers","subscription_url":"https://api.github.com/repos/fiigii/coreclr/subscription","commits_url":"https://api.github.com/repos/fiigii/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/fiigii/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/fiigii/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/fiigii/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/fiigii/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/fiigii/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fiigii/coreclr/merges","archive_url":"https://api.github.com/repos/fiigii/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fiigii/coreclr/downloads","issues_url":"https://api.github.com/repos/fiigii/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/fiigii/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/fiigii/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/fiigii/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fiigii/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/fiigii/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/fiigii/coreclr/deployments","created_at":"2017-02-13T23:46:21Z","updated_at":"2017-02-13T23:48:37Z","pushed_at":"2018-02-08T00:32:58Z","git_url":"git://github.com/fiigii/coreclr.git","ssh_url":"git@github.com:fiigii/coreclr.git","clone_url":"https://github.com/fiigii/coreclr.git","svn_url":"https://github.com/fiigii/coreclr","homepage":"https://docs.microsoft.com/dotnet/","size":204563,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"f2d4300646b224650e69e75b6bbaa370714c597f","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","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://avatars0.githubusercontent.com/u/9141961?v=4","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 System.Private.Corelib (or mscorlib). It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes. We welcome contributions.","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":"2018-02-08T19:29:55Z","pushed_at":"2018-02-08T20:44:21Z","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://github.com/dotnet/core","size":206165,"stargazers_count":8913,"watchers_count":8913,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2244,"mirror_url":null,"archived":false,"open_issues_count":1522,"license":null,"forks":2244,"open_issues":1522,"watchers":8913,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/16183"},"html":{"href":"https://github.com/dotnet/coreclr/pull/16183"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/16183"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/16183/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/16183/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/16183/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/b847cb0382a5f88a3f216432bb5b58ddcbfa2535"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"tannergooding"}}