Skip to content

Instantly share code, notes, and snippets.

View rasky's full-sized avatar

Giovanni Bajo rasky

  • Develer S.r.l.
View GitHub Profile
@rasky
rasky / vsll.inc
Last active April 22, 2020 17:40
# Helper macros for vector shifts.
# How to use:
# 1) Call macro "vsll_data"/"vsll8_data" in the data segment to define the required constants
# 2) Call macro "setup_vsll <VREG>" / "setup_vsll8 <VREG>" in code, passing in one vreg that will hold shift constants
# 3) You can now use the following macros:
# * "vsll <VREG-DST>, <VREG-SRC>, <QTY>" to perform a left shift from 0 to 7 bits.
# * "vsll8 <VREG-DST>, <VREG-SRC>, <QTY>" to perform a left shift from 8 to 15 bits.
# * "vsrl <VREG-DST>, <VREG-SRC>, <QTY>" to perform a logical (unsigned) right shift from 0 to 7 bits.
# * "vsrl8 <VREG-DST>, <VREG-SRC>, <QTY>" to perform a logical (unsigned) right shift from 8 to 15 bits.
# * "vsra <VREG-DST>, <VREG-SRC>, <QTY>" to perform an arithmetic (signed) shift from 0 to 7 bits.