GNU Binutils with patches for OS216
修訂 | 6ce26ac7c381c78858b9a7bac344b5cd04bfb03e (tree) |
---|---|
時間 | 2019-06-13 06:16:18 |
作者 | Stafford Horne <shorne@gmai...> |
Commiter | Stafford Horne |
cpu/or1k: Add support for orfp64a32 spec
This patch adds support for OpenRISC 64-bit FPU operations on 32-bit cores by
using register pairs. The functionality has been added to OpenRISC architecture
specification version 1.3 as per architecture proposal 14[0].
For supporting assembly of both 64-bit and 32-bit precision instructions we have
defined CGEN_VALIDATE_INSN_SUPPORTED. This allows cgen to use 64-bit bit
architecture assembly parsing on 64-bit toolchains and 32-bit architecture
assembly parsing on 32-bit toolchains. Without this the assembler has issues
parsing register pairs.
This patch also contains a few fixes to the symantics for existing OpenRISC
single and double precision FPU operations.
[0] https://openrisc.io/proposals/orfpx64a32
cpu/ChangeLog:
yyyy-mm-dd Andrey Bacherov <avbacherov@opencores.org>
Stafford Horne <shorne@gmail.com>
* or1k.cpu (ORFPX64A32-MACHS): New pmacro.
(ORFPX-MACHS): Removed pmacro.
* or1k.opc (or1k_cgen_insn_supported): New function.
(CGEN_VALIDATE_INSN_SUPPORTED): Define macro.
(parse_regpair, print_regpair): New functions.
* or1kcommon.cpu (h-spr, spr-shift, spr-address, h-gpr): Reorder
and add comments.
(h-fdr): Update comment to indicate or64.
(reg-pair-reg-lo, reg-pair-reg-hi): New pmacros for register pairs.
(h-fd32r): New hardware for 64-bit fpu registers.
(h-i64r): New hardware for 64-bit int registers.
* or1korbis.cpu (f-resv-8-1): New field.
* or1korfpx.cpu (rDSF, rASF, rBSF): Update attribute to ORFPX32-MACHS.
(rDDF, rADF, rBDF): Update operand comment to indicate or64.
(f-rdoff-10-1, f-raoff-9-1, f-rboff-8-1): New fields.
(h-roff1): New hardware.
(double-field-and-ops mnemonic): New pmacro to generate operations
rDD32F, rAD32F, rBD32F, rDDI and rADI.
(float-regreg-insn): Update single precision generator to MACH
ORFPX32-MACHS. Add generator for or32 64-bit instructions.
(float-setflag-insn): Update single precision generator to MACH
ORFPX32-MACHS. Fix double instructions from single to double
precision. Add generator for or32 64-bit instructions.
(float-cust-insn cust-num): Update single precision generator to MACH
ORFPX32-MACHS. Add generator for or32 64-bit instructions.
(lf-rem-s, lf-itof-s, lf-ftoi-s, lf-madd-s): Update MACH to
ORFPX32-MACHS.
(lf-rem-d): Fix operation from mod to rem.
(lf-rem-d32, lf-itof-d32, lf-ftoi-d32, lf-madd-d32): New instruction.
(lf-itof-d): Fix operands from single to double.
(lf-ftoi-d): Update operand mode from DI to WI.
@@ -1,3 +1,38 @@ | ||
1 | +2019-06-13 Andrey Bacherov <avbacherov@opencores.org> | |
2 | + Stafford Horne <shorne@gmail.com> | |
3 | + | |
4 | + * or1k.cpu (ORFPX64A32-MACHS): New pmacro. | |
5 | + (ORFPX-MACHS): Removed pmacro. | |
6 | + * or1k.opc (or1k_cgen_insn_supported): New function. | |
7 | + (CGEN_VALIDATE_INSN_SUPPORTED): Define macro. | |
8 | + (parse_regpair, print_regpair): New functions. | |
9 | + * or1kcommon.cpu (h-spr, spr-shift, spr-address, h-gpr): Reorder | |
10 | + and add comments. | |
11 | + (h-fdr): Update comment to indicate or64. | |
12 | + (reg-pair-reg-lo, reg-pair-reg-hi): New pmacros for register pairs. | |
13 | + (h-fd32r): New hardware for 64-bit fpu registers. | |
14 | + (h-i64r): New hardware for 64-bit int registers. | |
15 | + * or1korbis.cpu (f-resv-8-1): New field. | |
16 | + * or1korfpx.cpu (rDSF, rASF, rBSF): Update attribute to ORFPX32-MACHS. | |
17 | + (rDDF, rADF, rBDF): Update operand comment to indicate or64. | |
18 | + (f-rdoff-10-1, f-raoff-9-1, f-rboff-8-1): New fields. | |
19 | + (h-roff1): New hardware. | |
20 | + (double-field-and-ops mnemonic): New pmacro to generate operations | |
21 | + rDD32F, rAD32F, rBD32F, rDDI and rADI. | |
22 | + (float-regreg-insn): Update single precision generator to MACH | |
23 | + ORFPX32-MACHS. Add generator for or32 64-bit instructions. | |
24 | + (float-setflag-insn): Update single precision generator to MACH | |
25 | + ORFPX32-MACHS. Fix double instructions from single to double | |
26 | + precision. Add generator for or32 64-bit instructions. | |
27 | + (float-cust-insn cust-num): Update single precision generator to MACH | |
28 | + ORFPX32-MACHS. Add generator for or32 64-bit instructions. | |
29 | + (lf-rem-s, lf-itof-s, lf-ftoi-s, lf-madd-s): Update MACH to | |
30 | + ORFPX32-MACHS. | |
31 | + (lf-rem-d): Fix operation from mod to rem. | |
32 | + (lf-rem-d32, lf-itof-d32, lf-ftoi-d32, lf-madd-d32): New instruction. | |
33 | + (lf-itof-d): Fix operands from single to double. | |
34 | + (lf-ftoi-d): Update operand mode from DI to WI. | |
35 | + | |
1 | 36 | 2019-05-23 Jose E. Marchesi <jose.marchesi@oracle.com> |
2 | 37 | |
3 | 38 | * bpf.cpu: New file. |
@@ -1,8 +1,9 @@ | ||
1 | 1 | ; OpenRISC 1000 architecture. -*- Scheme -*- |
2 | -; Copyright 2000-2014 Free Software Foundation, Inc. | |
2 | +; Copyright 2000-2019 Free Software Foundation, Inc. | |
3 | 3 | ; Contributed for OR32 by Johan Rydberg, jrydberg@opencores.org |
4 | 4 | ; Modified by Julius Baxter, juliusbaxter@gmail.com |
5 | 5 | ; Modified by Peter Gavin, pgavin@gmail.com |
6 | +; Modified by Andrey Bacherov, avbacherov@opencores.org | |
6 | 7 | ; |
7 | 8 | ; This program is free software; you can redistribute it and/or modify |
8 | 9 | ; it under the terms of the GNU General Public License as published by |
@@ -42,12 +43,12 @@ | ||
42 | 43 | (base-insn-bitsize 32) |
43 | 44 | ) |
44 | 45 | |
45 | -(define-pmacro OR32-MACHS or32,or32nd) | |
46 | -(define-pmacro OR64-MACHS or64,or64nd) | |
47 | -(define-pmacro ORBIS-MACHS or32,or32nd,or64,or64nd) | |
48 | -(define-pmacro ORFPX-MACHS or32,or32nd,or64,or64nd) | |
49 | -(define-pmacro ORFPX32-MACHS or32,or32nd,or64,or64nd) | |
50 | -(define-pmacro ORFPX64-MACHS or64,or64nd) | |
46 | +(define-pmacro OR32-MACHS or32,or32nd) | |
47 | +(define-pmacro OR64-MACHS or64,or64nd) | |
48 | +(define-pmacro ORBIS-MACHS or32,or32nd,or64,or64nd) | |
49 | +(define-pmacro ORFPX32-MACHS or32,or32nd,or64,or64nd) | |
50 | +(define-pmacro ORFPX64-MACHS or64,or64nd) | |
51 | +(define-pmacro ORFPX64A32-MACHS or32,or32nd) ; float64 for 32-bit machs | |
51 | 52 | |
52 | 53 | (define-attr |
53 | 54 | (for model) |
@@ -40,9 +40,29 @@ | ||
40 | 40 | #undef CGEN_DIS_HASH |
41 | 41 | #define CGEN_DIS_HASH(buffer, value) (((unsigned char *) (buffer))[0] >> 2) |
42 | 42 | |
43 | +/* Check applicability of instructions against machines. */ | |
44 | +#define CGEN_VALIDATE_INSN_SUPPORTED | |
45 | + | |
46 | +extern int or1k_cgen_insn_supported (CGEN_CPU_DESC, const CGEN_INSN *); | |
47 | + | |
43 | 48 | /* -- */ |
44 | 49 | |
45 | 50 | /* -- opc.c */ |
51 | + | |
52 | +/* Special check to ensure that instruction exists for given machine. */ | |
53 | + | |
54 | +int | |
55 | +or1k_cgen_insn_supported (CGEN_CPU_DESC cd, const CGEN_INSN *insn) | |
56 | +{ | |
57 | + int machs = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH); | |
58 | + | |
59 | + /* No mach attribute? Assume it's supported for all machs. */ | |
60 | + if (machs == 0) | |
61 | + return 1; | |
62 | + | |
63 | + return ((machs & cd->machs) != 0); | |
64 | +} | |
65 | + | |
46 | 66 | /* -- */ |
47 | 67 | |
48 | 68 | /* -- asm.c */ |
@@ -415,6 +435,78 @@ parse_uimm16_split (CGEN_CPU_DESC cd, const char **strp, int opindex, | ||
415 | 435 | return errmsg; |
416 | 436 | } |
417 | 437 | |
438 | +/* Parse register pairs with syntax rA,rB to a flag + rA value. */ | |
439 | + | |
440 | +static const char * | |
441 | +parse_regpair (CGEN_CPU_DESC cd, const char **strp, | |
442 | + int opindex ATTRIBUTE_UNUSED, unsigned long *valuep) | |
443 | +{ | |
444 | + long reg1_index; | |
445 | + long reg2_index; | |
446 | + const char *errmsg; | |
447 | + | |
448 | + /* The first part should just be a register. */ | |
449 | + errmsg = cgen_parse_keyword (cd, strp, &or1k_cgen_opval_h_gpr, | |
450 | + ®1_index); | |
451 | + | |
452 | + /* If that worked skip the comma separator. */ | |
453 | + if (errmsg == NULL) | |
454 | + { | |
455 | + if (**strp == ',') | |
456 | + ++*strp; | |
457 | + else | |
458 | + errmsg = "Unexpected character, expected ','"; | |
459 | + } | |
460 | + | |
461 | + /* If that worked the next part is just another register. */ | |
462 | + if (errmsg == NULL) | |
463 | + errmsg = cgen_parse_keyword (cd, strp, &or1k_cgen_opval_h_gpr, | |
464 | + ®2_index); | |
465 | + | |
466 | + /* Validate the register pair is valid and create the output value. */ | |
467 | + if (errmsg == NULL) | |
468 | + { | |
469 | + int regoffset = reg2_index - reg1_index; | |
470 | + | |
471 | + if (regoffset == 1 || regoffset == 2) | |
472 | + { | |
473 | + unsigned short offsetmask; | |
474 | + unsigned short value; | |
475 | + | |
476 | + offsetmask = ((regoffset == 2 ? 1 : 0) << 5); | |
477 | + value = offsetmask | reg1_index; | |
478 | + | |
479 | + *valuep = value; | |
480 | + } | |
481 | + else | |
482 | + errmsg = "Invalid register pair, offset not 1 or 2."; | |
483 | + } | |
484 | + | |
485 | + return errmsg; | |
486 | +} | |
487 | + | |
488 | +/* -- */ | |
489 | + | |
490 | +/* -- dis.c */ | |
491 | + | |
492 | +static void | |
493 | +print_regpair (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, | |
494 | + void * dis_info, | |
495 | + long value, | |
496 | + unsigned int attrs ATTRIBUTE_UNUSED, | |
497 | + bfd_vma pc ATTRIBUTE_UNUSED, | |
498 | + int length ATTRIBUTE_UNUSED) | |
499 | +{ | |
500 | + disassemble_info *info = dis_info; | |
501 | + char reg1_index; | |
502 | + char reg2_index; | |
503 | + | |
504 | + reg1_index = value & 0x1f; | |
505 | + reg2_index = reg1_index + ((value & (1 << 5)) ? 2 : 1); | |
506 | + | |
507 | + (*info->fprintf_func) (info->stream, "r%d,r%d", reg1_index, reg2_index); | |
508 | +} | |
509 | + | |
418 | 510 | /* -- */ |
419 | 511 | |
420 | 512 | /* -- ibd.h */ |
@@ -1,7 +1,8 @@ | ||
1 | 1 | ; OpenRISC 1000 32-bit CPU hardware description. -*- Scheme -*- |
2 | -; Copyright 2000-2014 Free Software Foundation, Inc. | |
2 | +; Copyright 2000-2019 Free Software Foundation, Inc. | |
3 | 3 | ; Contributed for OR32 by Johan Rydberg, jrydberg@opencores.org |
4 | 4 | ; Modified by Julius Baxter, juliusbaxter@gmail.com |
5 | +; Modified by Andrey Bacherov, avbacherov@opencores.org | |
5 | 6 | ; |
6 | 7 | ; This program is free software; you can redistribute it and/or modify |
7 | 8 | ; it under the terms of the GNU General Public License as published by |
@@ -71,6 +72,38 @@ | ||
71 | 72 | (fp 2)) |
72 | 73 | ) |
73 | 74 | |
75 | +; | |
76 | +; Hardware: [S]pecial [P]urpose [R]egisters | |
77 | +; | |
78 | +(define-hardware | |
79 | + (name h-spr) (comment "special purpose registers") | |
80 | + (attrs VIRTUAL (MACH ORBIS-MACHS)) | |
81 | + (type register UWI (#x20000)) | |
82 | + (get (index) (c-call UWI "@cpu@_h_spr_get_raw" index)) | |
83 | + (set (index newval) (c-call VOID "@cpu@_h_spr_set_raw" index newval)) | |
84 | +) | |
85 | + | |
86 | +(define-pmacro spr-shift 11) | |
87 | +(define-pmacro (spr-address spr-group spr-index) | |
88 | + (or (sll UWI (enum UWI (.sym "SPR-GROUP-" spr-group)) spr-shift) | |
89 | + (enum UWI (.sym "SPR-INDEX-" spr-group "-" spr-index)))) | |
90 | + | |
91 | +; | |
92 | +; Hardware: [G]enepral [P]urpose [R]egisters | |
93 | +; | |
94 | +(define-hardware | |
95 | + (name h-gpr) (comment "general registers") | |
96 | + (attrs (MACH ORBIS-MACHS)) | |
97 | + (type register UWI (32)) | |
98 | + (indices keyword "" REG-INDICES) | |
99 | + (get (index) (reg UWI h-spr (add index (spr-address SYS GPR0)))) | |
100 | + (set (index newval) (set UWI (reg UWI h-spr (add index (spr-address SYS GPR0))) newval)) | |
101 | + ) | |
102 | + | |
103 | +; | |
104 | +; Hardware: virtual registerts for FPU (single precision) | |
105 | +; mapped to GPRs | |
106 | +; | |
74 | 107 | (define-hardware |
75 | 108 | (name h-fsr) |
76 | 109 | (comment "floating point registers (single, virtual)") |
@@ -81,8 +114,13 @@ | ||
81 | 114 | (set (index newval) (set UWI (reg h-gpr index) (zext UWI (subword SI newval 0)))) |
82 | 115 | ) |
83 | 116 | |
117 | +; | |
118 | +; Hardware: virtual registerts for FPU (double precision) | |
119 | +; mapped to GPRs | |
120 | +; | |
84 | 121 | (define-hardware |
85 | - (name h-fdr) (comment "floating point registers (double, virtual)") | |
122 | + (name h-fdr) | |
123 | + (comment "or64 floating point registers (double, virtual)") | |
86 | 124 | (attrs VIRTUAL (MACH ORFPX64-MACHS)) |
87 | 125 | (type register DF (32)) |
88 | 126 | (indices keyword "" REG-INDICES) |
@@ -90,27 +128,64 @@ | ||
90 | 128 | (set (index newval) (set UDI (reg h-gpr index) (zext UDI (subword DI newval 0)))) |
91 | 129 | ) |
92 | 130 | |
93 | -(define-hardware | |
94 | - (name h-spr) (comment "special purpose registers") | |
95 | - (attrs VIRTUAL (MACH ORBIS-MACHS)) | |
96 | - (type register UWI (#x20000)) | |
97 | - (get (index) (c-call UWI "@cpu@_h_spr_get_raw" index)) | |
98 | - (set (index newval) (c-call VOID "@cpu@_h_spr_set_raw" index newval)) | |
131 | +; | |
132 | +; Register pairs are offset by 2 for registers r16 and above. This is to | |
133 | +; be able to allow registers to be call saved in GCC across function calls. | |
134 | +; | |
135 | +(define-pmacro (reg-pair-reg-lo index) | |
136 | + (and index (const #x1f)) | |
99 | 137 | ) |
100 | 138 | |
101 | -(define-pmacro spr-shift 11) | |
102 | -(define-pmacro (spr-address spr-group spr-index) | |
103 | - (or (sll UWI (enum UWI (.sym "SPR-GROUP-" spr-group)) spr-shift) | |
104 | - (enum UWI (.sym "SPR-INDEX-" spr-group "-" spr-index)))) | |
139 | +(define-pmacro (reg-pair-reg-hi index) | |
140 | + (add (and index (const #x1f)) | |
141 | + (if (eq (sra index (const 5)) | |
142 | + (const 1)) | |
143 | + (const 2) | |
144 | + (const 1) | |
145 | + ) | |
146 | + ) | |
147 | +) | |
148 | + | |
149 | +; | |
150 | +; Hardware: vrtual registers for double precision floating point | |
151 | +; operands on 32-bit machines | |
152 | +; mapped to GPRs | |
153 | +; | |
154 | +(define-hardware | |
155 | + (name h-fd32r) | |
156 | + (comment "or32 floating point registers (double, virtual)") | |
157 | + (attrs VIRTUAL (MACH ORFPX64A32-MACHS)) | |
158 | + (type register DF (32)) | |
159 | + (get (index) (join DF SI | |
160 | + (reg h-gpr (reg-pair-reg-lo index)) | |
161 | + (reg h-gpr (reg-pair-reg-hi index)))) | |
162 | + (set (index newval) | |
163 | + (sequence () | |
164 | + (set (reg h-gpr (reg-pair-reg-lo index)) (subword SI newval 0)) | |
165 | + (set (reg h-gpr (reg-pair-reg-hi index)) | |
166 | + (subword SI newval 1)))) | |
167 | +) | |
105 | 168 | |
169 | +; | |
170 | +; Hardware: vrtual 64-bit integer registers for conversions | |
171 | +; float64 <-> int64 on 32-bit machines | |
172 | +; mapped to GPRs | |
173 | +; | |
106 | 174 | (define-hardware |
107 | - (name h-gpr) (comment "general registers") | |
108 | - (attrs (MACH ORBIS-MACHS)) | |
109 | - (type register UWI (32)) | |
110 | - (indices keyword "" REG-INDICES) | |
111 | - (get (index) (reg UWI h-spr (add index (spr-address SYS GPR0)))) | |
112 | - (set (index newval) (set UWI (reg UWI h-spr (add index (spr-address SYS GPR0))) newval)) | |
113 | - ) | |
175 | + (name h-i64r) | |
176 | + (comment "or32 double word registers (int64, virtual)") | |
177 | + (attrs VIRTUAL (MACH ORFPX64A32-MACHS)) | |
178 | + (type register DI (32)) | |
179 | + (get (index) (join DI SI | |
180 | + (reg h-gpr (reg-pair-reg-lo index)) | |
181 | + (reg h-gpr (reg-pair-reg-hi index)))) | |
182 | + (set (index newval) | |
183 | + (sequence () | |
184 | + (set (reg h-gpr (reg-pair-reg-lo index)) (subword SI newval 0)) | |
185 | + (set (reg h-gpr (reg-pair-reg-hi index)) | |
186 | + (subword SI newval 1)))) | |
187 | +) | |
188 | + | |
114 | 189 | |
115 | 190 | (define-normal-enum |
116 | 191 | except-number |
@@ -61,6 +61,7 @@ | ||
61 | 61 | (dnf f-resv-10-7 "resv-10-7" ((MACH ORBIS-MACHS) RESERVED) 10 7) |
62 | 62 | (dnf f-resv-10-3 "resv-10-3" ((MACH ORBIS-MACHS) RESERVED) 10 3) |
63 | 63 | (dnf f-resv-10-1 "resv-10-1" ((MACH ORBIS-MACHS) RESERVED) 10 1) |
64 | +(dnf f-resv-8-1 "resv-8-1" ((MACH ORBIS-MACHS) RESERVED) 8 1) | |
64 | 65 | (dnf f-resv-7-4 "resv-7-4" ((MACH ORBIS-MACHS) RESERVED) 7 4) |
65 | 66 | (dnf f-resv-5-2 "resv-5-2" ((MACH ORBIS-MACHS) RESERVED) 5 2) |
66 | 67 |
@@ -1,6 +1,7 @@ | ||
1 | 1 | ; OpenRISC 1000 architecture. -*- Scheme -*- |
2 | -; Copyright 2000-2014 Free Software Foundation, Inc. | |
2 | +; Copyright 2000-2019 Free Software Foundation, Inc. | |
3 | 3 | ; Contributed by Peter Gavin, pgavin@gmail.com |
4 | +; Modified by Andrey Bacherov, avbacherov@opencores.org | |
4 | 5 | ; |
5 | 6 | ; This program is free software; you can redistribute it and/or modify |
6 | 7 | ; it under the terms of the GNU General Public License as published by |
@@ -58,19 +59,80 @@ | ||
58 | 59 | ) |
59 | 60 | ) |
60 | 61 | |
61 | -(dnop rDSF "destination register (single floating point mode)" () h-fsr f-r1) | |
62 | -(dnop rASF "source register A (single floating point mode)" () h-fsr f-r2) | |
63 | -(dnop rBSF "source register B (single floating point mode)" () h-fsr f-r3) | |
62 | +; Register offset flags, if set offset is 2 otherwise offset is 1 | |
63 | +(dnf f-rdoff-10-1 "destination register pair offset flag" ((MACH ORFPX64A32-MACHS)) 10 1) | |
64 | +(dnf f-raoff-9-1 "source register A pair offset flag" ((MACH ORFPX64A32-MACHS)) 9 1) | |
65 | +(dnf f-rboff-8-1 "source register B pair offset flag" ((MACH ORFPX64A32-MACHS)) 8 1) | |
64 | 66 | |
65 | -(dnop rDDF "destination register (double floating point mode)" ((MACH ORFPX64-MACHS)) h-fdr f-r1) | |
66 | -(dnop rADF "source register A (double floating point mode)" ((MACH ORFPX64-MACHS)) h-fdr f-r1) | |
67 | -(dnop rBDF "source register B (double floating point mode)" ((MACH ORFPX64-MACHS)) h-fdr f-r1) | |
67 | +(dsh h-roff1 "1-bit offset flag" () (register BI)) | |
68 | + | |
69 | +(dnop rDSF "destination register (single floating point mode)" ((MACH ORFPX32-MACHS)) h-fsr f-r1) | |
70 | +(dnop rASF "source register A (single floating point mode)" ((MACH ORFPX32-MACHS)) h-fsr f-r2) | |
71 | +(dnop rBSF "source register B (single floating point mode)" ((MACH ORFPX32-MACHS)) h-fsr f-r3) | |
72 | + | |
73 | +(dnop rDDF "or64 destination register (double floating point mode)" ((MACH ORFPX64-MACHS)) h-fdr f-r1) | |
74 | +(dnop rADF "or64 source register A (double floating point mode)" ((MACH ORFPX64-MACHS)) h-fdr f-r2) | |
75 | +(dnop rBDF "or64 source register B (double floating point mode)" ((MACH ORFPX64-MACHS)) h-fdr f-r3) | |
76 | + | |
77 | +(define-pmacro (double-field-and-ops mnemonic reg offbit op-comment) | |
78 | + (begin | |
79 | + (define-multi-ifield | |
80 | + (name (.sym "f-r" (.downcase mnemonic) "d32")) | |
81 | + (comment op-comment) | |
82 | + (attrs (MACH ORFPX64A32-MACHS)) | |
83 | + (mode SI) | |
84 | + (subfields reg offbit) | |
85 | + ; From the multi-ifield insert the bits into subfields | |
86 | + (insert (sequence | |
87 | + () | |
88 | + (set (ifield reg) | |
89 | + (and (ifield (.sym "f-r" (.downcase mnemonic) "d32")) | |
90 | + (const #x1f)) | |
91 | + ) | |
92 | + (set (ifield offbit) | |
93 | + (and (sra (ifield (.sym "f-r" (.downcase mnemonic) "d32")) | |
94 | + (const 5)) | |
95 | + (const 1)) | |
96 | + ) | |
97 | + ) | |
98 | + ) | |
99 | + ; Extract the multi-ifield from the subfield bits | |
100 | + (extract | |
101 | + (set (ifield (.sym "f-r" (.downcase mnemonic) "d32")) | |
102 | + (or (ifield reg) | |
103 | + (sll (ifield offbit) | |
104 | + (const 5))) | |
105 | + ) | |
106 | + ) | |
107 | + ) | |
108 | + (define-operand | |
109 | + (name (.sym "r" (.upcase mnemonic) "D32F")) | |
110 | + (comment (.str op-comment " (double floating point pair)")) | |
111 | + (attrs (MACH ORFPX64A32-MACHS)) | |
112 | + (type h-fd32r) | |
113 | + (index (.sym "f-r" (.downcase mnemonic) "d32")) | |
114 | + (handlers (parse "regpair") (print "regpair")) | |
115 | + ) | |
116 | + (define-operand | |
117 | + (name (.sym "r" (.upcase mnemonic) "DI")) | |
118 | + (comment (.str op-comment " (double integer pair)")) | |
119 | + (attrs (MACH ORFPX64A32-MACHS)) | |
120 | + (type h-i64r) | |
121 | + (index (.sym "f-r" (.downcase mnemonic) "d32")) | |
122 | + (handlers (parse "regpair") (print "regpair")) | |
123 | + ) | |
124 | + ) | |
125 | + ) | |
126 | + | |
127 | +(double-field-and-ops D f-r1 f-rdoff-10-1 "destination register") | |
128 | +(double-field-and-ops A f-r2 f-raoff-9-1 "source register A") | |
129 | +(double-field-and-ops B f-r3 f-rboff-8-1 "source register B") | |
68 | 130 | |
69 | 131 | (define-pmacro (float-regreg-insn mnemonic) |
70 | 132 | (begin |
71 | 133 | (dni (.sym lf- mnemonic -s) |
72 | 134 | (.str "lf." mnemonic ".s reg/reg/reg") |
73 | - ((MACH ORFPX-MACHS)) | |
135 | + ((MACH ORFPX32-MACHS)) | |
74 | 136 | (.str "lf." mnemonic ".s $rDSF,$rASF,$rBSF") |
75 | 137 | (+ OPC_FLOAT rDSF rASF rBSF (f-resv-10-3 0) (.sym OPC_FLOAT_REGREG_ (.upcase mnemonic) _S)) |
76 | 138 | (set SF rDSF (mnemonic SF rASF rBSF)) |
@@ -84,6 +146,14 @@ | ||
84 | 146 | (set DF rDDF (mnemonic DF rADF rBDF)) |
85 | 147 | () |
86 | 148 | ) |
149 | + (dni (.sym lf- mnemonic -d32) | |
150 | + (.str "lf." mnemonic ".d regpair/regpair/regpair") | |
151 | + ((MACH ORFPX64A32-MACHS)) | |
152 | + (.str "lf." mnemonic ".d $rDD32F,$rAD32F,$rBD32F") | |
153 | + (+ OPC_FLOAT rDD32F rAD32F rBD32F (.sym OPC_FLOAT_REGREG_ (.upcase mnemonic) _D)) | |
154 | + (set DF rDD32F (mnemonic DF rAD32F rBD32F)) | |
155 | + () | |
156 | + ) | |
87 | 157 | ) |
88 | 158 | ) |
89 | 159 |
@@ -94,18 +164,28 @@ | ||
94 | 164 | |
95 | 165 | (dni lf-rem-s |
96 | 166 | "lf.rem.s reg/reg/reg" |
97 | - ((MACH ORFPX-MACHS)) | |
167 | + ((MACH ORFPX32-MACHS)) | |
98 | 168 | "lf.rem.s $rDSF,$rASF,$rBSF" |
99 | 169 | (+ OPC_FLOAT rDSF rASF rBSF (f-resv-10-3 0) OPC_FLOAT_REGREG_REM_S) |
100 | 170 | (set SF rDSF (rem SF rASF rBSF)) |
101 | 171 | () |
102 | 172 | ) |
173 | + | |
103 | 174 | (dni lf-rem-d |
104 | 175 | "lf.rem.d reg/reg/reg" |
105 | 176 | ((MACH ORFPX64-MACHS)) |
106 | 177 | "lf.rem.d $rDDF,$rADF,$rBDF" |
107 | 178 | (+ OPC_FLOAT rDDF rADF rBDF (f-resv-10-3 0) OPC_FLOAT_REGREG_REM_D) |
108 | - (set DF rDDF (mod DF rADF rBDF)) | |
179 | + (set DF rDDF (rem DF rADF rBDF)) | |
180 | + () | |
181 | + ) | |
182 | + | |
183 | +(dni lf-rem-d32 | |
184 | + "lf.rem.d regpair/regpair/regpair" | |
185 | + ((MACH ORFPX64A32-MACHS)) | |
186 | + "lf.rem.d $rDD32F,$rAD32F,$rBD32F" | |
187 | + (+ OPC_FLOAT rDD32F rAD32F rBD32F OPC_FLOAT_REGREG_REM_D) | |
188 | + (set DF rDD32F (rem DF rAD32F rBD32F)) | |
109 | 189 | () |
110 | 190 | ) |
111 | 191 |
@@ -120,24 +200,34 @@ | ||
120 | 200 | |
121 | 201 | (dni lf-itof-s |
122 | 202 | "lf.itof.s reg/reg" |
123 | - ((MACH ORFPX-MACHS)) | |
203 | + ((MACH ORFPX32-MACHS)) | |
124 | 204 | "lf.itof.s $rDSF,$rA" |
125 | 205 | (+ OPC_FLOAT rDSF rA (f-r3 0) (f-resv-10-3 0) OPC_FLOAT_REGREG_ITOF_S) |
126 | 206 | (set SF rDSF (float SF (get-rounding-mode) (trunc SI rA))) |
127 | 207 | () |
128 | 208 | ) |
209 | + | |
129 | 210 | (dni lf-itof-d |
130 | 211 | "lf.itof.d reg/reg" |
131 | 212 | ((MACH ORFPX64-MACHS)) |
132 | - "lf.itof.d $rDSF,$rA" | |
133 | - (+ OPC_FLOAT rDSF rA (f-r3 0) (f-resv-10-3 0) OPC_FLOAT_REGREG_ITOF_D) | |
213 | + "lf.itof.d $rDDF,$rA" | |
214 | + (+ OPC_FLOAT rDDF rA (f-r3 0) (f-resv-10-3 0) OPC_FLOAT_REGREG_ITOF_D) | |
134 | 215 | (set DF rDDF (float DF (get-rounding-mode) rA)) |
135 | 216 | () |
136 | 217 | ) |
137 | 218 | |
219 | +(dni lf-itof-d32 | |
220 | + "lf.itof.d regpair/regpair" | |
221 | + ((MACH ORFPX64A32-MACHS)) | |
222 | + "lf.itof.d $rDD32F,$rADI" | |
223 | + (+ OPC_FLOAT rDD32F rADI (f-r3 0) (f-resv-8-1 0) OPC_FLOAT_REGREG_ITOF_D) | |
224 | + (set DF rDD32F (float DF (get-rounding-mode) rADI)) | |
225 | + () | |
226 | + ) | |
227 | + | |
138 | 228 | (dni lf-ftoi-s |
139 | 229 | "lf.ftoi.s reg/reg" |
140 | - ((MACH ORFPX-MACHS)) | |
230 | + ((MACH ORFPX32-MACHS)) | |
141 | 231 | "lf.ftoi.s $rD,$rASF" |
142 | 232 | (+ OPC_FLOAT rD rASF (f-r3 0) (f-resv-10-3 0) OPC_FLOAT_REGREG_FTOI_S) |
143 | 233 | (set WI rD (ext WI (fix SI (get-rounding-mode) rASF))) |
@@ -149,7 +239,16 @@ | ||
149 | 239 | ((MACH ORFPX64-MACHS)) |
150 | 240 | "lf.ftoi.d $rD,$rADF" |
151 | 241 | (+ OPC_FLOAT rD rADF (f-r3 0) (f-resv-10-3 0) OPC_FLOAT_REGREG_FTOI_D) |
152 | - (set DI rD (fix DI (get-rounding-mode) rADF)) | |
242 | + (set WI rD (fix WI (get-rounding-mode) rADF)) | |
243 | + () | |
244 | + ) | |
245 | + | |
246 | +(dni lf-ftoi-d32 | |
247 | + "lf.ftoi.d regpair/regpair" | |
248 | + ((MACH ORFPX64A32-MACHS)) | |
249 | + "lf.ftoi.d $rDDI,$rAD32F" | |
250 | + (+ OPC_FLOAT rDDI rAD32F (f-r3 0) (f-resv-8-1 0) OPC_FLOAT_REGREG_FTOI_D) | |
251 | + (set DI rDDI (fix DI (get-rounding-mode) rAD32F)) | |
153 | 252 | () |
154 | 253 | ) |
155 | 254 |
@@ -157,7 +256,7 @@ | ||
157 | 256 | (begin |
158 | 257 | (dni (.sym lf- mnemonic -s) |
159 | 258 | (.str "lf.sf" mnemonic ".s reg/reg") |
160 | - ((MACH ORFPX-MACHS)) | |
259 | + ((MACH ORFPX32-MACHS)) | |
161 | 260 | (.str "lf.sf" mnemonic ".s $rASF,$rBSF") |
162 | 261 | (+ OPC_FLOAT (f-r1 0) rASF rBSF (f-resv-10-3 0) (.sym OPC_FLOAT_REGREG_SF (.upcase mnemonic) _S)) |
163 | 262 | (set BI sys-sr-f (mnemonic SF rASF rBSF)) |
@@ -166,11 +265,19 @@ | ||
166 | 265 | (dni (.sym lf- mnemonic -d) |
167 | 266 | (.str "lf.sf" mnemonic ".d reg/reg") |
168 | 267 | ((MACH ORFPX64-MACHS)) |
169 | - (.str "lf.sf" mnemonic ".d $rASF,$rBSF") | |
170 | - (+ OPC_FLOAT (f-r1 0) rASF rBSF (f-resv-10-3 0) (.sym OPC_FLOAT_REGREG_SF (.upcase mnemonic) _D)) | |
268 | + (.str "lf.sf" mnemonic ".d $rADF,$rBDF") | |
269 | + (+ OPC_FLOAT (f-r1 0) rADF rBDF (f-resv-10-3 0) (.sym OPC_FLOAT_REGREG_SF (.upcase mnemonic) _D)) | |
171 | 270 | (set BI sys-sr-f (mnemonic DF rADF rBDF)) |
172 | 271 | () |
173 | 272 | ) |
273 | + (dni (.sym lf- mnemonic -d32) | |
274 | + (.str "lf.sf" mnemonic ".d regpair/regpair") | |
275 | + ((MACH ORFPX64A32-MACHS)) | |
276 | + (.str "lf.sf" mnemonic ".d $rAD32F,$rBD32F") | |
277 | + (+ OPC_FLOAT (f-r1 0) rAD32F rBD32F (f-resv-10-1 0) (.sym OPC_FLOAT_REGREG_SF (.upcase mnemonic) _D)) | |
278 | + (set BI sys-sr-f (mnemonic DF rAD32F rBD32F)) | |
279 | + () | |
280 | + ) | |
174 | 281 | ) |
175 | 282 | ) |
176 | 283 |
@@ -183,12 +290,13 @@ | ||
183 | 290 | |
184 | 291 | (dni lf-madd-s |
185 | 292 | "lf.madd.s reg/reg/reg" |
186 | - ((MACH ORFPX-MACHS)) | |
293 | + ((MACH ORFPX32-MACHS)) | |
187 | 294 | "lf.madd.s $rDSF,$rASF,$rBSF" |
188 | 295 | (+ OPC_FLOAT rDSF rASF rBSF (f-resv-10-3 0) OPC_FLOAT_REGREG_MADD_S) |
189 | 296 | (set SF rDSF (add SF (mul SF rASF rBSF) rDSF)) |
190 | 297 | () |
191 | 298 | ) |
299 | + | |
192 | 300 | (dni lf-madd-d |
193 | 301 | "lf.madd.d reg/reg/reg" |
194 | 302 | ((MACH ORFPX64-MACHS)) |
@@ -198,11 +306,20 @@ | ||
198 | 306 | () |
199 | 307 | ) |
200 | 308 | |
309 | +(dni lf-madd-d32 | |
310 | + "lf.madd.d regpair/regpair/regpair" | |
311 | + ((MACH ORFPX64A32-MACHS)) | |
312 | + "lf.madd.d $rDD32F,$rAD32F,$rBD32F" | |
313 | + (+ OPC_FLOAT rDD32F rAD32F rBD32F OPC_FLOAT_REGREG_MADD_D) | |
314 | + (set DF rDD32F (add DF (mul DF rAD32F rBD32F) rDD32F)) | |
315 | + () | |
316 | + ) | |
317 | + | |
201 | 318 | (define-pmacro (float-cust-insn cust-num) |
202 | 319 | (begin |
203 | 320 | (dni (.sym "lf-cust" cust-num "-s") |
204 | 321 | (.str "lf.cust" cust-num ".s") |
205 | - ((MACH ORFPX-MACHS)) | |
322 | + ((MACH ORFPX32-MACHS)) | |
206 | 323 | (.str "lf.cust" cust-num ".s $rASF,$rBSF") |
207 | 324 | (+ OPC_FLOAT (f-resv-25-5 0) rASF rBSF (f-resv-10-3 0) (.sym "OPC_FLOAT_REGREG_CUST" cust-num "_S")) |
208 | 325 | (nop) |
@@ -216,6 +333,14 @@ | ||
216 | 333 | (nop) |
217 | 334 | () |
218 | 335 | ) |
336 | + (dni (.sym "lf-cust" cust-num "-d32") | |
337 | + (.str "lf.cust" cust-num ".d") | |
338 | + ((MACH ORFPX64A32-MACHS)) | |
339 | + (.str "lf.cust" cust-num ".d") | |
340 | + (+ OPC_FLOAT (f-resv-25-5 0) rAD32F rBD32F (f-resv-10-1 0) (.sym "OPC_FLOAT_REGREG_CUST" cust-num "_D")) | |
341 | + (nop) | |
342 | + () | |
343 | + ) | |
219 | 344 | ) |
220 | 345 | ) |
221 | 346 |