static char *cpu_sub_arch_name = NULL;
/* CPU feature flags. */
-static i386_cpu_flags cpu_arch_flags = CPU_UNKNOWN_FLAGS;
+i386_cpu_flags cpu_arch_flags = CPU_UNKNOWN_FLAGS;
/* If we have selected a cpu we are generating instructions for. */
static int cpu_arch_tune_set = 0;
patt = fragP->tc_frag_data.code == CODE_64BIT ? f64_patt : f32_patt;
if (fragP->tc_frag_data.isa == PROCESSOR_UNKNOWN)
{
- /* PROCESSOR_UNKNOWN means that all ISAs may be used. */
+ /* PROCESSOR_UNKNOWN means that all ISAs may be used, unless
+ explicitly disabled. */
switch (fragP->tc_frag_data.tune)
{
case PROCESSOR_UNKNOWN:
case PROCESSOR_BD:
case PROCESSOR_ZNVER:
case PROCESSOR_BT:
- patt = alt_patt;
+ if (fragP->tc_frag_data.cpunop)
+ patt = alt_patt;
break;
+
case PROCESSOR_I386:
case PROCESSOR_I486:
case PROCESSOR_PENTIUM:
abort ();
break;
- case PROCESSOR_I386:
- case PROCESSOR_I486:
- case PROCESSOR_PENTIUM:
- case PROCESSOR_IAMCU:
- case PROCESSOR_K6:
- case PROCESSOR_ATHLON:
- case PROCESSOR_K8:
- case PROCESSOR_AMDFAM10:
- case PROCESSOR_BD:
- case PROCESSOR_ZNVER:
- case PROCESSOR_BT:
- case PROCESSOR_GENERIC32:
+ default:
/* We use cpu_arch_isa_flags to check if we CAN optimize
with nops. */
if (fragP->tc_frag_data.isa_flags.bitfield.cpunop)
patt = alt_patt;
break;
- case PROCESSOR_PENTIUMPRO:
- case PROCESSOR_PENTIUM4:
- case PROCESSOR_NOCONA:
- case PROCESSOR_CORE:
- case PROCESSOR_CORE2:
- case PROCESSOR_COREI7:
- if (fragP->tc_frag_data.isa_flags.bitfield.cpunop)
- patt = alt_patt;
- break;
- case PROCESSOR_GENERIC64:
- patt = alt_patt;
- break;
+
case PROCESSOR_NONE:
abort ();
}
PROCESSOR_NONE
};
+extern i386_cpu_flags cpu_arch_flags;
extern enum processor_type cpu_arch_tune;
extern enum processor_type cpu_arch_isa;
extern i386_cpu_flags cpu_arch_isa_flags;
unsigned int mf_type : 3;
unsigned int classified : 1;
unsigned int branch_type : 3;
+ unsigned int cpunop : 1;
};
/* We need to emit the right NOP pattern in .align frags. This is
(FRAGP)->tc_frag_data.isa = cpu_arch_isa; \
(FRAGP)->tc_frag_data.isa_flags = cpu_arch_isa_flags; \
(FRAGP)->tc_frag_data.tune = cpu_arch_tune; \
+ (FRAGP)->tc_frag_data.cpunop = cpu_arch_flags.bitfield.cpunop; \
(FRAGP)->tc_frag_data.code = i386_flag_code; \
(FRAGP)->tc_frag_data.max_bytes = (MAX_BYTES); \
(FRAGP)->tc_frag_data.length = 0; \
--- /dev/null
+#as: -march=core2+nonop
+#source: nops-1.s
+#objdump: -drw
+#name: x86-64 -march=core2+nonop nops 1
+#dump: x86-64-nops-1-pentium.d
--- /dev/null
+#as: -march=generic64+nonop
+#source: nops-1.s
+#objdump: -drw
+#name: x86-64 -march=generic64+nonop nops 1
+#dump: x86-64-nops-1-pentium.d
run_dump_test "x86-64-nops-1-k8"
run_dump_test "x86-64-nops-1-core2"
run_dump_test "x86-64-nops-1-pentium"
+run_dump_test "x86-64-nops-1a-g64"
+run_dump_test "x86-64-nops-1a-core2"
run_dump_test "x86-64-nops-2"
run_dump_test "x86-64-nops-3"
run_dump_test "x86-64-nops-4"