From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jerry Quinn" To: binutils@sourceware.cygnus.com Subject: Patch: add pa2.0 media instructions Date: Thu, 05 Aug 1999 14:24:00 -0000 Message-id: <15696.933888286.0@NO-ID-FOUND.mhonarc.org> X-SW-Source: 1999-08/msg00033.html Here's some more pa2.0 instructions and test cases. This covers the halfword multimedia instructions. ChangeLog entry: Thu Aug 5 17:18:11 EDT 1999 Jerry Quinn * include/opcode/hppa.h (pa_opcodes): Add pa2.0 instructions hadd, hshl, hshr, hsub, mixh, mixw, permh. * gas/tc-hppa.c (pa_ip): Add completer codes 'a', 'ch', 'cH', 'cS', and 'c*'. * opcodes/hppa-dis.c (signed_unsigned_names,mix_half_names, saturation_names): New. (print_insn_hppa): Add completer codes 'a', 'ch', 'cH', 'cS', and 'c*'. * gas/testsuite/gas/hppa/basic/basic.exp: * gas/testsuite/gas/hppa/basic/media.s: Add test cases for new instructions. *** pa-prev/include/opcode/hppa.h Tue Aug 3 17:11:06 1999 --- gas-src/include/opcode/hppa.h Thu Aug 5 17:01:58 1999 *************** *** 70,78 **** In the args field, the following characters are unused: ! ' "# %& *+- / :;< > @' ' C LM U YZ[\] ' ! 'a d l {|} ' Here are all the characters: --- 70,78 ---- In the args field, the following characters are unused: ! ' "# %& +- / :;< > @' ' C LM U YZ[\] ' ! ' d l {|} ' Here are all the characters: *************** *** 84,89 **** --- 84,90 ---- x integer register field at 15. b integer register field at 10. t integer register field at 31. + a integer register field at 10 and 15 (for PERMH) y floating point register field at 31 5 5 bit immediate at 15. s 2 bit space specifier at 17. *************** *** 104,109 **** --- 105,114 ---- cm short load and store completer. cs store bytes short completer. cZ System Control Completer (to support LPA, LHA, etc.) + ch left/right half completer + cH signed/unsigned saturation completer + cS signed/unsigned completer at 21 + c* permutation completer Condition operands all have '?' as the prefix: *************** *** 143,148 **** --- 148,154 ---- Also these: . 2 bit shift amount at 25 + * 4 bit shift amount at 25 p 5 bit shift count at 26 (to support the SHD instruction) encoded as 31-p ~ 6 bit shift count at 20,22:26 encoded as 63-~. *************** *** 305,312 **** { "addibt", 0xa4000000, 0xfc000000, "?dn5,b,w", pa10}, { "addibf", 0xac000000, 0xfc000000, "?dn5,b,w", pa10}, { "bb", 0xc0006000, 0xffe06000, "?Bnx,!,w", pa20, FLAG_STRICT}, - { "bb", 0xc0004000, 0xffe06000, "?bnx,!,w", pa10, FLAG_STRICT}, { "bb", 0xc4006000, 0xfc006000, "?Bnx,Q,w", pa20, FLAG_STRICT}, { "bb", 0xc4004000, 0xfc004000, "?bnx,Q,w", pa10}, { "bvb", 0xc0004000, 0xffe04000, "?bnx,w", pa10}, { "clrbts", 0xe8004005, 0xffffffff, "", pa20, FLAG_STRICT}, --- 311,318 ---- { "addibt", 0xa4000000, 0xfc000000, "?dn5,b,w", pa10}, { "addibf", 0xac000000, 0xfc000000, "?dn5,b,w", pa10}, { "bb", 0xc0006000, 0xffe06000, "?Bnx,!,w", pa20, FLAG_STRICT}, { "bb", 0xc4006000, 0xfc006000, "?Bnx,Q,w", pa20, FLAG_STRICT}, + { "bb", 0xc0004000, 0xffe06000, "?bnx,!,w", pa10, FLAG_STRICT}, { "bb", 0xc4004000, 0xfc004000, "?bnx,Q,w", pa10}, { "bvb", 0xc0004000, 0xffe04000, "?bnx,w", pa10}, { "clrbts", 0xe8004005, 0xffffffff, "", pa20, FLAG_STRICT}, *************** *** 365,373 **** --- 371,386 ---- /* Subword Operation Instructions */ + { "hadd", 0x08000300, 0xfc00ff20, "cHx,b,t", pa20, FLAG_STRICT}, { "havg", 0x080002c0, 0xfc00ffe0, "x,b,t", pa20, FLAG_STRICT}, + { "hshl", 0xf8008800, 0xffe0fc20, "x,*,t", pa20, FLAG_STRICT}, { "hshladd", 0x08000700, 0xfc00ff20, "x,.,b,t", pa20, FLAG_STRICT}, + { "hshr", 0xf800c800, 0xfc10f820, "cSb,*,t", pa20, FLAG_STRICT}, { "hshradd", 0x08000500, 0xfc00ff20, "x,.,b,t", pa20, FLAG_STRICT}, + { "hsub", 0x08000100, 0xfc00ff20, "cHx,b,t", pa20, FLAG_STRICT}, + { "mixh", 0xf8008400, 0xfc009fe0, "chx,b,t", pa20, FLAG_STRICT}, + { "mixw", 0xf8008000, 0xfc009fe0, "chx,b,t", pa20, FLAG_STRICT}, + { "permh", 0xf8000000, 0xfc009020, "c*a,t", pa20, FLAG_STRICT}, /* Extract and Deposit Instructions */ *** pa-prev/gas/config/tc-hppa.c Tue Aug 3 17:11:01 1999 --- gas-src/gas/config/tc-hppa.c Thu Aug 5 17:07:23 1999 *************** *** 1596,1601 **** --- 1596,1608 ---- CHECK_FIELD (num, 31, 0, 0); INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + /* Handle a 5 bit register field at 10 and 15. */ + case 'a': + num = pa_parse_number (&s, 0); + CHECK_FIELD (num, 31, 0, 0); + opcode |= num << 16; + INSERT_FIELD_AND_CONTINUE (opcode, num, 21); + /* Handle a 5 bit field length at 31. */ case 'T': num = pa_get_absolute_expression (&the_insn, &s); *************** *** 1747,1752 **** --- 1754,1848 ---- INSERT_FIELD_AND_CONTINUE (opcode, flag, 5); + /* Handle signed/unsigned at 21. */ + case 'S': + { + int sign = 1; + if (strncasecmp (s, ",s", 2) == 0) + { + sign = 1; + s += 2; + } + else if (strncasecmp (s, ",u", 2) == 0) + { + sign = 0; + s += 2; + } + + INSERT_FIELD_AND_CONTINUE (opcode, sign, 10); + } + + /* Handle left/right combination at 17:18. */ + case 'h': + if (*s++ == ',') + { + int lr = 0; + if (*s == 'r') + lr = 2; + else if (*s == 'l') + lr = 0; + else + as_bad(_("Invalid left/right combination completer")); + + s++; + INSERT_FIELD_AND_CONTINUE (opcode, lr, 13); + } + else + as_bad(_("Invalid left/right combination completer")); + break; + + /* Handle saturation at 24:25. */ + case 'H': + { + int sat = 3; + if (strncasecmp (s, ",ss", 3) == 0) + { + sat = 1; + s += 3; + } + else if (strncasecmp (s, ",us", 3) == 0) + { + sat = 0; + s += 3; + } + + INSERT_FIELD_AND_CONTINUE (opcode, sat, 6); + } + + /* Handle permutation completer. */ + case '*': + if (*s++ == ',') + { + int permloc[4] = {13,10,8,6}; + int perm = 0; + int i = 0; + for (; i < 4; i++) + { + switch (*s++) + { + case '0': + perm = 0; + break; + case '1': + perm = 1; + break; + case '2': + perm = 2; + break; + case '3': + perm = 3; + break; + default: + as_bad(_("Invalid permutation completer")); + } + opcode |= perm << permloc[i]; + } + continue; + } + else + as_bad(_("Invalid permutation completer")); + break; + default: abort (); } *************** *** 2463,2468 **** --- 2559,2571 ---- num = pa_get_absolute_expression (&the_insn, &s); s = expr_end; CHECK_FIELD (num, 3, 1, 0); + INSERT_FIELD_AND_CONTINUE (opcode, num, 6); + + /* Handle a 4 bit shift count at 25. */ + case '*': + num = pa_get_absolute_expression (&the_insn, &s); + s = expr_end; + CHECK_FIELD (num, 15, 0, 0); INSERT_FIELD_AND_CONTINUE (opcode, num, 6); /* Handle a 5 bit shift count at 26. */ *** pa-prev/opcodes/hppa-dis.c Tue Aug 3 17:11:09 1999 --- gas-src/opcodes/hppa-dis.c Thu Aug 5 15:50:08 1999 *************** *** 125,130 **** --- 125,134 ---- ",!?<=", ",>", ",?>", ",!<=", ",!?<", ",>=", ",?>=", ",!<", ",!?=", ",<>", ",!=", ",!=t", ",!?", ",<=>", ",true?", ",true" }; + static const char *const signed_unsigned_names[][3] = {",u", ",s"}; + static const char *const mix_half_names[][3] = {",l", ",r"}; + static const char *const saturation_names[][3] = {",us", ",ss", 0, ""}; + /* For a bunch of different instructions form an index into a completer name table. */ *************** *** 346,351 **** --- 350,356 ---- else fput_fp_reg (GET_FIELD (insn, 11, 15), info); break; + case 'a': case 'b': fput_reg (GET_FIELD (insn, 6, 10), info); break; *************** *** 442,447 **** --- 447,479 ---- (*info->fprintf_func) (info->stream, ",m "); else (*info->fprintf_func) (info->stream, " "); + break; + case 'S': + /* EXTRD/W has a following condition. */ + if (*(s + 1) == '?') + (*info->fprintf_func) + (info->stream, "%s", signed_unsigned_names[GET_FIELD + (insn, 21, 21)]); + else + (*info->fprintf_func) + (info->stream, "%s ", signed_unsigned_names[GET_FIELD + (insn, 21, 21)]); + break; + case 'h': + (*info->fprintf_func) + (info->stream, "%s", mix_half_names[GET_FIELD + (insn, 17, 17)]); + break; + case 'H': + (*info->fprintf_func) + (info->stream, "%s", saturation_names[GET_FIELD + (insn, 24, 25)]); + break; + case '*': + (*info->fprintf_func) + (info->stream, ",%d%d%d%d ", + GET_FIELD (insn, 17, 18), GET_FIELD (insn, 20, 21), + GET_FIELD (insn, 22, 23), GET_FIELD (insn, 24, 25)); break; } break; diff -cN pa-prev/gas/testsuite/gas/hppa/basic/basic.exp gas-src/gas/testsuite/gas/hppa/basic/basic.exp *** pa-prev/gas/testsuite/gas/hppa/basic/basic.exp Tue Aug 3 17:11:34 1999 --- gas-src/gas/testsuite/gas/hppa/basic/basic.exp Thu Aug 5 17:14:15 1999 *************** *** 2086,2098 **** # of instructions (as these tests to). while 1 { expect { ! -re "^ +\[0-9\]+ 0000 096702CC\[^\n]*\n" { set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0004 0967074C\[^\n]*\n" { set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0008 0967078C\[^\n]*\n" { set x [expr $x+1] } ! -re "^ +\[0-9\]+ 000c 096707CC\[^\n]*\n" { set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0010 0967054C\[^\n]*\n" { set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0014 0967058C\[^\n]*\n" { set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0014 096705CC\[^\n]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } --- 2086,2115 ---- # of instructions (as these tests to). while 1 { expect { ! -re "^ +\[0-9\]+ 0000 096703CC\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0004 0967034C\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0008 0967030C\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 000c 096702CC\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0010 F8078B4B\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0014 0967074C\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0018 0967078C\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 001c 096707CC\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0020 F8E0CF4B\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0024 F8E0CF4B\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0028 F8E0CB4B\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 002c 0967054C\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0030 0967058C\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0034 096705CC\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0038 0ACE01C9\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 003c 0ACE0149\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0040 0ACE0109\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0044 FACE8409\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0048 FACEC409\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 004c FACE8009\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0050 FACEC009\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0054 FAD60E49\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 0058 FAD64A89\[^\n\]*\n" {set x [expr $x+1] } ! -re "^ +\[0-9\]+ 005c FAD66309\[^\n\]*\n" {set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } *************** *** 2104,2110 **** gas_finish # Did we find what we were looking for? If not, flunk it. ! if [expr $x==18] then { pass $testname } else { fail $testname } } proc do_special {} { --- 2121,2127 ---- gas_finish # Did we find what we were looking for? If not, flunk it. ! if [expr $x==24] then { pass $testname } else { fail $testname } } proc do_special {} { diff -cN pa-prev/gas/testsuite/gas/hppa/basic/media.s gas-src/gas/testsuite/gas/hppa/basic/media.s *** pa-prev/gas/testsuite/gas/hppa/basic/media.s Tue Aug 3 17:11:37 1999 --- gas-src/gas/testsuite/gas/hppa/basic/media.s Thu Aug 5 17:00:00 1999 *************** *** 16,25 **** --- 16,47 ---- ; immediate fields. We should also check the assorted field ; selectors to make sure they're handled correctly. + hadd %r7,%r11,%r12 + hadd,ss %r7,%r11,%r12 + hadd,us %r7,%r11,%r12 + havg %r7,%r11,%r12 + hshl %r7,13,%r11 hshladd %r7,1,%r11,%r12 hshladd %r7,2,%r11,%r12 hshladd %r7,3,%r11,%r12 + hshr %r7,13,%r11 + hshr,s %r7,13,%r11 + hshr,u %r7,13,%r11 hshradd %r7,1,%r11,%r12 hshradd %r7,2,%r11,%r12 hshradd %r7,3,%r11,%r12 + + hsub %r14,%r22,%r9 + hsub,ss %r14,%r22,%r9 + hsub,us %r14,%r22,%r9 + + mixh,l %r14,%r22,%r9 + mixh,r %r14,%r22,%r9 + mixw,l %r14,%r22,%r9 + mixw,r %r14,%r22,%r9 + + permh,0321 %r22,%r9 + permh,2222 %r22,%r9 + permh,3030 %r22,%r9 + -- Jerry Quinn Tel: (514) 761-8737 jquinn@nortelnetworks.com Fax: (514) 761-8505 Speech Recognition Research