{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/53412605","id":53412605,"diff_hunk":"@@ -5723,17 +5750,163 @@ void CodeGen::genLeaInstruction(GenTreeAddrMode *lea)\n     genProduceReg(lea);\n }\n \n+/*****************************************************************************\n+ *  The condition to use for (the jmp/set for) the given type of compare operation are\n+ *  returned in 'jmpKind' array.  \n+ *  If only one branch is necessary the value of jmpKind[1] will be EJ_NONE\n+ *  On Arm64 both branches will always branch to the true label\n+ */\n+// static\n+void         CodeGen::genJumpKindsForTree(GenTreePtr    cmpTree, \n+                                          emitJumpKind  jmpKind[2], \n+                                          bool          jmpToTrueLabel[2])\n+{\n+    // On Arm64 both branches will always branch to the true label\n+    jmpToTrueLabel[0] = true;\n+    jmpToTrueLabel[1] = true;\n+\n+    // For integer comparisons just use genJumpKindForOper\n+    if (!varTypeIsFloating(cmpTree->gtOp.gtOp1->gtEffectiveVal()))\n+    {\n+        CompareKind compareKind = ((cmpTree->gtFlags & GTF_UNSIGNED) != 0) ? CK_UNSIGNED : CK_SIGNED;\n+        jmpKind[0] = genJumpKindForOper(cmpTree->gtOper, compareKind);\n+        jmpKind[1] = EJ_NONE;\n+    }\n+    else  // We have a Floating Point Compare operation\n+    {\n+        assert(cmpTree->OperIsCompare());\n+\n+        // For details on this mapping, see the ARM64 Condition Code \n+        // table at section C1.2.3 in the ARMV8 architecture manual\n+        //\n+\n+        // We must check the GTF_RELOP_NAN_UN to find out\n+        // if we need to branch when we have a NaN operand.\n+        //\n+        if ((cmpTree->gtFlags & GTF_RELOP_NAN_UN) != 0)\n+        {\n+            // Must branch if we have an NaN, unordered\n+            switch (cmpTree->gtOper)\n+            {\n+            case GT_EQ:\n+                jmpKind[0] = EJ_eq;   // branch or set when equal (and no NaN's)\n+                jmpKind[1] = EJ_vs;   // branch or set when we have a NaN \n+                break;\n+\n+            case GT_NE:\n+                jmpKind[0] = EJ_ne;   // branch or set when not equal (or have NaN's)\n+                jmpKind[1] = EJ_NONE;\n+                break;\n+\n+            case GT_LT:\n+                jmpKind[0] = EJ_lt;   // branch or set when less than (or have NaN's)\n+                jmpKind[1] = EJ_NONE;\n+                break;\n+                \n+            case GT_LE:\n+                jmpKind[0] = EJ_le;   // branch or set when less than or equal (or have NaN's)\n+                jmpKind[1] = EJ_NONE;\n+                break;\n+\n+            case GT_GT:\n+                jmpKind[0] = EJ_hi;   // branch or set when greater than (or have NaN's)\n+                jmpKind[1] = EJ_NONE;\n+                break;\n+\n+            case GT_GE:\n+                jmpKind[0] = EJ_hs;   // branch or set when greater than or equal (or have NaN's)\n+                jmpKind[1] = EJ_NONE;\n+                break;\n+\n+            default:\n+                unreached();\n+            }\n+        }\n+        else  // ((cmpTree->gtFlags & GTF_RELOP_NAN_UN) == 0)\n+        {\n+            // Do not branch if we have an NaN, unordered\n+            switch (cmpTree->gtOper)\n+            {\n+            case GT_EQ:\n+                jmpKind[0] = EJ_eq;   // branch or set when equal (and no NaN's)\n+                jmpKind[1] = EJ_NONE;\n+                break;\n+\n+            case GT_NE:\n+                jmpKind[0] = EJ_gt;   // branch or set when greater than (and no NaN's)\n+                jmpKind[1] = EJ_lo;   // branch or set when less than (and no NaN's)\n+                break;\n+\n+            case GT_LT:\n+                jmpKind[0] = EJ_lo;   // branch or set when less than (and no NaN's)\n+                jmpKind[1] = EJ_NONE;\n+                break;\n+\n+            case GT_LE:\n+                jmpKind[0] = EJ_ls;   // branch or set when less than or equal (and no NaN's)\n+                jmpKind[1] = EJ_NONE;\n+                break;\n+\n+            case GT_GT:\n+                jmpKind[0] = EJ_gt;   // branch or set when greater than (and no NaN's)\n+                jmpKind[1] = EJ_NONE;\n+                break;\n+\n+            case GT_GE:\n+                jmpKind[0] = EJ_ge;   // branch or set when greater than or equal (and no NaN's)\n+                jmpKind[1] = EJ_NONE;\n+                break;\n+\n+            default:\n+                unreached();\n+            }\n+        }\n+    }\n+}\n+\n // Generate code to materialize a condition into a register\n // (the condition codes must already have been appropriately set)\n \n void CodeGen::genSetRegToCond(regNumber dstReg, GenTreePtr tree)\n {\n-    // Get the \"jmpKind\" using the gtOper kind\n-    // Note that whether it is an unsigned cmp is governed by the GTF_UNSIGNED flags\n+    emitJumpKind jumpKind[2];\n+    bool branchToTrueLabel[2];\n+    genJumpKindsForTree(tree, jumpKind, branchToTrueLabel);","path":"src/jit/codegenarm64.cpp","position":308,"original_position":308,"commit_id":"7ed035b0e4691db3b6fefe1ca80887018f09576a","original_commit_id":"7ed035b0e4691db3b6fefe1ca80887018f09576a","user":{"login":"briansull","id":11621884,"avatar_url":"https://avatars.githubusercontent.com/u/11621884?v=3","gravatar_id":"","url":"https://api.github.com/users/briansull","html_url":"https://github.com/briansull","followers_url":"https://api.github.com/users/briansull/followers","following_url":"https://api.github.com/users/briansull/following{/other_user}","gists_url":"https://api.github.com/users/briansull/gists{/gist_id}","starred_url":"https://api.github.com/users/briansull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briansull/subscriptions","organizations_url":"https://api.github.com/users/briansull/orgs","repos_url":"https://api.github.com/users/briansull/repos","events_url":"https://api.github.com/users/briansull/events{/privacy}","received_events_url":"https://api.github.com/users/briansull/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2016-02-19T01:41:39Z","updated_at":"2016-02-19T01:41:39Z","html_url":"https://github.com/dotnet/coreclr/pull/3242#discussion_r53412605","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/3242","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/53412605"},"html":{"href":"https://github.com/dotnet/coreclr/pull/3242#discussion_r53412605"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3242"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/3242","id":59883967,"html_url":"https://github.com/dotnet/coreclr/pull/3242","diff_url":"https://github.com/dotnet/coreclr/pull/3242.diff","patch_url":"https://github.com/dotnet/coreclr/pull/3242.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/3242","number":3242,"state":"open","locked":false,"title":"Refactor of conditional branches for the ARM architecture","user":{"login":"briansull","id":11621884,"avatar_url":"https://avatars.githubusercontent.com/u/11621884?v=3","gravatar_id":"","url":"https://api.github.com/users/briansull","html_url":"https://github.com/briansull","followers_url":"https://api.github.com/users/briansull/followers","following_url":"https://api.github.com/users/briansull/following{/other_user}","gists_url":"https://api.github.com/users/briansull/gists{/gist_id}","starred_url":"https://api.github.com/users/briansull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briansull/subscriptions","organizations_url":"https://api.github.com/users/briansull/orgs","repos_url":"https://api.github.com/users/briansull/repos","events_url":"https://api.github.com/users/briansull/events{/privacy}","received_events_url":"https://api.github.com/users/briansull/received_events","type":"User","site_admin":false},"body":"Conditional branches on Arm now match the Arm condition codes instead of using x86 branches.\r\n\r\nUpdated the enum emitJumpKind to use Arm condition codes rather than x86 conditional branches\r\n\r\nImplemented and tested for Arm64 the full set of ordered and unordered floating point branches\r\nImplemented and tested for Arm64 genSetRegToCond for ordered and unordered floating point compares\r\n\r\nOn Arm64 we now use the genJumpKindsForTree to return up to two conditional branches for floating point compares\r\n\r\nChanged genJumpKindForOper to use an new enum CompareKind to specify a signed, unsigned or logical compare operation \r\n\r\nCleanup we now use genJumpKindForOper to select conditional branches and prefer\r\n using CK_SIGNED for creating branches for GT_EQ and GT_NE\r\n\r\nRemoved the unused fourth 'condcode' portion of the JMP_SMALL macro and\r\nthe fourth column from the Arm/Arm64 part of \"emitjmps.cpp\"\r\n\r\nUnified Arm32 and Arm64 conditionals in \"emitjmps.cpp\"\r\nReordered the Arm32 and Arm64 conditionals in \"emitjmps.cpp\" to match the ARMV8 docs\r\n\r\nThis change  impacts the Arm32  and x86 JIT's and was verified to have no asm diffs for them\r\n","created_at":"2016-02-18T23:56:10Z","updated_at":"2016-02-19T01:41:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"644dc7d506c0a0510b1a211583168bd18239510d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/3242/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/3242/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/3242/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/7ed035b0e4691db3b6fefe1ca80887018f09576a","head":{"label":"briansull:arm64conds","ref":"arm64conds","sha":"7ed035b0e4691db3b6fefe1ca80887018f09576a","user":{"login":"briansull","id":11621884,"avatar_url":"https://avatars.githubusercontent.com/u/11621884?v=3","gravatar_id":"","url":"https://api.github.com/users/briansull","html_url":"https://github.com/briansull","followers_url":"https://api.github.com/users/briansull/followers","following_url":"https://api.github.com/users/briansull/following{/other_user}","gists_url":"https://api.github.com/users/briansull/gists{/gist_id}","starred_url":"https://api.github.com/users/briansull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briansull/subscriptions","organizations_url":"https://api.github.com/users/briansull/orgs","repos_url":"https://api.github.com/users/briansull/repos","events_url":"https://api.github.com/users/briansull/events{/privacy}","received_events_url":"https://api.github.com/users/briansull/received_events","type":"User","site_admin":false},"repo":{"id":32836344,"name":"coreclr","full_name":"briansull/coreclr","owner":{"login":"briansull","id":11621884,"avatar_url":"https://avatars.githubusercontent.com/u/11621884?v=3","gravatar_id":"","url":"https://api.github.com/users/briansull","html_url":"https://github.com/briansull","followers_url":"https://api.github.com/users/briansull/followers","following_url":"https://api.github.com/users/briansull/following{/other_user}","gists_url":"https://api.github.com/users/briansull/gists{/gist_id}","starred_url":"https://api.github.com/users/briansull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briansull/subscriptions","organizations_url":"https://api.github.com/users/briansull/orgs","repos_url":"https://api.github.com/users/briansull/repos","events_url":"https://api.github.com/users/briansull/events{/privacy}","received_events_url":"https://api.github.com/users/briansull/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/briansull/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/briansull/coreclr","forks_url":"https://api.github.com/repos/briansull/coreclr/forks","keys_url":"https://api.github.com/repos/briansull/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/briansull/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/briansull/coreclr/teams","hooks_url":"https://api.github.com/repos/briansull/coreclr/hooks","issue_events_url":"https://api.github.com/repos/briansull/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/briansull/coreclr/events","assignees_url":"https://api.github.com/repos/briansull/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/briansull/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/briansull/coreclr/tags","blobs_url":"https://api.github.com/repos/briansull/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/briansull/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/briansull/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/briansull/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/briansull/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/briansull/coreclr/languages","stargazers_url":"https://api.github.com/repos/briansull/coreclr/stargazers","contributors_url":"https://api.github.com/repos/briansull/coreclr/contributors","subscribers_url":"https://api.github.com/repos/briansull/coreclr/subscribers","subscription_url":"https://api.github.com/repos/briansull/coreclr/subscription","commits_url":"https://api.github.com/repos/briansull/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/briansull/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/briansull/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/briansull/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/briansull/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/briansull/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/briansull/coreclr/merges","archive_url":"https://api.github.com/repos/briansull/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/briansull/coreclr/downloads","issues_url":"https://api.github.com/repos/briansull/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/briansull/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/briansull/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/briansull/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/briansull/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/briansull/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/briansull/coreclr/deployments","created_at":"2015-03-25T01:52:49Z","updated_at":"2016-01-12T22:16:55Z","pushed_at":"2016-02-18T23:51:22Z","git_url":"git://github.com/briansull/coreclr.git","ssh_url":"git@github.com:briansull/coreclr.git","clone_url":"https://github.com/briansull/coreclr.git","svn_url":"https://github.com/briansull/coreclr","homepage":"","size":59541,"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":"b90b09116d12ab65328fbd1ed80c21c75131e121","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-02-18T22:13:47Z","pushed_at":"2016-02-19T01:09:56Z","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":"http://dotnet.github.io/","size":64408,"stargazers_count":5884,"watchers_count":5884,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1295,"mirror_url":null,"open_issues_count":539,"forks":1295,"open_issues":539,"watchers":5884,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3242"},"html":{"href":"https://github.com/dotnet/coreclr/pull/3242"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/3242"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/3242/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3242/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3242/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/7ed035b0e4691db3b6fefe1ca80887018f09576a"}}}}