i965: Rename brw_inst's functions that access the register type
[mesa.git] / src / intel / compiler / brw_reg_type.h
1 /*
2 * Copyright © 2017 Intel Corporation
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 BRW_REG_TYPE_H
25 #define BRW_REG_TYPE_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 enum brw_reg_file;
32 struct gen_device_info;
33
34 /*
35 * The ordering has been chosen so that no enum value is the same as a
36 * compatible hardware encoding.
37 */
38 enum PACKED brw_reg_type {
39 /** Floating-point types: @{ */
40 BRW_REGISTER_TYPE_DF,
41 BRW_REGISTER_TYPE_F,
42 BRW_REGISTER_TYPE_HF,
43 BRW_REGISTER_TYPE_VF,
44 /** @} */
45
46 /** Integer types: @{ */
47 BRW_REGISTER_TYPE_Q,
48 BRW_REGISTER_TYPE_UQ,
49 BRW_REGISTER_TYPE_D,
50 BRW_REGISTER_TYPE_UD,
51 BRW_REGISTER_TYPE_W,
52 BRW_REGISTER_TYPE_UW,
53 BRW_REGISTER_TYPE_B,
54 BRW_REGISTER_TYPE_UB,
55 BRW_REGISTER_TYPE_V,
56 BRW_REGISTER_TYPE_UV,
57 /** @} */
58
59 BRW_REGISTER_TYPE_LAST = BRW_REGISTER_TYPE_UV
60 };
61
62 unsigned
63 brw_reg_type_to_hw_type(const struct gen_device_info *devinfo,
64 enum brw_reg_file file, enum brw_reg_type type);
65
66 enum brw_reg_type
67 brw_hw_type_to_reg_type(const struct gen_device_info *devinfo,
68 enum brw_reg_file file, unsigned hw_type);
69
70 #define brw_element_size(devinfo, inst, operand) \
71 brw_hw_reg_type_to_size(devinfo, \
72 brw_inst_ ## operand ## _reg_file(devinfo, inst), \
73 brw_inst_ ## operand ## _reg_hw_type(devinfo, inst))
74 unsigned
75 brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
76 enum brw_reg_file file, unsigned hw_type);
77
78 #ifdef __cplusplus
79 }
80 #endif
81
82 #endif