vc4_qir.h revision a1f698881e13a4993e958815b79f8150d48e2739
1/* 2 * Copyright © 2014 Broadcom 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24#ifndef VC4_QIR_H 25#define VC4_QIR_H 26 27#include <assert.h> 28#include <stdio.h> 29#include <stdlib.h> 30#include <stdbool.h> 31#include <stdint.h> 32#include <string.h> 33 34#include "util/macros.h" 35#include "compiler/nir/nir.h" 36#include "util/list.h" 37#include "util/u_math.h" 38 39#include "vc4_screen.h" 40#include "vc4_qpu_defines.h" 41#include "kernel/vc4_packet.h" 42#include "pipe/p_state.h" 43 44struct nir_builder; 45 46enum qfile { 47 QFILE_NULL, 48 QFILE_TEMP, 49 QFILE_VARY, 50 QFILE_UNIF, 51 QFILE_VPM, 52 QFILE_TLB_COLOR_WRITE, 53 QFILE_TLB_COLOR_WRITE_MS, 54 QFILE_TLB_Z_WRITE, 55 QFILE_TLB_STENCIL_SETUP, 56 57 /* Payload registers that aren't in the physical register file, so we 58 * can just use the corresponding qpu_reg at qpu_emit time. 59 */ 60 QFILE_FRAG_X, 61 QFILE_FRAG_Y, 62 QFILE_FRAG_REV_FLAG, 63 64 /** 65 * Stores an immediate value in the index field that will be used 66 * directly by qpu_load_imm(). 67 */ 68 QFILE_LOAD_IMM, 69 70 /** 71 * Stores an immediate value in the index field that can be turned 72 * into a small immediate field by qpu_encode_small_immediate(). 73 */ 74 QFILE_SMALL_IMM, 75}; 76 77struct qreg { 78 enum qfile file; 79 uint32_t index; 80 int pack; 81}; 82 83static inline struct qreg qir_reg(enum qfile file, uint32_t index) 84{ 85 return (struct qreg){file, index}; 86} 87 88enum qop { 89 QOP_UNDEF, 90 QOP_MOV, 91 QOP_FMOV, 92 QOP_MMOV, 93 QOP_FADD, 94 QOP_FSUB, 95 QOP_FMUL, 96 QOP_V8MULD, 97 QOP_V8MIN, 98 QOP_V8MAX, 99 QOP_V8ADDS, 100 QOP_V8SUBS, 101 QOP_MUL24, 102 QOP_FMIN, 103 QOP_FMAX, 104 QOP_FMINABS, 105 QOP_FMAXABS, 106 QOP_ADD, 107 QOP_SUB, 108 QOP_SHL, 109 QOP_SHR, 110 QOP_ASR, 111 QOP_MIN, 112 QOP_MAX, 113 QOP_AND, 114 QOP_OR, 115 QOP_XOR, 116 QOP_NOT, 117 118 QOP_FTOI, 119 QOP_ITOF, 120 QOP_RCP, 121 QOP_RSQ, 122 QOP_EXP2, 123 QOP_LOG2, 124 QOP_VW_SETUP, 125 QOP_VR_SETUP, 126 QOP_TLB_COLOR_READ, 127 QOP_MS_MASK, 128 QOP_VARY_ADD_C, 129 130 QOP_FRAG_Z, 131 QOP_FRAG_W, 132 133 /** Texture x coordinate parameter write */ 134 QOP_TEX_S, 135 /** Texture y coordinate parameter write */ 136 QOP_TEX_T, 137 /** Texture border color parameter or cube map z coordinate write */ 138 QOP_TEX_R, 139 /** Texture LOD bias parameter write */ 140 QOP_TEX_B, 141 142 /** 143 * Texture-unit 4-byte read with address provided direct in S 144 * cooordinate. 145 * 146 * The first operand is the offset from the start of the UBO, and the 147 * second is the uniform that has the UBO's base pointer. 148 */ 149 QOP_TEX_DIRECT, 150 151 /** 152 * Signal of texture read being necessary and then reading r4 into 153 * the destination 154 */ 155 QOP_TEX_RESULT, 156 157 QOP_LOAD_IMM, 158}; 159 160struct queued_qpu_inst { 161 struct list_head link; 162 uint64_t inst; 163}; 164 165struct qinst { 166 struct list_head link; 167 168 enum qop op; 169 struct qreg dst; 170 struct qreg *src; 171 bool sf; 172 uint8_t cond; 173}; 174 175enum qstage { 176 /** 177 * Coordinate shader, runs during binning, before the VS, and just 178 * outputs position. 179 */ 180 QSTAGE_COORD, 181 QSTAGE_VERT, 182 QSTAGE_FRAG, 183}; 184 185enum quniform_contents { 186 /** 187 * Indicates that a constant 32-bit value is copied from the program's 188 * uniform contents. 189 */ 190 QUNIFORM_CONSTANT, 191 /** 192 * Indicates that the program's uniform contents are used as an index 193 * into the GL uniform storage. 194 */ 195 QUNIFORM_UNIFORM, 196 197 /** @{ 198 * Scaling factors from clip coordinates to relative to the viewport 199 * center. 200 * 201 * This is used by the coordinate and vertex shaders to produce the 202 * 32-bit entry consisting of 2 16-bit fields with 12.4 signed fixed 203 * point offsets from the viewport ccenter. 204 */ 205 QUNIFORM_VIEWPORT_X_SCALE, 206 QUNIFORM_VIEWPORT_Y_SCALE, 207 /** @} */ 208 209 QUNIFORM_VIEWPORT_Z_OFFSET, 210 QUNIFORM_VIEWPORT_Z_SCALE, 211 212 QUNIFORM_USER_CLIP_PLANE, 213 214 /** 215 * A reference to a texture config parameter 0 uniform. 216 * 217 * This is a uniform implicitly loaded with a QPU_W_TMU* write, which 218 * defines texture type, miplevels, and such. It will be found as a 219 * parameter to the first QOP_TEX_[STRB] instruction in a sequence. 220 */ 221 QUNIFORM_TEXTURE_CONFIG_P0, 222 223 /** 224 * A reference to a texture config parameter 1 uniform. 225 * 226 * This is a uniform implicitly loaded with a QPU_W_TMU* write, which 227 * defines texture width, height, filters, and wrap modes. It will be 228 * found as a parameter to the second QOP_TEX_[STRB] instruction in a 229 * sequence. 230 */ 231 QUNIFORM_TEXTURE_CONFIG_P1, 232 233 /** A reference to a texture config parameter 2 cubemap stride uniform */ 234 QUNIFORM_TEXTURE_CONFIG_P2, 235 236 QUNIFORM_TEXTURE_MSAA_ADDR, 237 238 QUNIFORM_UBO_ADDR, 239 240 QUNIFORM_TEXRECT_SCALE_X, 241 QUNIFORM_TEXRECT_SCALE_Y, 242 243 QUNIFORM_TEXTURE_BORDER_COLOR, 244 245 QUNIFORM_BLEND_CONST_COLOR_X, 246 QUNIFORM_BLEND_CONST_COLOR_Y, 247 QUNIFORM_BLEND_CONST_COLOR_Z, 248 QUNIFORM_BLEND_CONST_COLOR_W, 249 QUNIFORM_BLEND_CONST_COLOR_RGBA, 250 QUNIFORM_BLEND_CONST_COLOR_AAAA, 251 252 QUNIFORM_STENCIL, 253 254 QUNIFORM_ALPHA_REF, 255 QUNIFORM_SAMPLE_MASK, 256}; 257 258struct vc4_varying_slot { 259 uint8_t slot; 260 uint8_t swizzle; 261}; 262 263struct vc4_compiler_ubo_range { 264 /** 265 * offset in bytes from the start of the ubo where this range is 266 * uploaded. 267 * 268 * Only set once used is set. 269 */ 270 uint32_t dst_offset; 271 272 /** 273 * offset in bytes from the start of the gallium uniforms where the 274 * data comes from. 275 */ 276 uint32_t src_offset; 277 278 /** size in bytes of this ubo range */ 279 uint32_t size; 280 281 /** 282 * Set if this range is used by the shader for indirect uniforms 283 * access. 284 */ 285 bool used; 286}; 287 288struct vc4_key { 289 struct vc4_uncompiled_shader *shader_state; 290 struct { 291 enum pipe_format format; 292 uint8_t swizzle[4]; 293 union { 294 struct { 295 unsigned compare_mode:1; 296 unsigned compare_func:3; 297 unsigned wrap_s:3; 298 unsigned wrap_t:3; 299 }; 300 struct { 301 uint16_t msaa_width, msaa_height; 302 }; 303 }; 304 } tex[VC4_MAX_TEXTURE_SAMPLERS]; 305 uint8_t ucp_enables; 306}; 307 308struct vc4_fs_key { 309 struct vc4_key base; 310 enum pipe_format color_format; 311 bool depth_enabled; 312 bool stencil_enabled; 313 bool stencil_twoside; 314 bool stencil_full_writemasks; 315 bool is_points; 316 bool is_lines; 317 bool alpha_test; 318 bool point_coord_upper_left; 319 bool light_twoside; 320 bool msaa; 321 bool sample_coverage; 322 bool sample_alpha_to_coverage; 323 bool sample_alpha_to_one; 324 uint8_t alpha_test_func; 325 uint8_t logicop_func; 326 uint32_t point_sprite_mask; 327 328 struct pipe_rt_blend_state blend; 329}; 330 331struct vc4_vs_key { 332 struct vc4_key base; 333 334 /** 335 * This is a proxy for the array of FS input semantics, which is 336 * larger than we would want to put in the key. 337 */ 338 uint64_t compiled_fs_id; 339 340 enum pipe_format attr_formats[8]; 341 bool is_coord; 342 bool per_vertex_point_size; 343}; 344 345struct vc4_compile { 346 struct vc4_context *vc4; 347 nir_shader *s; 348 nir_function_impl *impl; 349 struct exec_list *cf_node_list; 350 351 /** 352 * Mapping from nir_register * or nir_ssa_def * to array of struct 353 * qreg for the values. 354 */ 355 struct hash_table *def_ht; 356 357 /* For each temp, the instruction generating its value. */ 358 struct qinst **defs; 359 uint32_t defs_array_size; 360 361 /** 362 * Inputs to the shader, arranged by TGSI declaration order. 363 * 364 * Not all fragment shader QFILE_VARY reads are present in this array. 365 */ 366 struct qreg *inputs; 367 struct qreg *outputs; 368 bool msaa_per_sample_output; 369 struct qreg color_reads[VC4_MAX_SAMPLES]; 370 struct qreg sample_colors[VC4_MAX_SAMPLES]; 371 uint32_t inputs_array_size; 372 uint32_t outputs_array_size; 373 uint32_t uniforms_array_size; 374 375 struct vc4_compiler_ubo_range *ubo_ranges; 376 uint32_t ubo_ranges_array_size; 377 /** Number of uniform areas declared in ubo_ranges. */ 378 uint32_t num_uniform_ranges; 379 /** Number of uniform areas used for indirect addressed loads. */ 380 uint32_t num_ubo_ranges; 381 uint32_t next_ubo_dst_offset; 382 383 struct qreg line_x, point_x, point_y; 384 struct qreg discard; 385 struct qreg payload_FRAG_Z; 386 struct qreg payload_FRAG_W; 387 388 uint8_t vattr_sizes[8]; 389 390 /** 391 * Array of the VARYING_SLOT_* of all FS QFILE_VARY reads. 392 * 393 * This includes those that aren't part of the VPM varyings, like 394 * point/line coordinates. 395 */ 396 struct vc4_varying_slot *input_slots; 397 uint32_t num_input_slots; 398 uint32_t input_slots_array_size; 399 400 /** 401 * An entry per outputs[] in the VS indicating what the VARYING_SLOT_* 402 * of the output is. Used to emit from the VS in the order that the 403 * FS needs. 404 */ 405 struct vc4_varying_slot *output_slots; 406 407 struct pipe_shader_state *shader_state; 408 struct vc4_key *key; 409 struct vc4_fs_key *fs_key; 410 struct vc4_vs_key *vs_key; 411 412 uint32_t *uniform_data; 413 enum quniform_contents *uniform_contents; 414 uint32_t uniform_array_size; 415 uint32_t num_uniforms; 416 uint32_t num_outputs; 417 uint32_t num_texture_samples; 418 uint32_t output_position_index; 419 uint32_t output_color_index; 420 uint32_t output_point_size_index; 421 uint32_t output_sample_mask_index; 422 423 struct qreg undef; 424 enum qstage stage; 425 uint32_t num_temps; 426 struct list_head instructions; 427 428 struct list_head qpu_inst_list; 429 uint64_t *qpu_insts; 430 uint32_t qpu_inst_count; 431 uint32_t qpu_inst_size; 432 uint32_t num_inputs; 433 434 uint32_t program_id; 435 uint32_t variant_id; 436}; 437 438/* Special nir_load_input intrinsic index for loading the current TLB 439 * destination color. 440 */ 441#define VC4_NIR_TLB_COLOR_READ_INPUT 2000000000 442 443#define VC4_NIR_MS_MASK_OUTPUT 2000000000 444 445/* Special offset for nir_load_uniform values to get a QUNIFORM_* 446 * state-dependent value. 447 */ 448#define VC4_NIR_STATE_UNIFORM_OFFSET 1000000000 449 450struct vc4_compile *qir_compile_init(void); 451void qir_compile_destroy(struct vc4_compile *c); 452struct qinst *qir_inst(enum qop op, struct qreg dst, 453 struct qreg src0, struct qreg src1); 454struct qinst *qir_inst4(enum qop op, struct qreg dst, 455 struct qreg a, 456 struct qreg b, 457 struct qreg c, 458 struct qreg d); 459void qir_remove_instruction(struct vc4_compile *c, struct qinst *qinst); 460struct qreg qir_uniform(struct vc4_compile *c, 461 enum quniform_contents contents, 462 uint32_t data); 463void qir_schedule_instructions(struct vc4_compile *c); 464void qir_reorder_uniforms(struct vc4_compile *c); 465 466void qir_emit(struct vc4_compile *c, struct qinst *inst); 467static inline struct qinst * 468qir_emit_nodef(struct vc4_compile *c, struct qinst *inst) 469{ 470 list_addtail(&inst->link, &c->instructions); 471 return inst; 472} 473 474struct qreg qir_get_temp(struct vc4_compile *c); 475int qir_get_op_nsrc(enum qop qop); 476bool qir_reg_equals(struct qreg a, struct qreg b); 477bool qir_has_side_effects(struct vc4_compile *c, struct qinst *inst); 478bool qir_has_side_effect_reads(struct vc4_compile *c, struct qinst *inst); 479bool qir_is_mul(struct qinst *inst); 480bool qir_is_raw_mov(struct qinst *inst); 481bool qir_is_tex(struct qinst *inst); 482bool qir_is_float_input(struct qinst *inst); 483bool qir_depends_on_flags(struct qinst *inst); 484bool qir_writes_r4(struct qinst *inst); 485struct qreg qir_follow_movs(struct vc4_compile *c, struct qreg reg); 486 487void qir_dump(struct vc4_compile *c); 488void qir_dump_inst(struct vc4_compile *c, struct qinst *inst); 489const char *qir_get_stage_name(enum qstage stage); 490 491void qir_validate(struct vc4_compile *c); 492 493void qir_optimize(struct vc4_compile *c); 494bool qir_opt_algebraic(struct vc4_compile *c); 495bool qir_opt_constant_folding(struct vc4_compile *c); 496bool qir_opt_copy_propagation(struct vc4_compile *c); 497bool qir_opt_dead_code(struct vc4_compile *c); 498bool qir_opt_small_immediates(struct vc4_compile *c); 499bool qir_opt_vpm(struct vc4_compile *c); 500void vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c); 501void vc4_nir_lower_io(nir_shader *s, struct vc4_compile *c); 502nir_ssa_def *vc4_nir_get_state_uniform(struct nir_builder *b, 503 enum quniform_contents contents); 504nir_ssa_def *vc4_nir_get_swizzled_channel(struct nir_builder *b, 505 nir_ssa_def **srcs, int swiz); 506void vc4_nir_lower_txf_ms(nir_shader *s, struct vc4_compile *c); 507void qir_lower_uniforms(struct vc4_compile *c); 508 509uint32_t qpu_schedule_instructions(struct vc4_compile *c); 510 511void qir_SF(struct vc4_compile *c, struct qreg src); 512 513static inline struct qreg 514qir_uniform_ui(struct vc4_compile *c, uint32_t ui) 515{ 516 return qir_uniform(c, QUNIFORM_CONSTANT, ui); 517} 518 519static inline struct qreg 520qir_uniform_f(struct vc4_compile *c, float f) 521{ 522 return qir_uniform(c, QUNIFORM_CONSTANT, fui(f)); 523} 524 525#define QIR_ALU0(name) \ 526static inline struct qreg \ 527qir_##name(struct vc4_compile *c) \ 528{ \ 529 struct qreg t = qir_get_temp(c); \ 530 qir_emit(c, qir_inst(QOP_##name, t, c->undef, c->undef)); \ 531 return t; \ 532} 533 534#define QIR_ALU1(name) \ 535static inline struct qreg \ 536qir_##name(struct vc4_compile *c, struct qreg a) \ 537{ \ 538 struct qreg t = qir_get_temp(c); \ 539 qir_emit(c, qir_inst(QOP_##name, t, a, c->undef)); \ 540 return t; \ 541} \ 542static inline struct qinst * \ 543qir_##name##_dest(struct vc4_compile *c, struct qreg dest, \ 544 struct qreg a) \ 545{ \ 546 if (dest.file == QFILE_TEMP) \ 547 c->defs[dest.index] = NULL; \ 548 return qir_emit_nodef(c, qir_inst(QOP_##name, dest, a, \ 549 c->undef)); \ 550} 551 552#define QIR_ALU2(name) \ 553static inline struct qreg \ 554qir_##name(struct vc4_compile *c, struct qreg a, struct qreg b) \ 555{ \ 556 struct qreg t = qir_get_temp(c); \ 557 qir_emit(c, qir_inst(QOP_##name, t, a, b)); \ 558 return t; \ 559} \ 560static inline void \ 561qir_##name##_dest(struct vc4_compile *c, struct qreg dest, \ 562 struct qreg a, struct qreg b) \ 563{ \ 564 qir_emit_nodef(c, qir_inst(QOP_##name, dest, a, b)); \ 565} 566 567#define QIR_NODST_1(name) \ 568static inline struct qinst * \ 569qir_##name(struct vc4_compile *c, struct qreg a) \ 570{ \ 571 struct qinst *inst = qir_inst(QOP_##name, c->undef, \ 572 a, c->undef); \ 573 qir_emit(c, inst); \ 574 return inst; \ 575} 576 577#define QIR_NODST_2(name) \ 578static inline struct qinst * \ 579qir_##name(struct vc4_compile *c, struct qreg a, struct qreg b) \ 580{ \ 581 struct qinst *inst = qir_inst(QOP_##name, c->undef, \ 582 a, b); \ 583 qir_emit(c, inst); \ 584 return inst; \ 585} 586 587#define QIR_PACK(name) \ 588static inline struct qreg \ 589qir_##name(struct vc4_compile *c, struct qreg dest, struct qreg a) \ 590{ \ 591 qir_emit_nodef(c, qir_inst(QOP_##name, dest, a, c->undef)); \ 592 return dest; \ 593} 594 595#define QIR_PAYLOAD(name) \ 596static inline struct qreg \ 597qir_##name(struct vc4_compile *c) \ 598{ \ 599 struct qreg *payload = &c->payload_##name; \ 600 if (payload->file != QFILE_NULL) \ 601 return *payload; \ 602 *payload = qir_get_temp(c); \ 603 struct qinst *inst = qir_inst(QOP_##name, *payload, \ 604 c->undef, c->undef); \ 605 list_add(&inst->link, &c->instructions); \ 606 c->defs[payload->index] = inst; \ 607 return *payload; \ 608} 609 610QIR_ALU1(MOV) 611QIR_ALU1(FMOV) 612QIR_ALU1(MMOV) 613QIR_ALU2(FADD) 614QIR_ALU2(FSUB) 615QIR_ALU2(FMUL) 616QIR_ALU2(V8MULD) 617QIR_ALU2(V8MIN) 618QIR_ALU2(V8MAX) 619QIR_ALU2(V8ADDS) 620QIR_ALU2(V8SUBS) 621QIR_ALU2(MUL24) 622QIR_ALU2(FMIN) 623QIR_ALU2(FMAX) 624QIR_ALU2(FMINABS) 625QIR_ALU2(FMAXABS) 626QIR_ALU1(FTOI) 627QIR_ALU1(ITOF) 628 629QIR_ALU2(ADD) 630QIR_ALU2(SUB) 631QIR_ALU2(SHL) 632QIR_ALU2(SHR) 633QIR_ALU2(ASR) 634QIR_ALU2(MIN) 635QIR_ALU2(MAX) 636QIR_ALU2(AND) 637QIR_ALU2(OR) 638QIR_ALU2(XOR) 639QIR_ALU1(NOT) 640 641QIR_ALU1(RCP) 642QIR_ALU1(RSQ) 643QIR_ALU1(EXP2) 644QIR_ALU1(LOG2) 645QIR_ALU1(VARY_ADD_C) 646QIR_NODST_2(TEX_S) 647QIR_NODST_2(TEX_T) 648QIR_NODST_2(TEX_R) 649QIR_NODST_2(TEX_B) 650QIR_NODST_2(TEX_DIRECT) 651QIR_PAYLOAD(FRAG_Z) 652QIR_PAYLOAD(FRAG_W) 653QIR_ALU0(TEX_RESULT) 654QIR_ALU0(TLB_COLOR_READ) 655QIR_NODST_1(MS_MASK) 656 657static inline struct qreg 658qir_SEL(struct vc4_compile *c, uint8_t cond, struct qreg src0, struct qreg src1) 659{ 660 struct qreg t = qir_get_temp(c); 661 struct qinst *a = qir_MOV_dest(c, t, src0); 662 struct qinst *b = qir_MOV_dest(c, t, src1); 663 a->cond = cond; 664 b->cond = cond ^ 1; 665 return t; 666} 667 668static inline struct qreg 669qir_UNPACK_8_F(struct vc4_compile *c, struct qreg src, int i) 670{ 671 struct qreg t = qir_FMOV(c, src); 672 c->defs[t.index]->src[0].pack = QPU_UNPACK_8A + i; 673 return t; 674} 675 676static inline struct qreg 677qir_UNPACK_8_I(struct vc4_compile *c, struct qreg src, int i) 678{ 679 struct qreg t = qir_MOV(c, src); 680 c->defs[t.index]->src[0].pack = QPU_UNPACK_8A + i; 681 return t; 682} 683 684static inline struct qreg 685qir_UNPACK_16_F(struct vc4_compile *c, struct qreg src, int i) 686{ 687 struct qreg t = qir_FMOV(c, src); 688 c->defs[t.index]->src[0].pack = QPU_UNPACK_16A + i; 689 return t; 690} 691 692static inline struct qreg 693qir_UNPACK_16_I(struct vc4_compile *c, struct qreg src, int i) 694{ 695 struct qreg t = qir_MOV(c, src); 696 c->defs[t.index]->src[0].pack = QPU_UNPACK_16A + i; 697 return t; 698} 699 700static inline void 701qir_PACK_8_F(struct vc4_compile *c, struct qreg dest, struct qreg val, int chan) 702{ 703 assert(!dest.pack); 704 dest.pack = QPU_PACK_MUL_8A + chan; 705 qir_emit(c, qir_inst(QOP_MMOV, dest, val, c->undef)); 706 if (dest.file == QFILE_TEMP) 707 c->defs[dest.index] = NULL; 708} 709 710static inline struct qreg 711qir_PACK_8888_F(struct vc4_compile *c, struct qreg val) 712{ 713 struct qreg dest = qir_MMOV(c, val); 714 c->defs[dest.index]->dst.pack = QPU_PACK_MUL_8888; 715 return dest; 716} 717 718static inline struct qreg 719qir_POW(struct vc4_compile *c, struct qreg x, struct qreg y) 720{ 721 return qir_EXP2(c, qir_FMUL(c, 722 y, 723 qir_LOG2(c, x))); 724} 725 726static inline void 727qir_VPM_WRITE(struct vc4_compile *c, struct qreg val) 728{ 729 qir_MOV_dest(c, qir_reg(QFILE_VPM, 0), val); 730} 731 732static inline struct qreg 733qir_LOAD_IMM(struct vc4_compile *c, uint32_t val) 734{ 735 struct qreg t = qir_get_temp(c); 736 qir_emit(c, qir_inst(QOP_LOAD_IMM, t, 737 qir_reg(QFILE_LOAD_IMM, val), c->undef)); 738 return t; 739} 740 741#endif /* VC4_QIR_H */ 742