Skip to content

Templates

Generated page

This page is generated by gen_mipp_docs.py from the JSON Schemas of the generator (generator/helpers_headers/schemas/, generator/helpers_tests/schemas/). To change it, edit the description fields of the schemas, not this page.

Code templates of the implementation entries: simd_ext/<isa>/<isa>_native_templates.json, simd_ext/<isa>/<isa>_emu_templates.json, and the generic helpers_headers/generic_emu_templates.json, generic_emu_templates_mask.json and generic_emu_templates_lmulh.json, and the templates of the immediate versions, simd_ext/<isa>/<isa>_imm_templates.json (optional). A template is rendered once per function, datatype and LMUL with Jinja2 ({{ isa.prefix }}, {{ instr_name }}, {{ isa_dt_par.data_ext }}, ...) and with the MIPP placeholders of the templating DSL (%add<tp>%, %vd<tp>%, ...). The MIPP calls of a template are the dependencies of its entries.

ISA entries refer to a template by name (template), generic entries with a prefix (template_ref: tpl_generic_emu.<name>, tpl_mask_generic_emu.<name>, tpl_horiz_lmul_generic_emu.<name>). A template that no entry uses gets a dead-code warning.

Files (in generator/) Schema
simd_ext/<isa>/<isa>_native_templates.json
simd_ext/<isa>/<isa>_emu_templates.json
simd_ext/<isa>/<isa>_imm_templates.json
helpers_headers/generic_emu_templates.json
helpers_headers/generic_emu_templates_mask.json
helpers_headers/generic_emu_templates_lmulh.json
helpers_headers/schemas/templates_schema.json

Example

{
    "arith_2args_recp": {
        "format": "long",
        "code": [
            "%vd<tp>% recp;",
            "recp.vd = {{ isa.prefix }}{{ instr_name }}_{{ isa_dt_par.data_ext }}(vd1.vd);",
            "recp.vd = vmulq_{{ isa_dt_par.data_ext }}(recp.vd, vrecpsq_{{ isa_dt_par.data_ext }}(vd1.vd, recp.vd));",
            "%vd<tp>% res = %mul<tp>%(vd0, recp);",
            "return res;"
        ]
    }
}

Fields

Field Type Description
SNIPPET_END_MSK string Legacy, unused.
SNIPPET_END_MSKZ string Legacy, unused.
SNIPPET_END_MSKS string Legacy, unused.
<template> template or map of template A template, or a group of templates (accepted, unused).
<template>.<key> template

Definitions

template

Type: object. A template.

Field Type Description
format string short (default): code is the expression of the result; the generator declares res, assigns res.vd (or res.vm) and returns it. long: code is the whole body of the function. Values: short, long.
code string or array of string Required. Code, as a string or a list of lines.