target/arm: split out vfp_expand_imm
cover target/arm: split out vfp_expand_imm
One more piece of target/arm prep work from my SVE branch.
I saw that Alex was touching the same bit of code in his ARMv8.2 fp16 patch set and thought we should coordinate on this.
r~
Richard Henderson (2):
target/arm: Split out vfp_expand_imm
target/arm: Add fp16 support to vfp_expand_imm
target/arm/translate-a64.c | 49 +++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 16 deletions(-)
Signature · 1 line
2.13.6
PATCH 1/2 target/arm: Split out vfp_expand_imm
--- target/arm/translate-a64.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-)
target/arm/translate-a64.c +28 -16
@@ -5014,6 +5014,33 @@ static void disas_fp_3src(DisasContext *s, uint32_t insn) } } +/* The imm8 encodes the sign bit, enough bits to represent an exponent in +* the range 01....1xx to 10....0xx, and the most significant 4 bits of +* the mantissa; see VFPExpandImm() in the v8 ARM ARM. +*/ +static uint64_t vfp_expand_imm (int size,uint8_t imm8) +{ +uint64_t imm; + +switch (size) { +case MO_64 : + imm = (extract32 (imm8,7 ,1 ) ?0x8000 :0 ) | + (extract32 (imm8,6 ,1 ) ?0x3fc0 :0x4000 ) | +extract32 (imm8,0 ,6 ); + imm <<=48 ; +break ; +case MO_32 : + imm = (extract32 (imm8,7 ,1 ) ?0x8000 :0 ) | + (extract32 (imm8,6 ,1 ) ?0x3e00 :0x4000 ) | + (extract32 (imm8,0 ,6 ) <<3 ); + imm <<=16 ; +break ; +default : +g_assert_not_reached (); + } +return imm; +} +/* Floating point immediate * 31 30 29 28 24 23 22 21 20 13 12 10 9 5 4 0 * +---+---+---+-----------+------+---+------------+-------+------+------+
@@ -5037,22 +5064,7 @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)return ; } -/* The imm8 encodes the sign bit, enough bits to represent -* an exponent in the range 01....1xx to 10....0xx, -* and the most significant 4 bits of the mantissa; see -* VFPExpandImm() in the v8 ARM ARM. -*/ -if (is_double) { - imm = (extract32 (imm8,7 ,1 ) ?0x8000 :0 ) | - (extract32 (imm8,6 ,1 ) ?0x3fc0 :0x4000 ) | -extract32 (imm8,0 ,6 ); - imm <<=48 ; - }else { - imm = (extract32 (imm8,7 ,1 ) ?0x8000 :0 ) | - (extract32 (imm8,6 ,1 ) ?0x3e00 :0x4000 ) | - (extract32 (imm8,0 ,6 ) <<3 ); - imm <<=16 ; - } + imm =vfp_expand_imm (MO_32 + is_double, imm8); tcg_res =tcg_const_i64 (imm);write_fp_dreg (s, rd, tcg_res);
Signature · 1 line
2.13.6
PATCH 2/2 target/arm: Add fp16 support to vfp_expand_imm
In reply to Richard Henderson--- target/arm/translate-a64.c | 5 +++++ 1 file changed, 5 insertions(+)
target/arm/translate-a64.c +5 -0
@@ -5035,6 +5035,11 @@ static uint64_t vfp_expand_imm(int size, uint8_t imm8) (extract32 (imm8,0 ,6 ) <<3 ); imm <<=16 ;break ; +case MO_16 : + imm = (extract32 (imm8,7 ,1 ) ?0x8000 :0 ) | + (extract32 (imm8,6 ,1 ) ?0x3000 :0x4000 ) | + (extract32 (imm8,0 ,6 ) <<6 ); +break ;default :g_assert_not_reached (); }
Signature · 1 line
2.13.6
Quoted 4 lines · Richard Henderson
One more piece of target/arm prep work from my SVE branch.
I saw that Alex was touching the same bit of code in his ARMv8.2 fp16 patch set and thought we should coordinate on this.
Thanks, I'll roll them into my series.
Quoted 11 lines
r~
Richard Henderson (2):
target/arm: Split outvfp_expand_imm
target/arm: Add fp16 support tovfp_expand_immtarget/arm/translate-a64.c | 49 +++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 16 deletions(-)
--
Alex Bennée
Quoted 9 lines · Richard Henderson
One more piece of target/arm prep work from my SVE branch.
I saw that Alex was touching the same bit of code in his ARMv8.2 fp16 patch set and thought we should coordinate on this.
r~
Quoted 6 lines
Richard Henderson (2):
target/arm: Split outvfp_expand_imm
target/arm: Add fp16 support tovfp_expand_immtarget/arm/translate-a64.c | 49 +++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 16 deletions(-)
I could put these in target-arm.next now if you like ?
thanks
-- PMM
Quoted 10 lines · Peter Maydell
Quoted 6 lines
Richard Henderson (2):
target/arm: Split outvfp_expand_imm
target/arm: Add fp16 support tovfp_expand_immtarget/arm/translate-a64.c | 49 +++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 16 deletions(-)Reviewed-by Peter Maydell <[email protected]>I could put these in target-arm.next now if you like ?
Yes, please.
r~
Quoted 5 lines · Richard Henderson
Quoted 4 lines · Peter Maydell
Quoted 4 lines
Richard Henderson (2):
target/arm: Split outvfp_expand_imm
target/arm: Add fp16 support tovfp_expand_imm
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
target/arm/translate-a64.c | 49 +++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 16 deletions(-)Reviewed-by Peter Maydell <[email protected]>I could put these in target-arm.next now if you like ?
Yes, please.
OK, done.
thanks
-- PMM