diff options
author | jinbo <jinbo@loongson.cn> | 2025-07-25 13:56:54 +0800 |
---|---|---|
committer | jinboson <jinbo-hf@loongson.cn> | 2025-09-16 01:08:47 +0000 |
commit | 0612857826b187756267c27157697fa6ebb9bd3f (patch) | |
tree | f2a7598f12a3e57adcf1e7fc0c2fda4c54cd3d6b | |
parent | 810e71e4c4dfe76cd4268f94d36edc043a523326 (diff) |
LASX: Emit loop
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/248>
-rw-r--r-- | orc/loongarch/orclasx-internal.h | 1 | ||||
-rw-r--r-- | orc/loongarch/orclasxcompiler.c | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/orc/loongarch/orclasx-internal.h b/orc/loongarch/orclasx-internal.h index 5305936..5b1f00b 100644 --- a/orc/loongarch/orclasx-internal.h +++ b/orc/loongarch/orclasx-internal.h @@ -39,6 +39,7 @@ ORC_INTERNAL void orc_lasx_compiler_assemble (OrcCompiler * c); ORC_INTERNAL void orc_lasx_compiler_compute_loop_shift (OrcCompiler *c); ORC_INTERNAL void orc_lasx_compiler_emit_prologue (OrcCompiler *c); ORC_INTERNAL void orc_lasx_compiler_emit_epilogue (OrcCompiler *c); +ORC_INTERNAL void orc_lasx_compiler_load_constants (OrcCompiler *c); /* orclasxrules.c */ ORC_INTERNAL void orc_lasx_rules_init (OrcTarget * target); /* orclasxtarget.c */ diff --git a/orc/loongarch/orclasxcompiler.c b/orc/loongarch/orclasxcompiler.c index ac28195..53cbe46 100644 --- a/orc/loongarch/orclasxcompiler.c +++ b/orc/loongarch/orclasxcompiler.c @@ -81,6 +81,11 @@ orc_lasx_compiler_init (OrcCompiler *c) c->save_regs[ORC_VEC_REG_BASE + 32 + i] = 1; } + /*Small functions may run faster when unrolled.*/ + if (c->n_insns <= 10) { + c->unroll_shift = 1; + } + c->load_params = TRUE; } @@ -161,9 +166,32 @@ orc_lasx_compiler_emit_epilogue (OrcCompiler *c) } void +orc_lasx_compiler_load_constants (OrcCompiler *c) +{ + for (int i = 0; i < ORC_N_COMPILER_VARIABLES; i++) { + OrcVariable *var = c->vars + i; + if (var->name == NULL) + continue; + switch (var->vartype) { + case ORC_VAR_TYPE_SRC: + case ORC_VAR_TYPE_DEST: + orc_loongarch_insn_emit_ld_d (c, var->ptr_register, c->exec_reg, + ORC_STRUCT_OFFSET (OrcExecutor, arrays[i])); + break; + default: + break; + } + } + orc_compiler_emit_invariants (c); +} + +void orc_lasx_compiler_assemble (OrcCompiler *c) { orc_lasx_compiler_compute_loop_shift (c); orc_lasx_compiler_emit_prologue (c); + orc_lasx_compiler_load_constants (c); + orc_loongarch_compiler_emit_full_loop (c); + orc_loongarch_compiler_do_fixups (c); orc_lasx_compiler_emit_epilogue (c); } |