diff options
author | Jan Beulich <jbeulich@novell.com> | 2018-03-08 08:44:52 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2018-03-08 08:44:52 +0100 |
commit | b9d498173c0394b385f0ddef636b87e6235564da (patch) | |
tree | 6c7e2e9a7d24155df2f8b12376f00913be446593 | |
parent | bcb1753ee643a7d5ac136189f9bc06717dfdfb64 (diff) | |
download | gdb-b9d498173c0394b385f0ddef636b87e6235564da.zip gdb-b9d498173c0394b385f0ddef636b87e6235564da.tar.gz gdb-b9d498173c0394b385f0ddef636b87e6235564da.tar.bz2 |
x86: simplify AVX checks in cpu_flags_match()
No caller cares about the specifics of CPU_FLAGS_{AES,AVX,PCLMUL}_MATCH,
so drop those and fold the nested if()-s.
-rw-r--r-- | gas/ChangeLog | 8 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 28 |
2 files changed, 14 insertions, 22 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 683d1bc..6046011 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,13 @@ 2018-03-08 Jan Beulich <jbeulich@suse.com> + * config/tc-i386.c (CPU_FLAGS_AES_MATCH, CPU_FLAGS_AVX_MATCH, + CPU_FLAGS_PCLMUL_MATCH): Delete. + (CPU_FLAGS_32BIT_MATCH): Drop uses of deleted CPU_FLAGS_*_MATCH. + (cpu_flags_match): Combine AVX checks into + single if(). + +2018-03-08 Jan Beulich <jbeulich@suse.com> + * config/tc-i386.c (cpu_flags_match): Drop "else" branches setting CPU_FLAGS_ARCH_MATCH. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 0c0b591..818281c 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -1687,13 +1687,8 @@ cpu_flags_and_not (i386_cpu_flags x, i386_cpu_flags y) #define CPU_FLAGS_ARCH_MATCH 0x1 #define CPU_FLAGS_64BIT_MATCH 0x2 -#define CPU_FLAGS_AES_MATCH 0x4 -#define CPU_FLAGS_PCLMUL_MATCH 0x8 -#define CPU_FLAGS_AVX_MATCH 0x10 -#define CPU_FLAGS_32BIT_MATCH \ - (CPU_FLAGS_ARCH_MATCH | CPU_FLAGS_AES_MATCH \ - | CPU_FLAGS_PCLMUL_MATCH | CPU_FLAGS_AVX_MATCH) +#define CPU_FLAGS_32BIT_MATCH CPU_FLAGS_ARCH_MATCH #define CPU_FLAGS_PERFECT_MATCH \ (CPU_FLAGS_32BIT_MATCH | CPU_FLAGS_64BIT_MATCH) @@ -1724,22 +1719,11 @@ cpu_flags_match (const insn_template *t) if (x.bitfield.cpuavx) { /* We only need to check AES/PCLMUL/SSE2AVX with AVX. */ - if (cpu.bitfield.cpuavx) - { - /* Check SSE2AVX. */ - if (!t->opcode_modifier.sse2avx|| sse2avx) - { - match |= (CPU_FLAGS_ARCH_MATCH - | CPU_FLAGS_AVX_MATCH); - /* Check AES. */ - if (!x.bitfield.cpuaes || cpu.bitfield.cpuaes) - match |= CPU_FLAGS_AES_MATCH; - /* Check PCLMUL. */ - if (!x.bitfield.cpupclmul - || cpu.bitfield.cpupclmul) - match |= CPU_FLAGS_PCLMUL_MATCH; - } - } + if (cpu.bitfield.cpuavx + && (!t->opcode_modifier.sse2avx || sse2avx) + && (!x.bitfield.cpuaes || cpu.bitfield.cpuaes) + && (!x.bitfield.cpupclmul || cpu.bitfield.cpupclmul)) + match |= CPU_FLAGS_ARCH_MATCH; } else if (x.bitfield.cpuavx512vl) { |