From a477a8c4f4f7e827d32abc1fbb45bdb3c37cff09 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 8 Mar 2018 08:27:28 +0100 Subject: [PATCH] x86: adjust 4-XMM-register-group related warning Drop "second": For one there's no other source register (the other source operand is in memory), and in Intel syntax such numbering would also be wrong. Take the opportunity and also - properly place declarations ahead of statements - use %u format for unsigned int arguments - fix indentation --- gas/ChangeLog | 8 +++++++ gas/config/tc-i386.c | 25 +++++++++++----------- gas/testsuite/gas/i386/avx512_4fmaps-warn.l | 24 ++++++++++----------- gas/testsuite/gas/i386/x86-64-avx512_4fmaps-warn.l | 12 +++++------ 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 6a1d0a2..ef247df 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,13 @@ 2018-03-08 Jan Beulich + * config/tc-i386.c (process_operands): Access operands only + after operand count assertion. Sanitize warning text. Fix + indentation. + * testsuite/gas/i386/avx512_4fmaps-warn.l, + gas/i386/x86-64-avx512_4fmaps-warn.l: Adjust expectations. + +2018-03-08 Jan Beulich + * testsuite/gas/i386/x86-64-movd.s: Drop bogus vmovd memory forms. * testsuite/gas/i386/x86-64-movd.d, testsuite/gas/i386/x86-64-movd-intel.d: Adjust expectations. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 24fa4c7..3a21a35 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -6414,20 +6414,21 @@ duplicate: } else if (i.tm.opcode_modifier.implicitquadgroup) { + unsigned int regnum, first_reg_in_group, last_reg_in_group; + /* The second operand must be {x,y,z}mmN, where N is a multiple of 4. */ gas_assert (i.operands >= 2 && i.types[1].bitfield.regsimd); - unsigned int regnum = register_number (i.op[1].regs); - unsigned int first_reg_in_group = regnum & ~3; - unsigned int last_reg_in_group = first_reg_in_group + 3; - if (regnum != first_reg_in_group) { - as_warn (_("the second source register `%s%s' implicitly denotes" - " `%s%.3s%d' to `%s%.3s%d' source group in `%s'"), - register_prefix, i.op[1].regs->reg_name, - register_prefix, i.op[1].regs->reg_name, first_reg_in_group, - register_prefix, i.op[1].regs->reg_name, last_reg_in_group, - i.tm.name); - } - } + regnum = register_number (i.op[1].regs); + first_reg_in_group = regnum & ~3; + last_reg_in_group = first_reg_in_group + 3; + if (regnum != first_reg_in_group) + as_warn (_("source register `%s%s' implicitly denotes" + " `%s%.3s%u' to `%s%.3s%u' source group in `%s'"), + register_prefix, i.op[1].regs->reg_name, + register_prefix, i.op[1].regs->reg_name, first_reg_in_group, + register_prefix, i.op[1].regs->reg_name, last_reg_in_group, + i.tm.name); + } else if (i.tm.opcode_modifier.regkludge) { /* The imul $imm, %reg instruction is converted into diff --git a/gas/testsuite/gas/i386/avx512_4fmaps-warn.l b/gas/testsuite/gas/i386/avx512_4fmaps-warn.l index d05924a..cccda43 100644 --- a/gas/testsuite/gas/i386/avx512_4fmaps-warn.l +++ b/gas/testsuite/gas/i386/avx512_4fmaps-warn.l @@ -1,13 +1,13 @@ .*: Assembler messages: -.*:5: Warning: the second source register `%zmm1' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' -.*:6: Warning: the second source register `%zmm2' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' -.*:7: Warning: the second source register `%zmm3' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' -.*:10: Warning: the second source register `%zmm1' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' -.*:11: Warning: the second source register `%zmm2' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' -.*:12: Warning: the second source register `%zmm3' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' -.*:15: Warning: the second source register `%xmm1' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fmaddss' -.*:16: Warning: the second source register `%xmm2' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fmaddss' -.*:17: Warning: the second source register `%xmm3' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fmaddss' -.*:20: Warning: the second source register `%xmm1' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fnmaddss' -.*:21: Warning: the second source register `%xmm2' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fnmaddss' -.*:22: Warning: the second source register `%xmm3' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fnmaddss' +.*:5: Warning: source register `%zmm1' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' +.*:6: Warning: source register `%zmm2' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' +.*:7: Warning: source register `%zmm3' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' +.*:10: Warning: source register `%zmm1' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' +.*:11: Warning: source register `%zmm2' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' +.*:12: Warning: source register `%zmm3' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' +.*:15: Warning: source register `%xmm1' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fmaddss' +.*:16: Warning: source register `%xmm2' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fmaddss' +.*:17: Warning: source register `%xmm3' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fmaddss' +.*:20: Warning: source register `%xmm1' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fnmaddss' +.*:21: Warning: source register `%xmm2' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fnmaddss' +.*:22: Warning: source register `%xmm3' implicitly denotes `%xmm0' to `%xmm3' source group in `v4fnmaddss' diff --git a/gas/testsuite/gas/i386/x86-64-avx512_4fmaps-warn.l b/gas/testsuite/gas/i386/x86-64-avx512_4fmaps-warn.l index a6939a0..92e04f7 100644 --- a/gas/testsuite/gas/i386/x86-64-avx512_4fmaps-warn.l +++ b/gas/testsuite/gas/i386/x86-64-avx512_4fmaps-warn.l @@ -1,7 +1,7 @@ .*: Assembler messages: -.*:5: Warning: the second source register `%zmm1' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' -.*:6: Warning: the second source register `%zmm2' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' -.*:7: Warning: the second source register `%zmm3' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' -.*:10: Warning: the second source register `%zmm1' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' -.*:11: Warning: the second source register `%zmm2' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' -.*:12: Warning: the second source register `%zmm3' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' +.*:5: Warning: source register `%zmm1' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' +.*:6: Warning: source register `%zmm2' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' +.*:7: Warning: source register `%zmm3' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fmaddps' +.*:10: Warning: source register `%zmm1' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' +.*:11: Warning: source register `%zmm2' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' +.*:12: Warning: source register `%zmm3' implicitly denotes `%zmm0' to `%zmm3' source group in `v4fnmaddps' -- 2.7.4