Skip to content

Commit 3315614

Browse files
Matthew FortuneFaraz Shahbazker
authored andcommitted
[MIPS] Apply ASE information for the selected processor
GAS does not enable implicit ASEs for most MIPS processors. The rework of option handling done as part of .module implementation left the implicit ASE logic broken and default enabled ASEs for most processors did not get applied. This patch ensures the ASE information is carried forward to the point where it is required. gas/ * config/tc-mips.c (mips_set_options) <init_ase>: New field. (file_mips_opts, mips_opts) <init_ase>: Initialize new field. (file_mips_check_options): Propagate initial ASE settings. (mips_after_parse_args, parse_code_option): Track the initial ASE settings for a CPU. (s_mipsset): Restore the initial ASE settings when reverting to the default arch. * testsuite/gas/mips/elf_mach_p6600.d: New test. * testsuite/gas/mips/mips.exp: Run the new test.
1 parent c40e31a commit 3315614

File tree

4 files changed

+51
-7
lines changed

4 files changed

+51
-7
lines changed

gas/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2019-04-09 Matthew Fortune <[email protected]>
2+
3+
* config/tc-mips.c (mips_set_options) <init_ase>: New field.
4+
(file_mips_opts, mips_opts) <init_ase>: Initialize new field.
5+
(file_mips_check_options): Propagate initial ASE settings.
6+
(mips_after_parse_args, parse_code_option): Track the initial
7+
ASE settings for a CPU.
8+
(s_mipsset): Restore the initial ASE settings when reverting
9+
to the default arch.
10+
* testsuite/gas/mips/elf_mach_p6600.d: New test.
11+
* testsuite/gas/mips/mips.exp: Run the new test.
12+
113
2019-04-12 John Darrington <[email protected]>
214

315
config/tc-s12z.h: Remove definition of macro TC_M68K

gas/config/tc-mips.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ struct mips_set_options
268268
/* 1 if single-precision operations on odd-numbered registers are
269269
allowed. */
270270
int oddspreg;
271+
272+
/* The set of ASEs that should be enabled for the user specified
273+
architecture. This cannot be inferred from 'arch' for all cores
274+
as processors only have a unique 'arch' if they add architecture
275+
specific instructions (UDI). */
276+
int init_ase;
271277
};
272278

273279
/* Specifies whether module level options have been checked yet. */
@@ -289,7 +295,8 @@ static struct mips_set_options file_mips_opts =
289295
/* noreorder */ 0, /* at */ ATREG, /* warn_about_macros */ 0,
290296
/* nomove */ 0, /* nobopt */ 0, /* noautoextend */ 0, /* insn32 */ FALSE,
291297
/* gp */ -1, /* fp */ -1, /* arch */ CPU_UNKNOWN, /* sym32 */ FALSE,
292-
/* soft_float */ FALSE, /* single_float */ FALSE, /* oddspreg */ -1
298+
/* soft_float */ FALSE, /* single_float */ FALSE, /* oddspreg */ -1,
299+
/* init_ase */ 0
293300
};
294301

295302
/* This is similar to file_mips_opts, but for the current set of options. */
@@ -300,7 +307,8 @@ static struct mips_set_options mips_opts =
300307
/* noreorder */ 0, /* at */ ATREG, /* warn_about_macros */ 0,
301308
/* nomove */ 0, /* nobopt */ 0, /* noautoextend */ 0, /* insn32 */ FALSE,
302309
/* gp */ -1, /* fp */ -1, /* arch */ CPU_UNKNOWN, /* sym32 */ FALSE,
303-
/* soft_float */ FALSE, /* single_float */ FALSE, /* oddspreg */ -1
310+
/* soft_float */ FALSE, /* single_float */ FALSE, /* oddspreg */ -1,
311+
/* init_ase */ 0
304312
};
305313

306314
/* Which bits of file_ase were explicitly set or cleared by ASE options. */
@@ -4086,8 +4094,6 @@ mips_check_options (struct mips_set_options *opts, bfd_boolean abi_checks)
40864094
static void
40874095
file_mips_check_options (void)
40884096
{
4089-
const struct mips_cpu_info *arch_info = 0;
4090-
40914097
if (file_mips_opts_checked)
40924098
return;
40934099

@@ -4130,8 +4136,6 @@ file_mips_check_options (void)
41304136
file_mips_opts.fp = 32;
41314137
}
41324138

4133-
arch_info = mips_cpu_info_from_arch (file_mips_opts.arch);
4134-
41354139
/* Disable operations on odd-numbered floating-point registers by default
41364140
when using the FPXX ABI. */
41374141
if (file_mips_opts.oddspreg < 0)
@@ -4175,7 +4179,7 @@ file_mips_check_options (void)
41754179

41764180
/* If the user didn't explicitly select or deselect a particular ASE,
41774181
use the default setting for the CPU. */
4178-
file_mips_opts.ase |= (arch_info->ase & ~file_ase_explicit);
4182+
file_mips_opts.ase |= (file_mips_opts.init_ase & ~file_ase_explicit);
41794183

41804184
/* Set up the current options. These may change throughout assembly. */
41814185
mips_opts = file_mips_opts;
@@ -15189,6 +15193,7 @@ mips_after_parse_args (void)
1518915193

1519015194
file_mips_opts.arch = arch_info->cpu;
1519115195
file_mips_opts.isa = arch_info->isa;
15196+
file_mips_opts.init_ase = arch_info->ase;
1519215197

1519315198
/* Set up initial mips_opts state. */
1519415199
mips_opts = file_mips_opts;
@@ -16559,6 +16564,7 @@ parse_code_option (char * name)
1655916564
mips_opts.arch = p->cpu;
1656016565
mips_opts.isa = p->isa;
1656116566
isa_set = TRUE;
16567+
mips_opts.init_ase = p->ase;
1656216568
}
1656316569
}
1656416570
else if (strncmp (name, "mips", 4) == 0)
@@ -16573,6 +16579,7 @@ parse_code_option (char * name)
1657316579
mips_opts.arch = p->cpu;
1657416580
mips_opts.isa = p->isa;
1657516581
isa_set = TRUE;
16582+
mips_opts.init_ase = p->ase;
1657616583
}
1657716584
}
1657816585
else
@@ -16646,6 +16653,7 @@ s_mipsset (int x ATTRIBUTE_UNUSED)
1664616653
{
1664716654
mips_opts.isa = file_mips_opts.isa;
1664816655
mips_opts.arch = file_mips_opts.arch;
16656+
mips_opts.init_ase = file_mips_opts.init_ase;
1664916657
mips_opts.gp = file_mips_opts.gp;
1665016658
mips_opts.fp = file_mips_opts.fp;
1665116659
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#readelf: -Ah
2+
#name: ELF p6600 markings
3+
#as: -64 -march=p6600
4+
#source: empty.s
5+
6+
ELF Header:
7+
#...
8+
Flags: +0xa......., .*mips64r6.*
9+
#...
10+
11+
MIPS ABI Flags Version: 0
12+
13+
ISA: MIPS64r6
14+
GPR size: 64
15+
CPR1 size: 128
16+
CPR2 size: 0
17+
FP ABI: .*
18+
ISA Extension: None
19+
ASEs:
20+
VZ ASE
21+
MSA ASE
22+
FLAGS 1: .*
23+
FLAGS 2: .*

gas/testsuite/gas/mips/mips.exp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,7 @@ if { [istarget mips*-*-vxworks*] } {
11511151
# Verify that machine markings are handled properly.
11521152
run_dump_test "elf_mach_5900"
11531153
run_dump_test "elf_mach_interaptiv-mr2"
1154+
run_dump_test "elf_mach_p6600"
11541155

11551156
run_dump_test "mips-gp32-fp32-pic"
11561157
run_dump_test "mips-gp32-fp64-pic"

0 commit comments

Comments
 (0)