{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/11819","labels_url":"https://api.github.com/repos/golang/go/issues/11819/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/11819/comments","events_url":"https://api.github.com/repos/golang/go/issues/11819/events","html_url":"https://github.com/golang/go/issues/11819","id":96495814,"number":11819,"title":"cmd/compile: Use wide integer load/store instructions if possible","user":{"login":"dsnet","id":6354026,"avatar_url":"https://avatars.githubusercontent.com/u/6354026?v=3","gravatar_id":"","url":"https://api.github.com/users/dsnet","html_url":"https://github.com/dsnet","followers_url":"https://api.github.com/users/dsnet/followers","following_url":"https://api.github.com/users/dsnet/following{/other_user}","gists_url":"https://api.github.com/users/dsnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dsnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsnet/subscriptions","organizations_url":"https://api.github.com/users/dsnet/orgs","repos_url":"https://api.github.com/users/dsnet/repos","events_url":"https://api.github.com/users/dsnet/events{/privacy}","received_events_url":"https://api.github.com/users/dsnet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"randall77","id":6889504,"avatar_url":"https://avatars.githubusercontent.com/u/6889504?v=3","gravatar_id":"","url":"https://api.github.com/users/randall77","html_url":"https://github.com/randall77","followers_url":"https://api.github.com/users/randall77/followers","following_url":"https://api.github.com/users/randall77/following{/other_user}","gists_url":"https://api.github.com/users/randall77/gists{/gist_id}","starred_url":"https://api.github.com/users/randall77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randall77/subscriptions","organizations_url":"https://api.github.com/users/randall77/orgs","repos_url":"https://api.github.com/users/randall77/repos","events_url":"https://api.github.com/users/randall77/events{/privacy}","received_events_url":"https://api.github.com/users/randall77/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/24","html_url":"https://github.com/golang/go/milestones/Go1.6","labels_url":"https://api.github.com/repos/golang/go/milestones/24/labels","id":1096159,"number":24,"title":"Go1.6","description":"","creator":{"login":"josharian","id":67496,"avatar_url":"https://avatars.githubusercontent.com/u/67496?v=3","gravatar_id":"","url":"https://api.github.com/users/josharian","html_url":"https://github.com/josharian","followers_url":"https://api.github.com/users/josharian/followers","following_url":"https://api.github.com/users/josharian/following{/other_user}","gists_url":"https://api.github.com/users/josharian/gists{/gist_id}","starred_url":"https://api.github.com/users/josharian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josharian/subscriptions","organizations_url":"https://api.github.com/users/josharian/orgs","repos_url":"https://api.github.com/users/josharian/repos","events_url":"https://api.github.com/users/josharian/events{/privacy}","received_events_url":"https://api.github.com/users/josharian/received_events","type":"User","site_admin":false},"open_issues":234,"closed_issues":19,"state":"open","created_at":"2015-05-05T02:39:06Z","updated_at":"2015-07-23T05:56:07Z","due_on":"2016-01-31T08:00:00Z","closed_at":null},"comments":1,"created_at":"2015-07-22T07:37:22Z","updated_at":"2015-07-23T09:46:40Z","closed_at":null,"body":"Using go1.5beta2\r\n\r\nCompile the following code from encoding/binary:\r\n```go\r\ntype littleEndian struct{}\r\n\r\nfunc (littleEndian) PutUint64(b []byte, v int64) {\r\n\tb[0] = byte(v)\r\n\tb[1] = byte(v >> 8)\r\n\tb[2] = byte(v >> 16)\r\n\tb[3] = byte(v >> 24)\r\n\tb[4] = byte(v >> 32)\r\n\tb[5] = byte(v >> 40)\r\n\tb[6] = byte(v >> 48)\r\n\tb[7] = byte(v >> 56)\r\n}\r\n```\r\n\r\nThis produces the following:\r\n```asm\r\n\"\".littleEndian.PutUint64 t=1 size=288 value=0 args=0x20 locals=0x0\r\n\t0x0000 00000 (/home/rawr/main9.go:5)\tTEXT\t\"\".littleEndian.PutUint64(SB), $0-32\r\n\t0x0000 00000 (/home/rawr/main9.go:5)\tMOVQ\t(TLS), CX\r\n\t0x0009 00009 (/home/rawr/main9.go:5)\tCMPQ\tSP, 16(CX)\r\n\t0x000d 00013 (/home/rawr/main9.go:5)\tJLS\t275\r\n\t0x0013 00019 (/home/rawr/main9.go:5)\tNOP\r\n\t0x0013 00019 (/home/rawr/main9.go:5)\tNOP\r\n\t0x0013 00019 (/home/rawr/main9.go:5)\tMOVQ\t\"\".b+8(FP), DX\r\n\t0x0018 00024 (/home/rawr/main9.go:5)\tMOVQ\t\"\".b+16(FP), CX\r\n\t0x001d 00029 (/home/rawr/main9.go:5)\tMOVQ\t\"\".v+32(FP), AX\r\n\t0x0022 00034 (/home/rawr/main9.go:5)\tFUNCDATA\t$0, gclocals·2fccd208efe70893f9ac8d682812ae72(SB)\r\n\t0x0022 00034 (/home/rawr/main9.go:5)\tFUNCDATA\t$1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)\r\n\t0x0022 00034 (/home/rawr/main9.go:6)\tCMPQ\tCX, $0\r\n\t0x0026 00038 (/home/rawr/main9.go:6)\tJLS\t$1, 268\r\n\t0x002c 00044 (/home/rawr/main9.go:6)\tMOVB\tAL, (DX)\r\n\t0x002e 00046 (/home/rawr/main9.go:7)\tMOVQ\tDX, BX\r\n\t0x0031 00049 (/home/rawr/main9.go:7)\tCMPQ\tCX, $1\r\n\t0x0035 00053 (/home/rawr/main9.go:7)\tJLS\t$1, 261\r\n\t0x003b 00059 (/home/rawr/main9.go:7)\tINCQ\tBX\r\n\t0x003e 00062 (/home/rawr/main9.go:7)\tMOVQ\tAX, BP\r\n\t0x0041 00065 (/home/rawr/main9.go:7)\tSARQ\t$8, BP\r\n\t0x0045 00069 (/home/rawr/main9.go:7)\tMOVB\tBPB, (BX)\r\n\t0x0048 00072 (/home/rawr/main9.go:8)\tMOVQ\tDX, BX\r\n\t0x004b 00075 (/home/rawr/main9.go:8)\tCMPQ\tCX, $2\r\n\t0x004f 00079 (/home/rawr/main9.go:8)\tJLS\t$1, 254\r\n\t0x0055 00085 (/home/rawr/main9.go:8)\tADDQ\t$2, BX\r\n\t0x0059 00089 (/home/rawr/main9.go:8)\tMOVQ\tAX, BP\r\n\t0x005c 00092 (/home/rawr/main9.go:8)\tSARQ\t$16, BP\r\n\t0x0060 00096 (/home/rawr/main9.go:8)\tMOVB\tBPB, (BX)\r\n\t0x0063 00099 (/home/rawr/main9.go:9)\tMOVQ\tDX, BX\r\n\t0x0066 00102 (/home/rawr/main9.go:9)\tCMPQ\tCX, $3\r\n\t0x006a 00106 (/home/rawr/main9.go:9)\tJLS\t$1, 247\r\n\t0x0070 00112 (/home/rawr/main9.go:9)\tADDQ\t$3, BX\r\n\t0x0074 00116 (/home/rawr/main9.go:9)\tMOVQ\tAX, BP\r\n\t0x0077 00119 (/home/rawr/main9.go:9)\tSARQ\t$24, BP\r\n\t0x007b 00123 (/home/rawr/main9.go:9)\tMOVB\tBPB, (BX)\r\n\t0x007e 00126 (/home/rawr/main9.go:10)\tMOVQ\tDX, BX\r\n\t0x0081 00129 (/home/rawr/main9.go:10)\tCMPQ\tCX, $4\r\n\t0x0085 00133 (/home/rawr/main9.go:10)\tJLS\t$1, 240\r\n\t0x0087 00135 (/home/rawr/main9.go:10)\tADDQ\t$4, BX\r\n\t0x008b 00139 (/home/rawr/main9.go:10)\tMOVQ\tAX, BP\r\n\t0x008e 00142 (/home/rawr/main9.go:10)\tSARQ\t$32, BP\r\n\t0x0092 00146 (/home/rawr/main9.go:10)\tMOVB\tBPB, (BX)\r\n\t0x0095 00149 (/home/rawr/main9.go:11)\tMOVQ\tDX, BX\r\n\t0x0098 00152 (/home/rawr/main9.go:11)\tCMPQ\tCX, $5\r\n\t0x009c 00156 (/home/rawr/main9.go:11)\tJLS\t$1, 233\r\n\t0x009e 00158 (/home/rawr/main9.go:11)\tADDQ\t$5, BX\r\n\t0x00a2 00162 (/home/rawr/main9.go:11)\tMOVQ\tAX, BP\r\n\t0x00a5 00165 (/home/rawr/main9.go:11)\tSARQ\t$40, BP\r\n\t0x00a9 00169 (/home/rawr/main9.go:11)\tMOVB\tBPB, (BX)\r\n\t0x00ac 00172 (/home/rawr/main9.go:12)\tMOVQ\tDX, BX\r\n\t0x00af 00175 (/home/rawr/main9.go:12)\tCMPQ\tCX, $6\r\n\t0x00b3 00179 (/home/rawr/main9.go:12)\tJLS\t$1, 226\r\n\t0x00b5 00181 (/home/rawr/main9.go:12)\tADDQ\t$6, BX\r\n\t0x00b9 00185 (/home/rawr/main9.go:12)\tMOVQ\tAX, BP\r\n\t0x00bc 00188 (/home/rawr/main9.go:12)\tSARQ\t$48, BP\r\n\t0x00c0 00192 (/home/rawr/main9.go:12)\tMOVB\tBPB, (BX)\r\n\t0x00c3 00195 (/home/rawr/main9.go:13)\tMOVQ\tDX, BX\r\n\t0x00c6 00198 (/home/rawr/main9.go:13)\tCMPQ\tCX, $7\r\n\t0x00ca 00202 (/home/rawr/main9.go:13)\tJLS\t$1, 219\r\n\t0x00cc 00204 (/home/rawr/main9.go:13)\tADDQ\t$7, BX\r\n\t0x00d0 00208 (/home/rawr/main9.go:13)\tMOVQ\tAX, BP\r\n\t0x00d3 00211 (/home/rawr/main9.go:13)\tSARQ\t$56, BP\r\n\t0x00d7 00215 (/home/rawr/main9.go:13)\tMOVB\tBPB, (BX)\r\n\t0x00da 00218 (/home/rawr/main9.go:14)\tRET\r\n\t0x00db 00219 (/home/rawr/main9.go:13)\tPCDATA\t$0, $0\r\n\t0x00db 00219 (/home/rawr/main9.go:13)\tCALL\truntime.panicindex(SB)\r\n\t0x00e0 00224 (/home/rawr/main9.go:13)\tUNDEF\r\n\t0x00e2 00226 (/home/rawr/main9.go:12)\tPCDATA\t$0, $0\r\n\t0x00e2 00226 (/home/rawr/main9.go:12)\tCALL\truntime.panicindex(SB)\r\n\t0x00e7 00231 (/home/rawr/main9.go:12)\tUNDEF\r\n\t0x00e9 00233 (/home/rawr/main9.go:11)\tPCDATA\t$0, $0\r\n\t0x00e9 00233 (/home/rawr/main9.go:11)\tCALL\truntime.panicindex(SB)\r\n\t0x00ee 00238 (/home/rawr/main9.go:11)\tUNDEF\r\n\t0x00f0 00240 (/home/rawr/main9.go:10)\tPCDATA\t$0, $0\r\n\t0x00f0 00240 (/home/rawr/main9.go:10)\tCALL\truntime.panicindex(SB)\r\n\t0x00f5 00245 (/home/rawr/main9.go:10)\tUNDEF\r\n\t0x00f7 00247 (/home/rawr/main9.go:9)\tPCDATA\t$0, $0\r\n\t0x00f7 00247 (/home/rawr/main9.go:9)\tCALL\truntime.panicindex(SB)\r\n\t0x00fc 00252 (/home/rawr/main9.go:9)\tUNDEF\r\n\t0x00fe 00254 (/home/rawr/main9.go:8)\tPCDATA\t$0, $0\r\n\t0x00fe 00254 (/home/rawr/main9.go:8)\tCALL\truntime.panicindex(SB)\r\n\t0x0103 00259 (/home/rawr/main9.go:8)\tUNDEF\r\n\t0x0105 00261 (/home/rawr/main9.go:7)\tPCDATA\t$0, $0\r\n\t0x0105 00261 (/home/rawr/main9.go:7)\tCALL\truntime.panicindex(SB)\r\n\t0x010a 00266 (/home/rawr/main9.go:7)\tUNDEF\r\n\t0x010c 00268 (/home/rawr/main9.go:6)\tPCDATA\t$0, $0\r\n\t0x010c 00268 (/home/rawr/main9.go:6)\tCALL\truntime.panicindex(SB)\r\n\t0x0111 00273 (/home/rawr/main9.go:6)\tUNDEF\r\n\t0x0113 00275 (/home/rawr/main9.go:5)\tCALL\truntime.morestack_noctxt(SB)\r\n\t0x0118 00280 (/home/rawr/main9.go:5)\tJMP\t0\r\n\t0x0000 64 48 8b 0c 25 00 00 00 00 48 3b 61 10 0f 86 00  dH..%....H;a....\r\n\t0x0010 01 00 00 48 8b 54 24 08 48 8b 4c 24 10 48 8b 44  ...H.T$.H.L$.H.D\r\n\t0x0020 24 20 48 83 f9 00 0f 86 e0 00 00 00 88 02 48 89  $ H...........H.\r\n\t0x0030 d3 48 83 f9 01 0f 86 ca 00 00 00 48 ff c3 48 89  .H.........H..H.\r\n\t0x0040 c5 48 c1 fd 08 40 88 2b 48 89 d3 48 83 f9 02 0f  .H...@.+H..H....\r\n\t0x0050 86 a9 00 00 00 48 83 c3 02 48 89 c5 48 c1 fd 10  .....H...H..H...\r\n\t0x0060 40 88 2b 48 89 d3 48 83 f9 03 0f 86 87 00 00 00  @.+H..H.........\r\n\t0x0070 48 83 c3 03 48 89 c5 48 c1 fd 18 40 88 2b 48 89  H...H..H...@.+H.\r\n\t0x0080 d3 48 83 f9 04 76 69 48 83 c3 04 48 89 c5 48 c1  .H...viH...H..H.\r\n\t0x0090 fd 20 40 88 2b 48 89 d3 48 83 f9 05 76 4b 48 83  . @.+H..H...vKH.\r\n\t0x00a0 c3 05 48 89 c5 48 c1 fd 28 40 88 2b 48 89 d3 48  ..H..H..(@.+H..H\r\n\t0x00b0 83 f9 06 76 2d 48 83 c3 06 48 89 c5 48 c1 fd 30  ...v-H...H..H..0\r\n\t0x00c0 40 88 2b 48 89 d3 48 83 f9 07 76 0f 48 83 c3 07  @.+H..H...v.H...\r\n\t0x00d0 48 89 c5 48 c1 fd 38 40 88 2b c3 e8 00 00 00 00  H..H..8@.+......\r\n\t0x00e0 0f 0b e8 00 00 00 00 0f 0b e8 00 00 00 00 0f 0b  ................\r\n\t0x00f0 e8 00 00 00 00 0f 0b e8 00 00 00 00 0f 0b e8 00  ................\r\n\t0x0100 00 00 00 0f 0b e8 00 00 00 00 0f 0b e8 00 00 00  ................\r\n\t0x0110 00 0f 0b e8 00 00 00 00 e9 e3 fe ff ff           .............\r\n\trel 5+4 t=13 +0\r\n\trel 220+4 t=5 runtime.panicindex+0\r\n\trel 227+4 t=5 runtime.panicindex+0\r\n\trel 234+4 t=5 runtime.panicindex+0\r\n\trel 241+4 t=5 runtime.panicindex+0\r\n\trel 248+4 t=5 runtime.panicindex+0\r\n\trel 255+4 t=5 runtime.panicindex+0\r\n\trel 262+4 t=5 runtime.panicindex+0\r\n\trel 269+4 t=5 runtime.panicindex+0\r\n\trel 276+4 t=5 runtime.morestack_noctxt+0\r\n```\r\n\r\nPutting aside the superfluous amount of bounds checking (captured in #5364), it seems like this entire function could be accomplished using some type of store64 instruction instead of 8 repetitive copies of something like:\r\n```asm\r\n    0x00b9 00185 (/home/rawr/main9.go:12)   MOVQ    AX, BP\r\n    0x00bc 00188 (/home/rawr/main9.go:12)   SARQ    $48, BP\r\n    0x00c0 00192 (/home/rawr/main9.go:12)   MOVB    BPB, (BX)\r\n    0x00c3 00195 (/home/rawr/main9.go:13)   MOVQ    DX, BX\r\n    0x00c6 00198 (/home/rawr/main9.go:13)   CMPQ    CX, $7\r\n    0x00ca 00202 (/home/rawr/main9.go:13)   JLS $1, 219\r\n```"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/124035710","html_url":"https://github.com/golang/go/issues/11819#issuecomment-124035710","issue_url":"https://api.github.com/repos/golang/go/issues/11819","id":124035710,"user":{"login":"mwhudson","id":672022,"avatar_url":"https://avatars.githubusercontent.com/u/672022?v=3","gravatar_id":"","url":"https://api.github.com/users/mwhudson","html_url":"https://github.com/mwhudson","followers_url":"https://api.github.com/users/mwhudson/followers","following_url":"https://api.github.com/users/mwhudson/following{/other_user}","gists_url":"https://api.github.com/users/mwhudson/gists{/gist_id}","starred_url":"https://api.github.com/users/mwhudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwhudson/subscriptions","organizations_url":"https://api.github.com/users/mwhudson/orgs","repos_url":"https://api.github.com/users/mwhudson/repos","events_url":"https://api.github.com/users/mwhudson/events{/privacy}","received_events_url":"https://api.github.com/users/mwhudson/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T09:46:40Z","updated_at":"2015-07-23T09:46:40Z","body":"This would be great, you do need to worry about alignment on some architectures though and I don't know how that should be handled."}}