{"action":"created","issue":{"url":"https://api.github.com/repos/PCSX2/pcsx2/issues/1019","labels_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/1019/labels{/name}","comments_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/1019/comments","events_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/1019/events","html_url":"https://github.com/PCSX2/pcsx2/issues/1019","id":120543200,"number":1019,"title":"EEREC: optimize branch due to sign extending knowledge","user":{"login":"gregory38","id":1569559,"avatar_url":"https://avatars.githubusercontent.com/u/1569559?v=3","gravatar_id":"","url":"https://api.github.com/users/gregory38","html_url":"https://github.com/gregory38","followers_url":"https://api.github.com/users/gregory38/followers","following_url":"https://api.github.com/users/gregory38/following{/other_user}","gists_url":"https://api.github.com/users/gregory38/gists{/gist_id}","starred_url":"https://api.github.com/users/gregory38/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregory38/subscriptions","organizations_url":"https://api.github.com/users/gregory38/orgs","repos_url":"https://api.github.com/users/gregory38/repos","events_url":"https://api.github.com/users/gregory38/events{/privacy}","received_events_url":"https://api.github.com/users/gregory38/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PCSX2/pcsx2/labels/Question","name":"Question","color":"cc317c"},{"url":"https://api.github.com/repos/PCSX2/pcsx2/labels/Recompiler","name":"Recompiler","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-12-05T09:30:04Z","updated_at":"2015-12-08T17:17:57Z","closed_at":null,"body":"EE branches comparison are 64 bits. Therefore we need 2 cmps & 2 branches on 32 bits. 64 bits could handle it in one shot.\r\n\r\nHowever most of the time the upper bits are a sign extensionsof the lower bits. Example\r\n```\r\n0x1000358 : lw\tv0, -0x2360(s4)\r\n0x100035C : bne\tv0, zero, ->$0x01000404\r\n0x1000360 : daddu\ta1, zero, zero\r\n```\r\nLoad word will sign extend v0, so the branch comparison could be limited to the lower bits.\r\n\r\nI think it could save a xCMP and a xJMP for lots of block (and sometimes 2 xMOV if no reg is constant).\r\n\r\nOpinion?"},"comment":{"url":"https://api.github.com/repos/PCSX2/pcsx2/issues/comments/162950074","html_url":"https://github.com/PCSX2/pcsx2/issues/1019#issuecomment-162950074","issue_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/1019","id":162950074,"user":{"login":"gregory38","id":1569559,"avatar_url":"https://avatars.githubusercontent.com/u/1569559?v=3","gravatar_id":"","url":"https://api.github.com/users/gregory38","html_url":"https://github.com/gregory38","followers_url":"https://api.github.com/users/gregory38/followers","following_url":"https://api.github.com/users/gregory38/following{/other_user}","gists_url":"https://api.github.com/users/gregory38/gists{/gist_id}","starred_url":"https://api.github.com/users/gregory38/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregory38/subscriptions","organizations_url":"https://api.github.com/users/gregory38/orgs","repos_url":"https://api.github.com/users/gregory38/repos","events_url":"https://api.github.com/users/gregory38/events{/privacy}","received_events_url":"https://api.github.com/users/gregory38/received_events","type":"User","site_admin":false},"created_at":"2015-12-08T17:17:57Z","updated_at":"2015-12-08T17:17:57Z","body":"What do you mean by constant and virtual register?\r\n\r\n"}}