{"action":"created","comment":{"url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/comments/27770631","id":27770631,"diff_hunk":"@@ -0,0 +1,385 @@\n+// Copyright (c) 2012- PPSSPP Project.\n+\n+// This program is free software: you can redistribute it and/or modify\n+// it under the terms of the GNU General Public License as published by\n+// the Free Software Foundation, version 2.0 or later versions.\n+\n+// This program is distributed in the hope that it will be useful,\n+// but WITHOUT ANY WARRANTY; without even the implied warranty of\n+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+// GNU General Public License 2.0 for more details.\n+\n+// A copy of the GPL 2.0 should have been included with the program.\n+// If not, see http://www.gnu.org/licenses/\n+\n+// Official git repository and contact information can be found at\n+// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.\n+\n+\n+// Optimization ideas:\n+//\n+// It's common to see sequences of stores writing or reading to a contiguous set of\n+// addresses in function prologues/epilogues:\n+//  sw s5, 104(sp)\n+//  sw s4, 100(sp)\n+//  sw s3, 96(sp)\n+//  sw s2, 92(sp)\n+//  sw s1, 88(sp)\n+//  sw s0, 84(sp)\n+//  sw ra, 108(sp)\n+//  mov s4, a0\n+//  mov s3, a1\n+//  ...\n+// Such sequences could easily be detected and turned into nice contiguous\n+// sequences of ARM stores instead of the current 3 instructions per sw/lw.\n+//\n+// Also, if we kept track of the likely register content of a cached register,\n+// (pointer or data), we could avoid many BIC instructions.\n+\n+\n+#include \"Core/MemMap.h\"\n+#include \"Core/Config.h\"\n+#include \"Core/MIPS/MIPS.h\"\n+#include \"Core/MIPS/MIPSAnalyst.h\"\n+#include \"Core/MIPS/MIPSCodeUtils.h\"\n+#include \"Core/MIPS/ARM64/Arm64Jit.h\"\n+#include \"Core/MIPS/ARM64/Arm64RegCache.h\"\n+\n+#define _RS MIPS_GET_RS(op)\n+#define _RT MIPS_GET_RT(op)\n+#define _RD MIPS_GET_RD(op)\n+#define _FS MIPS_GET_FS(op)\n+#define _FT MIPS_GET_FT(op)\n+#define _FD MIPS_GET_FD(op)\n+#define _SA MIPS_GET_SA(op)\n+#define _POS  ((op>> 6) & 0x1F)\n+#define _SIZE ((op>>11) & 0x1F)\n+#define _IMM16 (signed short)(op & 0xFFFF)\n+#define _IMM26 (op & 0x03FFFFFF)\n+\n+// All functions should have CONDITIONAL_DISABLE, so we can narrow things down to a file quickly.\n+// Currently known non working ones should have DISABLE.\n+\n+// #define CONDITIONAL_DISABLE { Comp_Generic(op); return; }\n+#define CONDITIONAL_DISABLE ;\n+#define DISABLE { Comp_Generic(op); return; }\n+\n+namespace MIPSComp\n+{\n+\tusing namespace Arm64Gen;\n+\tusing namespace Arm64JitConstants;\n+\t\n+\t// Destroys SCRATCH2\n+\tvoid Arm64Jit::SetScratch1ToEffectiveAddress(MIPSGPReg rs, s16 offset) {\n+\t\tif (offset) {\n+\t\t\tADDI2R(SCRATCH1, gpr.R(rs), offset, SCRATCH2);\n+\t\t} else {\n+\t\t\tMOV(SCRATCH1, gpr.R(rs));\n+\t\t}\n+\t}\n+\n+\tvoid Arm64Jit::SetCCAndSCRATCH1ForSafeAddress(MIPSGPReg rs, s16 offset, ARM64Reg tempReg, bool reverse) {\n+\t\tSetScratch1ToEffectiveAddress(rs, offset);\n+\t\t// TODO\n+\t}\n+\n+\tvoid Arm64Jit::Comp_ITypeMemLR(MIPSOpcode op, bool load) {\n+\t\tCONDITIONAL_DISABLE;\n+\t\tint offset = (signed short)(op & 0xFFFF);\n+\t\tMIPSGPReg rt = _RT;\n+\t\tMIPSGPReg rs = _RS;\n+\t\tint o = op >> 26;\n+\n+\t\tDISABLE;\n+\t\t// TODO: For some reason I can't get this to work on ARM64.\n+\t\tif (!js.inDelaySlot && false) {\n+\t\t\t// Optimisation: Combine to single unaligned load/store\n+\t\t\tbool isLeft = (o == 34 || o == 42);\n+\t\t\tMIPSOpcode nextOp = Memory::Read_Instruction(js.compilerPC + 4);\n+\t\t\t// Find a matching shift in opposite direction with opposite offset.\n+\t\t\tif (nextOp == (isLeft ? (op.encoding + (4 << 26) - 3)\n+\t\t\t\t: (op.encoding - (4 << 26) + 3))) {\n+\t\t\t\tEatInstruction(nextOp);\n+\t\t\t\tnextOp = MIPSOpcode(((load ? 35 : 43) << 26) | ((isLeft ? nextOp : op) & 0x03FFFFFF)); //lw, sw\n+\t\t\t\tComp_ITypeMem(nextOp);\n+\t\t\t\treturn;\n+\t\t\t}\n+\t\t}\n+\n+\t\tu32 iaddr = gpr.IsImm(rs) ? offset + gpr.GetImm(rs) : 0xFFFFFFFF;\n+\t\tbool doCheck = false;\n+\t\tFixupBranch skip;\n+\n+\t\tif (gpr.IsImm(rs) && Memory::IsValidAddress(iaddr)) {\n+\t\t\tu32 addr = iaddr & 0x3FFFFFFF;","path":"Core/MIPS/ARM64/Arm64CompLoadStore.cpp","position":114,"original_position":114,"commit_id":"65f6872040dc7c207533493a6537d22ad179341e","original_commit_id":"65f6872040dc7c207533493a6537d22ad179341e","user":{"login":"unknownbrackets","id":191233,"avatar_url":"https://avatars.githubusercontent.com/u/191233?v=3","gravatar_id":"","url":"https://api.github.com/users/unknownbrackets","html_url":"https://github.com/unknownbrackets","followers_url":"https://api.github.com/users/unknownbrackets/followers","following_url":"https://api.github.com/users/unknownbrackets/following{/other_user}","gists_url":"https://api.github.com/users/unknownbrackets/gists{/gist_id}","starred_url":"https://api.github.com/users/unknownbrackets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unknownbrackets/subscriptions","organizations_url":"https://api.github.com/users/unknownbrackets/orgs","repos_url":"https://api.github.com/users/unknownbrackets/repos","events_url":"https://api.github.com/users/unknownbrackets/events{/privacy}","received_events_url":"https://api.github.com/users/unknownbrackets/received_events","type":"User","site_admin":false},"body":"I guess this masking should probably be using a constant, hmm.  Anyway, it's not necessary here in 64-bit right?  I wonder if it's better with or without for SetRegImm...\r\n\r\n-[Unknown]","created_at":"2015-04-04T17:45:26Z","updated_at":"2015-04-04T17:45:26Z","html_url":"https://github.com/hrydgard/ppsspp/pull/7652#discussion_r27770631","pull_request_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/7652","_links":{"self":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/comments/27770631"},"html":{"href":"https://github.com/hrydgard/ppsspp/pull/7652#discussion_r27770631"},"pull_request":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/7652"}}},"pull_request":{"url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/7652","id":32599342,"html_url":"https://github.com/hrydgard/ppsspp/pull/7652","diff_url":"https://github.com/hrydgard/ppsspp/pull/7652.diff","patch_url":"https://github.com/hrydgard/ppsspp/pull/7652.patch","issue_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/7652","number":7652,"state":"open","locked":false,"title":"ARM64 Support","user":{"login":"hrydgard","id":130929,"avatar_url":"https://avatars.githubusercontent.com/u/130929?v=3","gravatar_id":"","url":"https://api.github.com/users/hrydgard","html_url":"https://github.com/hrydgard","followers_url":"https://api.github.com/users/hrydgard/followers","following_url":"https://api.github.com/users/hrydgard/following{/other_user}","gists_url":"https://api.github.com/users/hrydgard/gists{/gist_id}","starred_url":"https://api.github.com/users/hrydgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrydgard/subscriptions","organizations_url":"https://api.github.com/users/hrydgard/orgs","repos_url":"https://api.github.com/users/hrydgard/repos","events_url":"https://api.github.com/users/hrydgard/events{/privacy}","received_events_url":"https://api.github.com/users/hrydgard/received_events","type":"User","site_admin":false},"body":"This isn't 100% completed (software skinning in the vertex loader is missing, for example) but it's getting good enough to merge, as it's starting to run really well.\r\n\r\nNot for immediate merge, but probably quite soon. Making a pull request now to see what the Travis bot makes of it, although we already know it has the wrong NDK installed..\r\n\r\nOh, how neat, it's 64 commits heh.","created_at":"2015-04-03T16:29:07Z","updated_at":"2015-04-04T17:45:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8cebe4c346019a1777e4749f22234b2128336b4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/7652/commits","review_comments_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/7652/comments","review_comment_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/7652/comments","statuses_url":"https://api.github.com/repos/hrydgard/ppsspp/statuses/65f6872040dc7c207533493a6537d22ad179341e","head":{"label":"hrydgard:arm-64","ref":"arm-64","sha":"65f6872040dc7c207533493a6537d22ad179341e","user":{"login":"hrydgard","id":130929,"avatar_url":"https://avatars.githubusercontent.com/u/130929?v=3","gravatar_id":"","url":"https://api.github.com/users/hrydgard","html_url":"https://github.com/hrydgard","followers_url":"https://api.github.com/users/hrydgard/followers","following_url":"https://api.github.com/users/hrydgard/following{/other_user}","gists_url":"https://api.github.com/users/hrydgard/gists{/gist_id}","starred_url":"https://api.github.com/users/hrydgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrydgard/subscriptions","organizations_url":"https://api.github.com/users/hrydgard/orgs","repos_url":"https://api.github.com/users/hrydgard/repos","events_url":"https://api.github.com/users/hrydgard/events{/privacy}","received_events_url":"https://api.github.com/users/hrydgard/received_events","type":"User","site_admin":false},"repo":{"id":6486826,"name":"ppsspp","full_name":"hrydgard/ppsspp","owner":{"login":"hrydgard","id":130929,"avatar_url":"https://avatars.githubusercontent.com/u/130929?v=3","gravatar_id":"","url":"https://api.github.com/users/hrydgard","html_url":"https://github.com/hrydgard","followers_url":"https://api.github.com/users/hrydgard/followers","following_url":"https://api.github.com/users/hrydgard/following{/other_user}","gists_url":"https://api.github.com/users/hrydgard/gists{/gist_id}","starred_url":"https://api.github.com/users/hrydgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrydgard/subscriptions","organizations_url":"https://api.github.com/users/hrydgard/orgs","repos_url":"https://api.github.com/users/hrydgard/repos","events_url":"https://api.github.com/users/hrydgard/events{/privacy}","received_events_url":"https://api.github.com/users/hrydgard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hrydgard/ppsspp","description":"A PSP emulator for Android, Windows, Mac, Linux and Blackberry 10, written in C++. Want to contribute? Join us in #ppsspp on freenode (IRC) or just send pull requests / issues.","fork":false,"url":"https://api.github.com/repos/hrydgard/ppsspp","forks_url":"https://api.github.com/repos/hrydgard/ppsspp/forks","keys_url":"https://api.github.com/repos/hrydgard/ppsspp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hrydgard/ppsspp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hrydgard/ppsspp/teams","hooks_url":"https://api.github.com/repos/hrydgard/ppsspp/hooks","issue_events_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/events{/number}","events_url":"https://api.github.com/repos/hrydgard/ppsspp/events","assignees_url":"https://api.github.com/repos/hrydgard/ppsspp/assignees{/user}","branches_url":"https://api.github.com/repos/hrydgard/ppsspp/branches{/branch}","tags_url":"https://api.github.com/repos/hrydgard/ppsspp/tags","blobs_url":"https://api.github.com/repos/hrydgard/ppsspp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hrydgard/ppsspp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hrydgard/ppsspp/git/refs{/sha}","trees_url":"https://api.github.com/repos/hrydgard/ppsspp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hrydgard/ppsspp/statuses/{sha}","languages_url":"https://api.github.com/repos/hrydgard/ppsspp/languages","stargazers_url":"https://api.github.com/repos/hrydgard/ppsspp/stargazers","contributors_url":"https://api.github.com/repos/hrydgard/ppsspp/contributors","subscribers_url":"https://api.github.com/repos/hrydgard/ppsspp/subscribers","subscription_url":"https://api.github.com/repos/hrydgard/ppsspp/subscription","commits_url":"https://api.github.com/repos/hrydgard/ppsspp/commits{/sha}","git_commits_url":"https://api.github.com/repos/hrydgard/ppsspp/git/commits{/sha}","comments_url":"https://api.github.com/repos/hrydgard/ppsspp/comments{/number}","issue_comment_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/comments{/number}","contents_url":"https://api.github.com/repos/hrydgard/ppsspp/contents/{+path}","compare_url":"https://api.github.com/repos/hrydgard/ppsspp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hrydgard/ppsspp/merges","archive_url":"https://api.github.com/repos/hrydgard/ppsspp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hrydgard/ppsspp/downloads","issues_url":"https://api.github.com/repos/hrydgard/ppsspp/issues{/number}","pulls_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls{/number}","milestones_url":"https://api.github.com/repos/hrydgard/ppsspp/milestones{/number}","notifications_url":"https://api.github.com/repos/hrydgard/ppsspp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hrydgard/ppsspp/labels{/name}","releases_url":"https://api.github.com/repos/hrydgard/ppsspp/releases{/id}","created_at":"2012-11-01T08:41:48Z","updated_at":"2015-04-04T15:35:46Z","pushed_at":"2015-04-04T17:32:21Z","git_url":"git://github.com/hrydgard/ppsspp.git","ssh_url":"git@github.com:hrydgard/ppsspp.git","clone_url":"https://github.com/hrydgard/ppsspp.git","svn_url":"https://github.com/hrydgard/ppsspp","homepage":"http://www.ppsspp.org","size":216289,"stargazers_count":1605,"watchers_count":1605,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":738,"mirror_url":null,"open_issues_count":550,"forks":738,"open_issues":550,"watchers":1605,"default_branch":"master"}},"base":{"label":"hrydgard:master","ref":"master","sha":"0b3e290c4e6bb7a5afbeff87b037270b2da5e737","user":{"login":"hrydgard","id":130929,"avatar_url":"https://avatars.githubusercontent.com/u/130929?v=3","gravatar_id":"","url":"https://api.github.com/users/hrydgard","html_url":"https://github.com/hrydgard","followers_url":"https://api.github.com/users/hrydgard/followers","following_url":"https://api.github.com/users/hrydgard/following{/other_user}","gists_url":"https://api.github.com/users/hrydgard/gists{/gist_id}","starred_url":"https://api.github.com/users/hrydgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrydgard/subscriptions","organizations_url":"https://api.github.com/users/hrydgard/orgs","repos_url":"https://api.github.com/users/hrydgard/repos","events_url":"https://api.github.com/users/hrydgard/events{/privacy}","received_events_url":"https://api.github.com/users/hrydgard/received_events","type":"User","site_admin":false},"repo":{"id":6486826,"name":"ppsspp","full_name":"hrydgard/ppsspp","owner":{"login":"hrydgard","id":130929,"avatar_url":"https://avatars.githubusercontent.com/u/130929?v=3","gravatar_id":"","url":"https://api.github.com/users/hrydgard","html_url":"https://github.com/hrydgard","followers_url":"https://api.github.com/users/hrydgard/followers","following_url":"https://api.github.com/users/hrydgard/following{/other_user}","gists_url":"https://api.github.com/users/hrydgard/gists{/gist_id}","starred_url":"https://api.github.com/users/hrydgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrydgard/subscriptions","organizations_url":"https://api.github.com/users/hrydgard/orgs","repos_url":"https://api.github.com/users/hrydgard/repos","events_url":"https://api.github.com/users/hrydgard/events{/privacy}","received_events_url":"https://api.github.com/users/hrydgard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hrydgard/ppsspp","description":"A PSP emulator for Android, Windows, Mac, Linux and Blackberry 10, written in C++. Want to contribute? Join us in #ppsspp on freenode (IRC) or just send pull requests / issues.","fork":false,"url":"https://api.github.com/repos/hrydgard/ppsspp","forks_url":"https://api.github.com/repos/hrydgard/ppsspp/forks","keys_url":"https://api.github.com/repos/hrydgard/ppsspp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hrydgard/ppsspp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hrydgard/ppsspp/teams","hooks_url":"https://api.github.com/repos/hrydgard/ppsspp/hooks","issue_events_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/events{/number}","events_url":"https://api.github.com/repos/hrydgard/ppsspp/events","assignees_url":"https://api.github.com/repos/hrydgard/ppsspp/assignees{/user}","branches_url":"https://api.github.com/repos/hrydgard/ppsspp/branches{/branch}","tags_url":"https://api.github.com/repos/hrydgard/ppsspp/tags","blobs_url":"https://api.github.com/repos/hrydgard/ppsspp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hrydgard/ppsspp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hrydgard/ppsspp/git/refs{/sha}","trees_url":"https://api.github.com/repos/hrydgard/ppsspp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hrydgard/ppsspp/statuses/{sha}","languages_url":"https://api.github.com/repos/hrydgard/ppsspp/languages","stargazers_url":"https://api.github.com/repos/hrydgard/ppsspp/stargazers","contributors_url":"https://api.github.com/repos/hrydgard/ppsspp/contributors","subscribers_url":"https://api.github.com/repos/hrydgard/ppsspp/subscribers","subscription_url":"https://api.github.com/repos/hrydgard/ppsspp/subscription","commits_url":"https://api.github.com/repos/hrydgard/ppsspp/commits{/sha}","git_commits_url":"https://api.github.com/repos/hrydgard/ppsspp/git/commits{/sha}","comments_url":"https://api.github.com/repos/hrydgard/ppsspp/comments{/number}","issue_comment_url":"https://api.github.com/repos/hrydgard/ppsspp/issues/comments{/number}","contents_url":"https://api.github.com/repos/hrydgard/ppsspp/contents/{+path}","compare_url":"https://api.github.com/repos/hrydgard/ppsspp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hrydgard/ppsspp/merges","archive_url":"https://api.github.com/repos/hrydgard/ppsspp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hrydgard/ppsspp/downloads","issues_url":"https://api.github.com/repos/hrydgard/ppsspp/issues{/number}","pulls_url":"https://api.github.com/repos/hrydgard/ppsspp/pulls{/number}","milestones_url":"https://api.github.com/repos/hrydgard/ppsspp/milestones{/number}","notifications_url":"https://api.github.com/repos/hrydgard/ppsspp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hrydgard/ppsspp/labels{/name}","releases_url":"https://api.github.com/repos/hrydgard/ppsspp/releases{/id}","created_at":"2012-11-01T08:41:48Z","updated_at":"2015-04-04T15:35:46Z","pushed_at":"2015-04-04T17:32:21Z","git_url":"git://github.com/hrydgard/ppsspp.git","ssh_url":"git@github.com:hrydgard/ppsspp.git","clone_url":"https://github.com/hrydgard/ppsspp.git","svn_url":"https://github.com/hrydgard/ppsspp","homepage":"http://www.ppsspp.org","size":216289,"stargazers_count":1605,"watchers_count":1605,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":738,"mirror_url":null,"open_issues_count":550,"forks":738,"open_issues":550,"watchers":1605,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/7652"},"html":{"href":"https://github.com/hrydgard/ppsspp/pull/7652"},"issue":{"href":"https://api.github.com/repos/hrydgard/ppsspp/issues/7652"},"comments":{"href":"https://api.github.com/repos/hrydgard/ppsspp/issues/7652/comments"},"review_comments":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/7652/comments"},"review_comment":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hrydgard/ppsspp/pulls/7652/commits"},"statuses":{"href":"https://api.github.com/repos/hrydgard/ppsspp/statuses/65f6872040dc7c207533493a6537d22ad179341e"}}}}