aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-arm.c
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2018-05-10 16:22:32 +0100
committerTamar Christina <tamar.christina@arm.com>2018-05-10 16:43:28 +0100
commit58ed5c38f52511e73c9748b86c319320177fb0ca (patch)
treed6a80c5b465e846aba3589a55b27503e4cdded35 /gas/config/tc-arm.c
parent190852c8ac75cb62a737c58edfadfb0e1fcef78a (diff)
downloadgdb-58ed5c38f52511e73c9748b86c319320177fb0ca.zip
gdb-58ed5c38f52511e73c9748b86c319320177fb0ca.tar.gz
gdb-58ed5c38f52511e73c9748b86c319320177fb0ca.tar.bz2
Allow integer immediate for VFP vmov instructions.
This patch fixes the case where you want to use an integer value the floating point immediate to a VFP vmov instruction such as vmovmi.f32 s27, #11. If the immediate is not a float we convert it and copy it's representation into the imm field and then carry on validating as if we originally entered a floating point immediate. The is considered a QoL improvement for hand assembly writers and allows more code portability between assembler. gas/ * gas/config/tc-arm.c (do_neon_mov): Allow integer literal for float immediate. * testsuite/gas/arm/vfp-mov-enc.s: New. * testsuite/gas/arm/vfp-mov-enc.d: New.
Diffstat (limited to 'gas/config/tc-arm.c')
-rw-r--r--gas/config/tc-arm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 760afab..dbaf162 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -16691,6 +16691,14 @@ do_neon_mov (void)
case NS_FI: /* case 10 (fconsts). */
ldconst = "fconsts";
encode_fconstd:
+ if (!inst.operands[1].immisfloat)
+ {
+ /* Immediate has to fit in 8 bits so float is enough. */
+ float imm = (float)inst.operands[1].imm;
+ memcpy (&inst.operands[1].imm, &imm, sizeof (float));
+ inst.operands[1].immisfloat = 1;
+ }
+
if (is_quarter_float (inst.operands[1].imm))
{
inst.operands[1].imm = neon_qfloat_bits (inst.operands[1].imm);