broadcom/compiler: add generated v3d_nir_lower_algebraic
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25362>
This commit is contained in:
@@ -44,9 +44,20 @@ libbroadcom_compiler_files = files(
|
||||
'v3d_packing.c',
|
||||
)
|
||||
|
||||
v3d_nir_lower_algebraic_c = custom_target(
|
||||
'v3d_nir_lower_algebraic.c',
|
||||
input : 'v3d_nir_lower_algebraic.py',
|
||||
output : 'v3d_nir_lower_algebraic.c',
|
||||
command : [
|
||||
prog_python, '@INPUT@', '-p', dir_compiler_nir,
|
||||
],
|
||||
capture : true,
|
||||
depend_files : nir_algebraic_depends,
|
||||
)
|
||||
|
||||
libbroadcom_compiler = static_library(
|
||||
'broadcom_compiler',
|
||||
[libbroadcom_compiler_files, v3d_xml_pack],
|
||||
[libbroadcom_compiler_files, v3d_xml_pack, v3d_nir_lower_algebraic_c],
|
||||
include_directories : [inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_broadcom],
|
||||
c_args : [no_override_init_args],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
|
||||
@@ -1202,6 +1202,7 @@ bool v3d_nir_lower_txf_ms(nir_shader *s);
|
||||
bool v3d_nir_lower_image_load_store(nir_shader *s, struct v3d_compile *c);
|
||||
bool v3d_nir_lower_global_2x32(nir_shader *s);
|
||||
bool v3d_nir_lower_load_store_bitsize(nir_shader *s);
|
||||
bool v3d_nir_lower_algebraic(struct nir_shader *shader);
|
||||
|
||||
void v3d_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr);
|
||||
void v3d_vir_emit_image_load_store(struct v3d_compile *c,
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
a = 'a'
|
||||
|
||||
lower_alu = [
|
||||
(('f2i8', a), ('i2i8', ('f2i32', a))),
|
||||
(('f2i16', a), ('i2i16', ('f2i32', a))),
|
||||
|
||||
(('f2u8', a), ('u2u8', ('f2u32', a))),
|
||||
(('f2u16', a), ('u2u16', ('f2u32', a))),
|
||||
|
||||
(('i2f32', 'a@8'), ('i2f32', ('i2i32', a))),
|
||||
(('i2f32', 'a@16'), ('i2f32', ('i2i32', a))),
|
||||
|
||||
(('u2f32', 'a@8'), ('u2f32', ('u2u32', a))),
|
||||
(('u2f32', 'a@16'), ('u2f32', ('u2u32', a))),
|
||||
]
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-p', '--import-path', required=True)
|
||||
args = parser.parse_args()
|
||||
sys.path.insert(0, args.import_path)
|
||||
run()
|
||||
|
||||
def run():
|
||||
import nir_algebraic # pylint: disable=import-error
|
||||
|
||||
print('#include "v3d_compiler.h"')
|
||||
|
||||
print(nir_algebraic.AlgebraicPass("v3d_nir_lower_algebraic",
|
||||
lower_alu).render())
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user