Hexagon (target/hexagon) Additional instructions handled by idef-parser
PATCH 1/1 Hexagon (target/hexagon) Additional instructions handled by idef-parser
Currently, idef-parser skips all floating point instructions. However, there are some floating point instructions that can be handled.
The following instructions are now parsed
F2_sfimm_p
F2_sfimm_n
F2_dfimm_p
F2_dfimm_n
F2_dfmpyll
F2_dfmpylhTo make these instructions work, we fix some bugs in parser-helpers.c
gen_rvalue_extend
gen_cast_op
Test cases added to tests/tcg/hexagon/fpstuff.c
--- target/hexagon/idef-parser/parser-helpers.c | 16 +++--- tests/tcg/hexagon/fpstuff.c | 54 +++++++++++++++++++++ target/hexagon/gen_idef_parser_funcs.py | 10 +++- 3 files changed, 72 insertions(+), 8 deletions(-)
target/hexagon/idef-parser/parser-helpers.c +9 -7
@@ -386,13 +386,10 @@ HexValue gen_rvalue_extend(Context *c, YYLTYPE *locp, HexValue *rvalue)if (rvalue->type ==IMMEDIATE ) {HexValue res =gen_imm_qemu_tmp (c, locp,64 , rvalue->signedness); -bool is_unsigned = (rvalue->signedness ==UNSIGNED ); -const char *sign_suffix = is_unsigned ?"u" :"" ;gen_c_int_type (c, locp,64 , rvalue->signedness); -OUT (c, locp," " , &res," = " ); -OUT (c, locp,"(" , sign_suffix,"int64_t) " ); -OUT (c, locp,"(" , sign_suffix,"int32_t) " ); -OUT (c, locp, rvalue,";\n" ); +OUT (c, locp," " , &res," = (" ); +gen_c_int_type (c, locp,64 , rvalue->signedness); +OUT (c, locp,")" , rvalue,";\n" );return res; }else {HexValue res =gen_tmp (c, locp,64 , rvalue->signedness);
@@ -963,7 +960,12 @@ HexValue gen_cast_op(Context *c,if (src->bit_width == target_width) {return *src; }else if (src->type ==IMMEDIATE ) { -HexValue res = *src; +HexValue res; +if (src->bit_width < target_width) { + res =gen_rvalue_extend (c, locp, src); + }else { + res = *src; + } res.bit_width = target_width; res.signedness = signedness;return res;
tests/tcg/hexagon/fpstuff.c +54 -0
72 lines not on this page · raw message
target/hexagon/gen_idef_parser_funcs.py +9 -1
@@ -89,7 +89,15 @@ def main(): continue if ( tag.startswith('V6_') ) : continue - if ( tag.startswith('F') ) : + if ( tag.startswith('F') and + tag not in { + 'F2_sfimm_p', + 'F2_sfimm_n', + 'F2_dfimm_p', + 'F2_dfimm_n', + 'F2_dfmpyll', + 'F2_dfmpylh' + }): continue if ( tag.endswith('_locked') ) : continue
Signature · 1 line
2.25.1
Quoted 15 lines · Taylor Simpson
Currently, idef-parser skips all floating point instructions. However, there are some floating point instructions that can be handled.
The following instructions are now parsed
F2_sfimm_p F2_sfimm_n F2_dfimm_p F2_dfimm_n F2_dfmpyll F2_dfmpylhTo make these instructions work, we fix some bugs in
parser-helpers.c
gen_rvalue_extend
gen_cast_op
Quoted 8 lines
Test cases added to
tests/tcg/hexagon/fpstuff.cSigned-off-by Taylor Simpson <[email protected]>--- target/hexagon/idef-parser/parser-helpers.c | 16 +++--- tests/tcg/hexagon/fpstuff.c | 54 +++++++++++++++++++++ target/hexagon/gen_idef_parser_funcs.py | 10 +++- 3 files changed, 72 insertions(+), 8 deletions(-)
This patch looks good, nice catch on the bugs!