Path: blob/21.2-virgl/src/gallium/drivers/lima/ir/gp/codegen.h
4574 views
/*1* Copyright (c) 2017 Lima Project2* Copyright (c) 2013 Ben Brewer ([email protected])3* Copyright (c) 2013 Connor Abbott ([email protected])4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the "Software"),7* to deal in the Software without restriction, including without limitation8* the rights to use, copy, modify, merge, publish, distribute, sub license,9* and/or sell copies of the Software, and to permit persons to whom the10* Software is furnished to do so, subject to the following conditions:11*12* The above copyright notice and this permission notice (including the13* next paragraph) shall be included in all copies or substantial portions14* of the Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR17* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL19* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER20* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING21* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER22* DEALINGS IN THE SOFTWARE.23*24*/2526#ifndef LIMA_IR_GP_CODEGEN_H27#define LIMA_IR_GP_CODEGEN_H2829typedef enum {30gpir_codegen_src_attrib_x = 0,31gpir_codegen_src_attrib_y = 1,32gpir_codegen_src_attrib_z = 2,33gpir_codegen_src_attrib_w = 3,34gpir_codegen_src_register_x = 4,35gpir_codegen_src_register_y = 5,36gpir_codegen_src_register_z = 6,37gpir_codegen_src_register_w = 7,38gpir_codegen_src_unknown_0 = 8,39gpir_codegen_src_unknown_1 = 9,40gpir_codegen_src_unknown_2 = 10,41gpir_codegen_src_unknown_3 = 11,42gpir_codegen_src_load_x = 12,43gpir_codegen_src_load_y = 13,44gpir_codegen_src_load_z = 14,45gpir_codegen_src_load_w = 15,46gpir_codegen_src_p1_acc_0 = 16,47gpir_codegen_src_p1_acc_1 = 17,48gpir_codegen_src_p1_mul_0 = 18,49gpir_codegen_src_p1_mul_1 = 19,50gpir_codegen_src_p1_pass = 20,51gpir_codegen_src_unused = 21,52gpir_codegen_src_ident = 22,53gpir_codegen_src_p1_complex = 22,54gpir_codegen_src_p2_pass = 23,55gpir_codegen_src_p2_acc_0 = 24,56gpir_codegen_src_p2_acc_1 = 25,57gpir_codegen_src_p2_mul_0 = 26,58gpir_codegen_src_p2_mul_1 = 27,59gpir_codegen_src_p1_attrib_x = 28,60gpir_codegen_src_p1_attrib_y = 29,61gpir_codegen_src_p1_attrib_z = 30,62gpir_codegen_src_p1_attrib_w = 31,63} gpir_codegen_src;6465typedef enum {66gpir_codegen_load_off_ld_addr_0 = 1,67gpir_codegen_load_off_ld_addr_1 = 2,68gpir_codegen_load_off_ld_addr_2 = 3,69gpir_codegen_load_off_none = 7,70} gpir_codegen_load_off;7172typedef enum {73gpir_codegen_store_src_acc_0 = 0,74gpir_codegen_store_src_acc_1 = 1,75gpir_codegen_store_src_mul_0 = 2,76gpir_codegen_store_src_mul_1 = 3,77gpir_codegen_store_src_pass = 4,78gpir_codegen_store_src_unknown = 5,79gpir_codegen_store_src_complex = 6,80gpir_codegen_store_src_none = 7,81} gpir_codegen_store_src;8283typedef enum {84gpir_codegen_acc_op_add = 0,85gpir_codegen_acc_op_floor = 1,86gpir_codegen_acc_op_sign = 2,87gpir_codegen_acc_op_ge = 4,88gpir_codegen_acc_op_lt = 5,89gpir_codegen_acc_op_min = 6,90gpir_codegen_acc_op_max = 7,91} gpir_codegen_acc_op;9293typedef enum {94gpir_codegen_complex_op_nop = 0,95gpir_codegen_complex_op_exp2 = 2,96gpir_codegen_complex_op_log2 = 3,97gpir_codegen_complex_op_rsqrt = 4,98gpir_codegen_complex_op_rcp = 5,99gpir_codegen_complex_op_pass = 9,100gpir_codegen_complex_op_temp_store_addr = 12,101gpir_codegen_complex_op_temp_load_addr_0 = 13,102gpir_codegen_complex_op_temp_load_addr_1 = 14,103gpir_codegen_complex_op_temp_load_addr_2 = 15,104} gpir_codegen_complex_op;105106typedef enum {107gpir_codegen_mul_op_mul = 0,108gpir_codegen_mul_op_complex1 = 1,109gpir_codegen_mul_op_complex2 = 3,110gpir_codegen_mul_op_select = 4,111} gpir_codegen_mul_op;112113typedef enum {114gpir_codegen_pass_op_pass = 2,115gpir_codegen_pass_op_preexp2 = 4,116gpir_codegen_pass_op_postlog2 = 5,117gpir_codegen_pass_op_clamp = 6,118} gpir_codegen_pass_op;119120121typedef struct __attribute__((__packed__)) {122gpir_codegen_src mul0_src0 : 5;123gpir_codegen_src mul0_src1 : 5;124gpir_codegen_src mul1_src0 : 5;125gpir_codegen_src mul1_src1 : 5;126bool mul0_neg : 1;127bool mul1_neg : 1;128gpir_codegen_src acc0_src0 : 5;129gpir_codegen_src acc0_src1 : 5;130gpir_codegen_src acc1_src0 : 5;131gpir_codegen_src acc1_src1 : 5;132bool acc0_src0_neg : 1;133bool acc0_src1_neg : 1;134bool acc1_src0_neg : 1;135bool acc1_src1_neg : 1;136unsigned load_addr : 9;137gpir_codegen_load_off load_offset : 3;138unsigned register0_addr : 4;139bool register0_attribute : 1;140unsigned register1_addr : 4;141bool store0_temporary : 1;142bool store1_temporary : 1;143bool branch : 1;144bool branch_target_lo : 1;145gpir_codegen_store_src store0_src_x : 3;146gpir_codegen_store_src store0_src_y : 3;147gpir_codegen_store_src store1_src_z : 3;148gpir_codegen_store_src store1_src_w : 3;149gpir_codegen_acc_op acc_op : 3;150gpir_codegen_complex_op complex_op : 4;151unsigned store0_addr : 4;152bool store0_varying : 1;153unsigned store1_addr : 4;154bool store1_varying : 1;155gpir_codegen_mul_op mul_op : 3;156gpir_codegen_pass_op pass_op : 3;157gpir_codegen_src complex_src : 5;158gpir_codegen_src pass_src : 5;159unsigned unknown_1 : 4; /* 12: tmp_st, 13: branch */160unsigned branch_target : 8;161} gpir_codegen_instr;162163void gpir_disassemble_program(gpir_codegen_instr *code, unsigned num_instr);164165#endif166167168