diff options
author | Tamar Christina <tamar.christina@arm.com> | 2018-05-10 16:22:32 +0100 |
---|---|---|
committer | Tamar Christina <tamar.christina@arm.com> | 2018-05-10 16:43:28 +0100 |
commit | 58ed5c38f52511e73c9748b86c319320177fb0ca (patch) | |
tree | d6a80c5b465e846aba3589a55b27503e4cdded35 | |
parent | 190852c8ac75cb62a737c58edfadfb0e1fcef78a (diff) | |
download | gdb-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.
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/tc-arm.c | 8 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/vfp-mov-enc.d | 13 | ||||
-rw-r--r-- | gas/testsuite/gas/arm/vfp-mov-enc.s | 6 |
4 files changed, 34 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 424baba..c1687b4 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2018-05-10 Tamar Christina <tamar.christina@arm.com> + + * 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. + 2018-05-09 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (xtensa_is_init_fini): New function. 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); diff --git a/gas/testsuite/gas/arm/vfp-mov-enc.d b/gas/testsuite/gas/arm/vfp-mov-enc.d new file mode 100644 index 0000000..5c4b266 --- /dev/null +++ b/gas/testsuite/gas/arm/vfp-mov-enc.d @@ -0,0 +1,13 @@ +# name: VFP check vmov supports integer immediates +# as: -mcpu=cortex-a8 -mfpu=vfpv3 +# objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*arm.* + +Disassembly of section .text: +0[0-9a-f]+ <[^>]+> 4ef2da06 vmovmi.f32 s27, #38 ; 0x41300000 11.0 +0[0-9a-f]+ <[^>]+> 4ef2da06 vmovmi.f32 s27, #38 ; 0x41300000 11.0 +0[0-9a-f]+ <[^>]+> 4ef7da00 vmovmi.f32 s27, #112 ; 0x3f800000 1.0 +0[0-9a-f]+ <[^>]+> 4ef7da00 vmovmi.f32 s27, #112 ; 0x3f800000 1.0 +0[0-9a-f]+ <[^>]+> cebb1b04 vmovgt.f64 d1, #180 ; 0xc1a00000 -20.0 +0[0-9a-f]+ <[^>]+> ceb81b00 vmovgt.f64 d1, #128 ; 0xc0000000 -2.0 diff --git a/gas/testsuite/gas/arm/vfp-mov-enc.s b/gas/testsuite/gas/arm/vfp-mov-enc.s new file mode 100644 index 0000000..4362fb1 --- /dev/null +++ b/gas/testsuite/gas/arm/vfp-mov-enc.s @@ -0,0 +1,6 @@ +VMOVMI.F32 s27,#11 +VMOVMI.F32 s27,#11.0 +VMOVMI.F32 s27,#1 +VMOVMI.F32 s27,#1.0 +VMOVGT.F64 d1,#-20 +VMOVGT.F64 d1,#-2 |