diff options
author | Jan Beulich <jbeulich@novell.com> | 2018-09-13 11:07:07 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2018-09-13 11:07:07 +0200 |
commit | dbbc8b7e629fa666affd9a3f475d0bf6e5264677 (patch) | |
tree | 316472083e52276cc78cdaf84062a83c2cb8489e /gas | |
parent | efb192033ad82855bcfab207f8494e8b1f3e243b (diff) | |
download | gdb-dbbc8b7e629fa666affd9a3f475d0bf6e5264677.zip gdb-dbbc8b7e629fa666affd9a3f475d0bf6e5264677.tar.gz gdb-dbbc8b7e629fa666affd9a3f475d0bf6e5264677.tar.bz2 |
x86: use D attribute also for SIMD templates
Various moves come in load and store forms, and just like on the GPR
and FPU sides there would better be only one pattern. In some cases this
is not feasible because the opcodes are too different, but quite a few
cases follow a similar standard scheme. Introduce Opcode_SIMD_FloatD and
Opcode_SIMD_IntD, generalize handling in operand_size_match() (reverse
operand handling there simply needs to match "straight" operand one),
and fix a long standing, but so far only latent bug with when to zap
found_reverse_match.
Also once again drop IgnoreSize where pointlessly applied to templates
touched anyway as well as *word when redundant with Reg*.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 13 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 34 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/pseudos.d | 20 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/pseudos.s | 20 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-pseudos.d | 24 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-pseudos.s | 24 |
6 files changed, 126 insertions, 9 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index a60cb60..1c6e536 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,18 @@ 2018-09-13 Jan Beulich <jbeulich@suse.com> + * config/tc-i386.c (operand_size_match): Mirror + .reg/.regsimd/.acc handling from forward to reverse case. + (build_vex_prefix): Check first and last operand types are equal + and also consider .d for swapping operands for VEX2 encoding. + (match_template): Clear found_reverse_match on every iteration. + Use Opcode_SIMD_FloatD and Opcode_SIMD_IntD. + * testsuite/gas/i386/pseudos.s, + testsuite/gas/i386/x86-64-pseudos.s: Add kmov* tests. + * testsuite/gas/i386/pseudos.d, + testsuite/gas/i386/x86-64-pseudos.d: Adjust expectations. + +2018-09-13 Jan Beulich <jbeulich@suse.com> + testsuite/gas/i386/ilp32/x86-64-opts.d, testsuite/gas/i386/ilp32/x86-64-opts-intel.d, testsuite/gas/i386/ilp32/x86-64-sse2avx-opts.d, diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index b3c7334..b376001 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2057,11 +2057,18 @@ mismatch: for (j = 0; j < 2; j++) { - if ((t->operand_types[j].bitfield.reg - || t->operand_types[j].bitfield.acc) + if (t->operand_types[j].bitfield.reg && !match_operand_size (t, j, !j)) goto mismatch; + if (t->operand_types[j].bitfield.regsimd + && !match_simd_size (t, j, !j)) + goto mismatch; + + if (t->operand_types[j].bitfield.acc + && (!match_operand_size (t, j, !j) || !match_simd_size (t, j, !j))) + goto mismatch; + if ((i.flags[!j] & Operand_Mem) && !match_mem_size (t, j, !j)) goto mismatch; } @@ -3359,8 +3366,9 @@ build_vex_prefix (const insn_template *t) if (i.vec_encoding != vex_encoding_vex3 && i.dir_encoding == dir_encoding_default && i.operands == i.reg_operands + && operand_type_equal (&i.types[0], &i.types[i.operands - 1]) && i.tm.opcode_modifier.vexopcode == VEX0F - && i.tm.opcode_modifier.load + && (i.tm.opcode_modifier.load || i.tm.opcode_modifier.d) && i.rex == REX_B) { unsigned int xchg = i.operands - 1; @@ -3381,8 +3389,11 @@ build_vex_prefix (const insn_template *t) i.rm.regmem = i.rm.reg; i.rm.reg = xchg; - /* Use the next insn. */ - i.tm = t[1]; + if (i.tm.opcode_modifier.d) + i.tm.base_opcode ^= (i.tm.base_opcode & 0xee) != 0x6e + ? Opcode_SIMD_FloatD : Opcode_SIMD_IntD; + else /* Use the next insn. */ + i.tm = t[1]; } if (i.tm.opcode_modifier.vex == VEXScalar) @@ -5527,6 +5538,7 @@ match_template (char mnem_suffix) for (t = current_templates->start; t < current_templates->end; t++) { addr_prefix_disp = -1; + found_reverse_match = 0; if (i.operands != t->operands) continue; @@ -5777,6 +5789,13 @@ check_reverse: found_reverse_match = 0; else if (operand_types[0].bitfield.tbyte) found_reverse_match = Opcode_FloatD; + else if (operand_types[0].bitfield.xmmword + || operand_types[1].bitfield.xmmword + || operand_types[0].bitfield.regmmx + || operand_types[1].bitfield.regmmx + || is_any_vex_encoding(t)) + found_reverse_match = (t->base_opcode & 0xee) != 0x6e + ? Opcode_SIMD_FloatD : Opcode_SIMD_IntD; else found_reverse_match = Opcode_D; if (t->opcode_modifier.floatr) @@ -5847,10 +5866,7 @@ check_reverse: slip through to break. */ } if (!found_cpu_match) - { - found_reverse_match = 0; - continue; - } + continue; /* Check if vector and VEX operands are valid. */ if (check_VecOperands (t) || VEX_check_operands (t)) diff --git a/gas/testsuite/gas/i386/pseudos.d b/gas/testsuite/gas/i386/pseudos.d index acaf972..65531bf 100644 --- a/gas/testsuite/gas/i386/pseudos.d +++ b/gas/testsuite/gas/i386/pseudos.d @@ -68,6 +68,26 @@ Disassembly of section .text: +[a-f0-9]+: 0f 23 f8 mov %eax,%db7 +[a-f0-9]+: 0f 21 c7 mov %db0,%edi +[a-f0-9]+: 0f 23 f8 mov %eax,%db7 + +[a-f0-9]+: c5 f9 93 f8 kmovb %k0,%edi + +[a-f0-9]+: c5 f9 92 f8 kmovb %eax,%k7 + +[a-f0-9]+: c5 f9 93 f8 kmovb %k0,%edi + +[a-f0-9]+: c5 f9 92 f8 kmovb %eax,%k7 + +[a-f0-9]+: c5 fb 93 f8 kmovd %k0,%edi + +[a-f0-9]+: c5 fb 92 f8 kmovd %eax,%k7 + +[a-f0-9]+: c5 fb 93 f8 kmovd %k0,%edi + +[a-f0-9]+: c5 fb 92 f8 kmovd %eax,%k7 + +[a-f0-9]+: c5 f8 93 f8 kmovw %k0,%edi + +[a-f0-9]+: c5 f8 92 f8 kmovw %eax,%k7 + +[a-f0-9]+: c5 f8 93 f8 kmovw %k0,%edi + +[a-f0-9]+: c5 f8 92 f8 kmovw %eax,%k7 + +[a-f0-9]+: c5 f9 90 f8 kmovb %k0,%k7 + +[a-f0-9]+: c5 f9 90 f8 kmovb %k0,%k7 + +[a-f0-9]+: c4 e1 f9 90 f8 kmovd %k0,%k7 + +[a-f0-9]+: c4 e1 f9 90 f8 kmovd %k0,%k7 + +[a-f0-9]+: c4 e1 f8 90 f8 kmovq %k0,%k7 + +[a-f0-9]+: c4 e1 f8 90 f8 kmovq %k0,%k7 + +[a-f0-9]+: c5 f8 90 f8 kmovw %k0,%k7 + +[a-f0-9]+: c5 f8 90 f8 kmovw %k0,%k7 +[a-f0-9]+: 11 07 adc %eax,\(%edi\) +[a-f0-9]+: 13 07 adc \(%edi\),%eax +[a-f0-9]+: 11 07 adc %eax,\(%edi\) diff --git a/gas/testsuite/gas/i386/pseudos.s b/gas/testsuite/gas/i386/pseudos.s index 2f33980..95da66c 100644 --- a/gas/testsuite/gas/i386/pseudos.s +++ b/gas/testsuite/gas/i386/pseudos.s @@ -65,6 +65,26 @@ _start: {load} mov %eax, %dr7 {store} mov %dr0, %edi {store} mov %eax, %dr7 + {load} kmovb %k0, %edi + {load} kmovb %eax, %k7 + {store} kmovb %k0, %edi + {store} kmovb %eax, %k7 + {load} kmovd %k0, %edi + {load} kmovd %eax, %k7 + {store} kmovd %k0, %edi + {store} kmovd %eax, %k7 + {load} kmovw %k0, %edi + {load} kmovw %eax, %k7 + {store} kmovw %k0, %edi + {store} kmovw %eax, %k7 + {load} kmovb %k0, %k7 + {store} kmovb %k0, %k7 + {load} kmovd %k0, %k7 + {store} kmovd %k0, %k7 + {load} kmovq %k0, %k7 + {store} kmovq %k0, %k7 + {load} kmovw %k0, %k7 + {store} kmovw %k0, %k7 {load} adc %eax, (%edi) {load} adc (%edi), %eax {store} adc %eax, (%edi) diff --git a/gas/testsuite/gas/i386/x86-64-pseudos.d b/gas/testsuite/gas/i386/x86-64-pseudos.d index 064ece4..d38f837 100644 --- a/gas/testsuite/gas/i386/x86-64-pseudos.d +++ b/gas/testsuite/gas/i386/x86-64-pseudos.d @@ -76,6 +76,30 @@ Disassembly of section .text: +[a-f0-9]+: 0f 23 f8 mov %rax,%db7 +[a-f0-9]+: 0f 21 c7 mov %db0,%rdi +[a-f0-9]+: 0f 23 f8 mov %rax,%db7 + +[a-f0-9]+: c5 f9 93 f8 kmovb %k0,%edi + +[a-f0-9]+: c5 f9 92 f8 kmovb %eax,%k7 + +[a-f0-9]+: c5 f9 93 f8 kmovb %k0,%edi + +[a-f0-9]+: c5 f9 92 f8 kmovb %eax,%k7 + +[a-f0-9]+: c5 fb 93 f8 kmovd %k0,%edi + +[a-f0-9]+: c5 fb 92 f8 kmovd %eax,%k7 + +[a-f0-9]+: c5 fb 93 f8 kmovd %k0,%edi + +[a-f0-9]+: c5 fb 92 f8 kmovd %eax,%k7 + +[a-f0-9]+: c4 e1 fb 93 f8 kmovq %k0,%rdi + +[a-f0-9]+: c4 e1 fb 92 f8 kmovq %rax,%k7 + +[a-f0-9]+: c4 e1 fb 93 f8 kmovq %k0,%rdi + +[a-f0-9]+: c4 e1 fb 92 f8 kmovq %rax,%k7 + +[a-f0-9]+: c5 f8 93 f8 kmovw %k0,%edi + +[a-f0-9]+: c5 f8 92 f8 kmovw %eax,%k7 + +[a-f0-9]+: c5 f8 93 f8 kmovw %k0,%edi + +[a-f0-9]+: c5 f8 92 f8 kmovw %eax,%k7 + +[a-f0-9]+: c5 f9 90 f8 kmovb %k0,%k7 + +[a-f0-9]+: c5 f9 90 f8 kmovb %k0,%k7 + +[a-f0-9]+: c4 e1 f9 90 f8 kmovd %k0,%k7 + +[a-f0-9]+: c4 e1 f9 90 f8 kmovd %k0,%k7 + +[a-f0-9]+: c4 e1 f8 90 f8 kmovq %k0,%k7 + +[a-f0-9]+: c4 e1 f8 90 f8 kmovq %k0,%k7 + +[a-f0-9]+: c5 f8 90 f8 kmovw %k0,%k7 + +[a-f0-9]+: c5 f8 90 f8 kmovw %k0,%k7 +[a-f0-9]+: 11 07 adc %eax,\(%rdi\) +[a-f0-9]+: 13 07 adc \(%rdi\),%eax +[a-f0-9]+: 11 07 adc %eax,\(%rdi\) diff --git a/gas/testsuite/gas/i386/x86-64-pseudos.s b/gas/testsuite/gas/i386/x86-64-pseudos.s index cbd0096..b5d9a8c 100644 --- a/gas/testsuite/gas/i386/x86-64-pseudos.s +++ b/gas/testsuite/gas/i386/x86-64-pseudos.s @@ -73,6 +73,30 @@ _start: {load} mov %rax, %dr7 {store} mov %dr0, %rdi {store} mov %rax, %dr7 + {load} kmovb %k0, %edi + {load} kmovb %eax, %k7 + {store} kmovb %k0, %edi + {store} kmovb %eax, %k7 + {load} kmovd %k0, %edi + {load} kmovd %eax, %k7 + {store} kmovd %k0, %edi + {store} kmovd %eax, %k7 + {load} kmovq %k0, %rdi + {load} kmovq %rax, %k7 + {store} kmovq %k0, %rdi + {store} kmovq %rax, %k7 + {load} kmovw %k0, %edi + {load} kmovw %eax, %k7 + {store} kmovw %k0, %edi + {store} kmovw %eax, %k7 + {load} kmovb %k0, %k7 + {store} kmovb %k0, %k7 + {load} kmovd %k0, %k7 + {store} kmovd %k0, %k7 + {load} kmovq %k0, %k7 + {store} kmovq %k0, %k7 + {load} kmovw %k0, %k7 + {store} kmovw %k0, %k7 {load} adc %eax, (%rdi) {load} adc (%rdi), %eax {store} adc %eax, (%rdi) |