This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: add pa2.0 instructions to gas
- To: egcs-patches at egcs dot cygnus dot com
- Subject: PATCH: add pa2.0 instructions to gas
- From: "Jerry Quinn" <jquinn at nortelnetworks dot com>
- Date: Wed, 17 Mar 1999 12:59:45 -0500
- Organization: Nortel Technology
I've made the following changes to gas (binutils 2.9.1) to support
pa-risc 2.0 instructions fmpyfadd, fmpyfsub, fneg, and fnegabs. They
all seem to be working.
There is still a problem because the object files are all still marked
as 1.1 executable files and I haven't figure out yet how to have them
marked as 2.0, which means there are no warnings that the result won't
run on a 1.1 machine.
--
Jerry Quinn Tel: (514) 761-8737
jquinn@nortelnetworks.com Fax: (514) 761-8505
Speech Recognition Research
This patch is against binutils 2.9.1 and adds minimal pa-risc 2.0 support for
extra floating point instructions fmpyfadd, fmpynfadd, fneg, and fnegabs.
bfd changelog entry:
Wed Mar 17 11:44:47 EST 1999 Jerry Quinn <jquinn@nortelnetworks.com>
* cpu-hppa.c (bfd_hppa_arch): Rename to bfd_hppa11_arch. Create new
bfd_hppa_arch for hppa2.0.
gas changelog entry:
Wed Mar 17 11:44:47 EST 1999 Jerry Quinn <jquinn@nortelnetworks.com>
* config/tc-hppa.c (pa_level): Recognize "2.0" as a valid level.
* config/tc-hppa.c (pa_ip): Add code for '3', 'I', 'J', 'K' codes.
include changelog entry:
Wed Mar 17 11:44:47 EST 1999 Jerry Quinn <jquinn@nortelnetworks.com>
* opcode/hppa.h (pa_opcodes): Add entries for pa2.0 instructions
fmpyfadd, fmpynfadd, fneg, fnegabs. Add operand arg '3' for fmpyfadd
and fmpynfadd.
diff -r -c oldsrc/bfd/cpu-hppa.c src/bfd/cpu-hppa.c
*** oldsrc/bfd/cpu-hppa.c Tue Mar 16 10:56:50 1999
--- src/bfd/cpu-hppa.c Tue Mar 16 10:57:00 1999
***************
*** 37,43 ****
0,
};
! const bfd_arch_info_type bfd_hppa_arch =
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
--- 37,43 ----
0,
};
! const bfd_arch_info_type bfd_hppa11_arch =
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
***************
*** 51,54 ****
--- 51,70 ----
bfd_default_compatible,
bfd_default_scan ,
&bfd_hppa10_arch,
+ };
+
+ const bfd_arch_info_type bfd_hppa_arch =
+ {
+ 32, /* 32 bits in a word */
+ 32, /* 32 bits in an address */
+ 8, /* 8 bits in a byte */
+ bfd_arch_hppa,
+ 20, /* By convention PA2.0 = 20 */
+ "hppa",
+ "hppa2.0",
+ 3,
+ false, /* 1.1 or 2.0 specific features used */
+ bfd_default_compatible,
+ bfd_default_scan ,
+ &bfd_hppa11_arch,
};
diff -r -c oldsrc/gas/config/tc-hppa.c src/gas/config/tc-hppa.c
*** oldsrc/gas/config/tc-hppa.c Tue Mar 16 10:56:00 1999
--- src/gas/config/tc-hppa.c Wed Mar 17 12:46:24 1999
***************
*** 2380,2385 ****
--- 2380,2399 ----
continue;
}
+ /* Handle a 6 bit fp register field at 16:18,21:23. Only for
+ addend in fmpyfadd and fmpyfnadd */
+ case '3':
+ {
+ struct pa_11_fp_reg_struct result;
+
+ pa_parse_number (&s, &result);
+ CHECK_FIELD (result.number_part, 31, 0, 0);
+ opcode |= (result.number_part & 0x1c) << 11; /* 16:18 */
+ opcode |= (result.number_part & 3) << 9; /* 21:22 */
+ opcode |= (result.l_r_select & 1) << 8; /* Guess that lsb(23) is where this goes */
+ continue;
+ }
+
/* Handle a 5 bit register field at 10. */
case '4':
{
***************
*** 2500,2505 ****
--- 2514,2560 ----
}
break;
+ /* Handle a FP operand format completer at bit 20. */
+ case 'I':
+ flag = pa_parse_fp_format (&s);
+ switch (flag)
+ {
+ case SGL:
+ case DBL:
+ INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
+ case QUAD:
+ case ILLEGAL_FMT:
+ default:
+ as_bad ("Invalid Floating Point Operand Format.");
+ }
+ break;
+
+ /* Handle L/R register halves like 'b'. This is for 0E insn
+ operand r1. */
+ case 'J':
+ {
+ struct pa_11_fp_reg_struct result;
+
+ pa_parse_number (&s, &result);
+ CHECK_FIELD (result.number_part, 31, 0, 0);
+ opcode |= result.number_part << 21;
+ opcode |= (result.l_r_select & 1) << 7;
+ continue;
+ }
+
+ /* Handle L/R register halves like 'x'. This is for 0E insn
+ operand r2. */
+ case 'K':
+ {
+ struct pa_11_fp_reg_struct result;
+
+ pa_parse_number (&s, &result);
+ CHECK_FIELD (result.number_part, 31, 0, 0);
+ opcode |= (result.number_part & 0x1f) << 16;
+ opcode |= (result.l_r_select & 1) << 12;
+ continue;
+ }
+
default:
abort ();
}
***************
*** 2526,2531 ****
--- 2581,2587 ----
}
the_insn.opcode = opcode;
+ printf("For instruction %s we generate output %x\n", str, opcode);
}
/* Turn a string in input_line_pointer into a floating point constant of type
***************
*** 4930,4935 ****
--- 4986,4997 ----
{
input_line_pointer += 3;
if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, 11))
+ as_warn ("could not set architecture and machine");
+ }
+ else if (strncmp (level, "2.0", 3) == 0)
+ {
+ input_line_pointer += 3;
+ if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, 20))
as_warn ("could not set architecture and machine");
}
else
diff -r -c oldsrc/include/opcode/hppa.h src/include/opcode/hppa.h
*** oldsrc/include/opcode/hppa.h Tue Mar 16 11:28:12 1999
--- src/include/opcode/hppa.h Tue Mar 16 13:57:56 1999
***************
*** 64,70 ****
In the args field, the following characters are unused:
! ' "#$% *+- ./ 3 :; = '
' B L [\] _'
' e gh lm qr { } '
--- 64,70 ----
In the args field, the following characters are unused:
! ' "#$% *+- ./ :; = '
' B L [\] _'
' e gh lm qr { } '
***************
*** 152,157 ****
--- 152,158 ----
X an 'x' operand type extended to handle L/R register halves.
J a 'b' operand type further extended to handle extra 1.1 registers
K a 'x' operand type further extended to handle extra 1.1 registers
+ 3 a floating point register field for fmpyf(n)add at 16:18,21:23
4 a variation of the 'b' operand type for 'fmpyadd' and 'fmpysub'
6 a variation of the 'x' operand type for 'fmpyadd' and 'fmpysub'
7 a variation of the 't' operand type for 'fmpyadd' and 'fmpysub'
***************
*** 411,416 ****
--- 412,421 ----
{ "fsqrt", 0x38008000, 0xfc1fe720, "FJ,v", pa10},
{ "fabs", 0x30006000, 0xfc1fe7e0, "FE,v", pa10},
{ "fabs", 0x38006000, 0xfc1fe720, "FJ,v", pa10},
+ { "fneg", 0x3000c000, 0xfc1fe7e0, "FE,v", pa20},
+ { "fneg", 0x3800c000, 0xfc1fe720, "FJ,v", pa20},
+ { "fnegabs", 0x3000e000, 0xfc1fe7e0, "FE,v", pa20},
+ { "fnegabs", 0x3800e000, 0xfc1fe720, "FJ,v", pa20},
{ "frem", 0x30008600, 0xfc00e7e0, "FE,X,v", pa10},
{ "frem", 0x38008600, 0xfc00e720, "FJ,K,v", pa10},
{ "frnd", 0x3000a000, 0xfc1fe7e0, "FE,v", pa10},
***************
*** 430,435 ****
--- 435,442 ----
{ "xmpyu", 0x38004700, 0xfc00e720, "E,X,v", pa11},
{ "fmpyadd", 0x18000000, 0xfc000000, "H4,6,7,9,8", pa11},
{ "fmpysub", 0x98000000, 0xfc000000, "H4,6,7,9,8", pa11},
+ { "fmpyfadd", 0xb8000000, 0xfc000020, "IJ,K,3,v", pa20},
+ { "fmpynfadd", 0xb8000020, 0xfc000020, "IJ,K,3,v", pa20},
{ "ftest", 0x30002420, 0xffffffff, "", pa10},