{"action":"created","issue":{"url":"https://api.github.com/repos/KhronosGroup/SPIRV-LLVM/issues/154","repository_url":"https://api.github.com/repos/KhronosGroup/SPIRV-LLVM","labels_url":"https://api.github.com/repos/KhronosGroup/SPIRV-LLVM/issues/154/labels{/name}","comments_url":"https://api.github.com/repos/KhronosGroup/SPIRV-LLVM/issues/154/comments","events_url":"https://api.github.com/repos/KhronosGroup/SPIRV-LLVM/issues/154/events","html_url":"https://github.com/KhronosGroup/SPIRV-LLVM/pull/154","id":159575732,"number":154,"title":"extractvalue/insertvalue handling","user":{"login":"a2flo","id":439780,"avatar_url":"https://avatars.githubusercontent.com/u/439780?v=3","gravatar_id":"","url":"https://api.github.com/users/a2flo","html_url":"https://github.com/a2flo","followers_url":"https://api.github.com/users/a2flo/followers","following_url":"https://api.github.com/users/a2flo/following{/other_user}","gists_url":"https://api.github.com/users/a2flo/gists{/gist_id}","starred_url":"https://api.github.com/users/a2flo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a2flo/subscriptions","organizations_url":"https://api.github.com/users/a2flo/orgs","repos_url":"https://api.github.com/users/a2flo/repos","events_url":"https://api.github.com/users/a2flo/events{/privacy}","received_events_url":"https://api.github.com/users/a2flo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"yxsamliu","id":6145511,"avatar_url":"https://avatars.githubusercontent.com/u/6145511?v=3","gravatar_id":"","url":"https://api.github.com/users/yxsamliu","html_url":"https://github.com/yxsamliu","followers_url":"https://api.github.com/users/yxsamliu/followers","following_url":"https://api.github.com/users/yxsamliu/following{/other_user}","gists_url":"https://api.github.com/users/yxsamliu/gists{/gist_id}","starred_url":"https://api.github.com/users/yxsamliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yxsamliu/subscriptions","organizations_url":"https://api.github.com/users/yxsamliu/orgs","repos_url":"https://api.github.com/users/yxsamliu/repos","events_url":"https://api.github.com/users/yxsamliu/events{/privacy}","received_events_url":"https://api.github.com/users/yxsamliu/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2016-06-10T07:31:30Z","updated_at":"2016-06-10T14:57:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/KhronosGroup/SPIRV-LLVM/pulls/154","html_url":"https://github.com/KhronosGroup/SPIRV-LLVM/pull/154","diff_url":"https://github.com/KhronosGroup/SPIRV-LLVM/pull/154.diff","patch_url":"https://github.com/KhronosGroup/SPIRV-LLVM/pull/154.patch"},"body":"This adds handling of LLVM extractvalue/insertvalue instructions (e.g. as used for loading/storing a value from/to an array), and handling of the reverse translation from SPIR-V to LLVM in OpCompositeExtract/OpCompositeInsert.\r\n\r\nSeveral notes:\r\n * SPIR-V classifies structures, arrays, matrices and vectors as composite types. SPIRV-LLVM currently only handles vector types in OpCompositeExtract/OpCompositeInsert.\r\n * I have only tested this for array types right now. LLVM struct types will also need testing. Since neither OpenCL nor LLVM have a native matrix type, I'm not sure how or if matrix types should be tested.\r\n * the ExtractValueInst/InsertValueInst handling must go before the UnaryInstruction handling (in SPIRVWriter), because they are both unary instructions.\r\n * indices in LLVM and SPIR-V match up, so no conversion is necessary.\r\n\r\nAlso, help creating proper test cases would be appreciated. Probably have to write these by hand as I can't seem to tickle extractvalue/insertvalue instructions out of LLVM for simple example code (it usually prefers GEPs instead of these).\r\n\r\nAs a more convoluted example, I currently have this:\r\n```\r\n%struct.raster_params = type { %class.matrix4 }\r\n%class.matrix4 = type { %struct.const_array }\r\n%struct.const_array = type { [16 x float] }\r\n[...]\r\n  %5 = getelementptr inbounds %struct.raster_params, %struct.raster_params addrspace(2)* %params, i64 0, i32 0, i32 0, i32 0\r\n  %.unpack.unpack = load [16 x float], [16 x float] addrspace(2)* %5, align 4\r\n  %.unpack.unpack.fca.2.extract = extractvalue [16 x float] %.unpack.unpack, 2\r\n```\r\nwhich should get translated to (misc stuff omitted):\r\n```\r\n          %5 = OpTypeFloat 32\r\n          %6 = OpTypeInt 64 0\r\n        %169 = OpConstant %6 16\r\n        %170 = OpTypeArray %5 %169\r\n[...]\r\n        %217 = OpInBoundsPtrAccessChain %216 %183 %56 %58 %58 %58\r\n        %218 = OpLoad %170 %217 Aligned 4\r\n        %219 = OpCompositeExtract %5 %218 2\r\n```"},"comment":{"url":"https://api.github.com/repos/KhronosGroup/SPIRV-LLVM/issues/comments/225205468","html_url":"https://github.com/KhronosGroup/SPIRV-LLVM/pull/154#issuecomment-225205468","issue_url":"https://api.github.com/repos/KhronosGroup/SPIRV-LLVM/issues/154","id":225205468,"user":{"login":"bader","id":411965,"avatar_url":"https://avatars.githubusercontent.com/u/411965?v=3","gravatar_id":"","url":"https://api.github.com/users/bader","html_url":"https://github.com/bader","followers_url":"https://api.github.com/users/bader/followers","following_url":"https://api.github.com/users/bader/following{/other_user}","gists_url":"https://api.github.com/users/bader/gists{/gist_id}","starred_url":"https://api.github.com/users/bader/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bader/subscriptions","organizations_url":"https://api.github.com/users/bader/orgs","repos_url":"https://api.github.com/users/bader/repos","events_url":"https://api.github.com/users/bader/events{/privacy}","received_events_url":"https://api.github.com/users/bader/received_events","type":"User","site_admin":false},"created_at":"2016-06-10T14:57:02Z","updated_at":"2016-06-10T14:57:02Z","body":"I'm OK with it, but I'd like Sam to review it also."}}
{"actor":{"display_login":"bader"}}