arm64/fpsimdmacros: Allow the macro "for" to be used in more cases
authorJulien Grall <julien.grall@arm.com>
Fri, 28 Aug 2020 18:11:50 +0000 (19:11 +0100)
committerWill Deacon <will@kernel.org>
Mon, 21 Sep 2020 17:06:33 +0000 (18:06 +0100)
commit6d40f05fad0babfb3e991edb2d0bd28a30a2f10c
treeb11a06d6799175f0a8e26eff094f94923d4e28e2
parent315cf047d230a363515bedce177cfbf460cbb2d6
arm64/fpsimdmacros: Allow the macro "for" to be used in more cases

The current version of the macro "for" is not able to work when the
counter is used to generate registers using mnemonics. This is because
gas is not able to evaluate the expression generated if used in
register's name (i.e x\n).

Gas offers a way to evaluate macro arguments by using % in front of
them under the alternate macro mode.

The implementation of "for" is updated to use the alternate macro mode
and %, so we can use the macro in more cases. As the alternate macro
mode may have side-effects, this is disabled when expanding the body.

While it is enough to prefix the argument of the macro "__for_body"
with %, the arguments of "__for" are also prefixed to get a more
bearable value in case of compilation error.

Suggested-by: Dave Martin <dave.martin@arm.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Link: https://lore.kernel.org/r/20200828181155.17745-4-broonie@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/fpsimdmacros.h