panfrost: Use pack for Bifrost test state
[mesa.git] / src / panfrost / bifrost / bi_print_common.c
1 /*
2 * Copyright (C) 2019 Connor Abbott <cwabbott0@gmail.com>
3 * Copyright (C) 2019 Lyude Paul <thatslyude@gmail.com>
4 * Copyright (C) 2019 Ryan Houdek <Sonicadvance1@gmail.com>
5 * Copyright (C) 2019-2020 Collabora, Ltd.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
16 * Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
25 */
26
27 /* Prints shared with the disassembler */
28
29 #include "bi_print_common.h"
30
31 const char *
32 bi_clause_type_name(enum bifrost_clause_type T)
33 {
34 switch (T) {
35 case BIFROST_CLAUSE_NONE: return "";
36 case BIFROST_CLAUSE_LOAD_VARY: return "load_vary";
37 case BIFROST_CLAUSE_UBO: return "ubo";
38 case BIFROST_CLAUSE_TEX: return "tex";
39 case BIFROST_CLAUSE_SSBO_LOAD: return "load";
40 case BIFROST_CLAUSE_SSBO_STORE: return "store";
41 case BIFROST_CLAUSE_BLEND: return "blend";
42 case BIFROST_CLAUSE_FRAGZ: return "fragz";
43 case BIFROST_CLAUSE_ATEST: return "atest";
44 case BIFROST_CLAUSE_64BIT: return "64";
45 default: return "??";
46 }
47 }
48
49 const char *
50 bi_output_mod_name(enum bifrost_outmod mod)
51 {
52 switch (mod) {
53 case BIFROST_NONE: return "";
54 case BIFROST_POS: return ".pos";
55 case BIFROST_SAT_SIGNED: return ".sat_signed";
56 case BIFROST_SAT: return ".sat";
57 default: return "invalid";
58 }
59 }
60
61 const char *
62 bi_minmax_mode_name(enum bifrost_minmax_mode mod)
63 {
64 switch (mod) {
65 case BIFROST_MINMAX_NONE: return "";
66 case BIFROST_NAN_WINS: return ".nan_wins";
67 case BIFROST_SRC1_WINS: return ".src1_wins";
68 case BIFROST_SRC0_WINS: return ".src0_wins";
69 default: return "invalid";
70 }
71 }
72
73 const char *
74 bi_round_mode_name(enum bifrost_roundmode mod)
75 {
76 switch (mod) {
77 case BIFROST_RTE: return "";
78 case BIFROST_RTP: return ".rtp";
79 case BIFROST_RTN: return ".rtn";
80 case BIFROST_RTZ: return ".rtz";
81 default: return "invalid";
82 }
83 }
84
85 const char *
86 bi_csel_cond_name(enum bifrost_csel_cond cond)
87 {
88 switch (cond) {
89 case BIFROST_FEQ_F: return "feq.f";
90 case BIFROST_FGT_F: return "fgt.f";
91 case BIFROST_FGE_F: return "fge.f";
92 case BIFROST_IEQ_F: return "ieq.f";
93 case BIFROST_IGT_I: return "igt.i";
94 case BIFROST_IGE_I: return "uge.i";
95 case BIFROST_UGT_I: return "ugt.i";
96 case BIFROST_UGE_I: return "uge.i";
97 default: return "invalid";
98 }
99 }
100
101 const char *
102 bi_interp_mode_name(enum bifrost_interp_mode mode)
103 {
104 switch (mode) {
105 case BIFROST_INTERP_PER_FRAG: return ".per_frag";
106 case BIFROST_INTERP_CENTROID: return ".centroid";
107 case BIFROST_INTERP_DEFAULT: return "";
108 case BIFROST_INTERP_EXPLICIT: return ".explicit";
109 default: return ".unknown";
110 }
111 }
112
113 const char *
114 bi_ldst_type_name(enum bifrost_ldst_type type)
115 {
116 switch (type) {
117 case BIFROST_LDST_F16: return "f16";
118 case BIFROST_LDST_F32: return "f32";
119 case BIFROST_LDST_I32: return "i32";
120 case BIFROST_LDST_U32: return "u32";
121 default: return "invalid";
122 }
123 }