diff options
author | Jan Beulich <jbeulich@suse.com> | 2025-01-17 10:28:15 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2025-01-17 10:28:15 +0100 |
commit | b88282d5738cd239f67be00d4d9b48d6afda78ca (patch) | |
tree | d969ac233cf8d4608aa5758e0053c0070ab70538 | |
parent | 247357d23f48c503a3efe56997e73489360c4279 (diff) | |
download | gdb-b88282d5738cd239f67be00d4d9b48d6afda78ca.zip gdb-b88282d5738cd239f67be00d4d9b48d6afda78ca.tar.gz gdb-b88282d5738cd239f67be00d4d9b48d6afda78ca.tar.bz2 |
x86/APX: convert runtime special case to build-time one
cpu_flags_match() is a hot path. Move the special casing that
b7267244a355 ("Support Intel AMX-MOVRS") added there to i386-gen, thus
affecting only build time performance.
-rw-r--r-- | gas/config/tc-i386.c | 8 | ||||
-rw-r--r-- | opcodes/i386-gen.c | 14 | ||||
-rw-r--r-- | opcodes/i386-tbl.h | 8 |
3 files changed, 18 insertions, 12 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 8792619..21217db 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2262,14 +2262,6 @@ cpu_flags_match (const insn_template *t) the "if()" below. */ gas_assert (!cpu_flags_all_zero (&all)); - /* For APX_F extension of multiple cpuid enabled insns, we could not - use APX_F(cpuid_A&cpuid_B) since the transformation could not be - done. Instead, we will use cpuid_A & APX_F(cpuid_B), then the - "any" bitfield would not be set for cpuid_A. Set cpuid_A for "any" - here since it is its original meaning. */ - if (all.bitfield.cpuamx_transpose && any.bitfield.cpuamx_movrs) - any.bitfield.cpuamx_transpose = 1; - cpu = cpu_flags_and (all, any); gas_assert (cpu_flags_equal (&cpu, &all)); diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c index d2d9b5d..e21cc79 100644 --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -1039,6 +1039,20 @@ process_i386_cpu_flag (FILE *table, char *flag, all[Cpu64].value = 1; output_cpu_flags(table, all, ARRAY_SIZE (all), -1, comma, indent, lineno); + + /* For APX_F extension of multiple cpuid enabled insns, we cannot use + APX_F(cpuid_A&cpuid_B) in the opcode table, as the result would fail + to be parsed. Furthermore, the result also wouldn't be quite valid. + However, the assembler's cpu_flags_match() will simply propagate "any" + to "all", zapping "any" afterwards altogether. IOW in this situation + both masks have "&&" meaning. Set the missing flag here. */ + if (all[CpuAMX_TRANSPOSE].value && all[CpuAMX_MOVRS].value) + { + if (!any[CpuAPX_F].value || !any[CpuAMX_MOVRS].value) + fail ("%s: %d: internal error: APX_F=%d AMX_MOVRS=%d\n", + filename, lineno, any[CpuAPX_F].value, any[CpuAMX_MOVRS].value); + any[CpuAMX_TRANSPOSE].value = 1; + } } output_cpu_flags (table, any, ARRAY_SIZE (any), name != NULL, diff --git a/opcodes/i386-tbl.h b/opcodes/i386-tbl.h index 8f74e30..e17f56b 100644 --- a/opcodes/i386-tbl.h +++ b/opcodes/i386-tbl.h @@ -43193,7 +43193,7 @@ static const insn_template i386_optab[] = 0, 0, 0, 1, 0, 1, 0, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { { 117, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0 } }, - { { 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 } }, + { { 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0 } }, { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 } }, { { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -43203,7 +43203,7 @@ static const insn_template i386_optab[] = 0, 0, 0, 1, 0, 1, 0, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { { 117, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0 } }, - { { 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 } }, + { { 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0 } }, { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 } }, { { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -43213,7 +43213,7 @@ static const insn_template i386_optab[] = 0, 0, 0, 1, 0, 1, 1, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { { 117, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0 } }, - { { 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 } }, + { { 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0 } }, { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 } }, { { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -43223,7 +43223,7 @@ static const insn_template i386_optab[] = 0, 0, 0, 1, 0, 1, 1, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { { 117, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0 } }, - { { 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 } }, + { { 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0 } }, { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 } }, { { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |