// vim: ft=arm
{% from "armv7neon_mmm_q_ops.j2" import scalar %}

{{ scalar("scalar_min", "vmin.s32", from, to) }}
{{ scalar("scalar_max", "vmax.s32", from, to) }}
{{ scalar("scalar_mul", "vmul.s32", from, to) }}
{{ scalar("scalar_add", "vadd.s32", from, to) }}
{{ scalar("scalar_sub", "vsub.s32", from, to) }}
{{ scalar("scalar_sub_flipped", "vsub.s32", from, to, flipped=true) }}

.leaky_relu:
    vmov            s0, r3
    vdup.32         q0, d0[0]
    {% for reg in range(from, to + 1) %}
        vmul.s32    q2, q{{reg}}, q0
        vcgt.s32    q1, q{{reg}}, 0
        vbsl        q1, q{{reg}}, q2
        vmov        q{{reg}}, q1
    {% endfor %}
    b .non_linear_loop
