diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-19 07:50:48 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-22 08:20:34 -0700 |
commit | d155168e6cdbfc0e86cad6d22fda1111408340e4 (patch) | |
tree | 7b41a2aeedc155df4fb79df5608f95a31c464a06 /src/panfrost/midgard/midgard_schedule.c | |
parent | 3bb780ecb93117d90b54f8a974abb2387a6f21d2 (diff) |
panfrost/midgard: Implement load/store scratch opcodes
These are used to load/store from Thread Local Storage, which is memory
allocated per-thread (corresponding to ctx->scratchpad in the command
stream) and used for register spilling.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard/midgard_schedule.c')
-rw-r--r-- | src/panfrost/midgard/midgard_schedule.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 97e06d743fa..db87ab65f7f 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -575,7 +575,43 @@ midgard_pair_load_store(compiler_context *ctx, midgard_block *block) } } +midgard_instruction +v_load_store_scratch(unsigned srcdest, unsigned index, bool is_store) +{ + /* We index by 32-bit vec4s */ + unsigned byte = (index * 4 * 4); + + midgard_instruction ins = { + .type = TAG_LOAD_STORE_4, + .mask = 0xF, + .ssa_args = { + .dest = -1, + .src0 = -1, + .src1 = -1 + }, + .load_store = { + .op = is_store ? midgard_op_st_int4 : midgard_op_ld_int4, + .swizzle = SWIZZLE_XYZW, + + /* For register spilling - to thread local storage */ + .unknown = 0x1EEA, + + /* Splattered across, TODO combine logically */ + .varying_parameters = (byte & 0x1FF) << 1, + .address = (byte >> 9) + } + }; + + if (is_store) { + /* r0 = r26, r1 = r27 */ + assert(srcdest == 26 || srcdest == 27); + ins.ssa_args.src0 = SSA_FIXED_REGISTER(srcdest - 26); + } else { + ins.ssa_args.dest = srcdest; + } + return ins; +} void schedule_program(compiler_context *ctx) |