x86/Intel: improve diagnostics

Message ID aad86726-5351-0a42-3c67-d1b07581c7aa@suse.com
State New
Headers show
Series
  • x86/Intel: improve diagnostics
Related show

Commit Message

Jan Beulich Feb. 11, 2020, 11:01 a.m.
The diagnostics issued by check_*_reg() are pretty AT&T-centric. Re-use
logic already used for SIMD memory operand size checking also for ones
where GPRs would alternatively also be allowed. (There's certainly room
for further improvement here.)

gas/
2020-02-XX  Jan Beulich  <jbeulich@suse.com>

	* config/tc-i386.c (operand_type_register_match): Also fall
	through initial two if()-s when the template allows for a GPR
	operand. Adjust comment.

Comments

H.J. Lu Feb. 11, 2020, 11:53 a.m. | #1
On Tue, Feb 11, 2020 at 3:01 AM Jan Beulich <jbeulich@suse.com> wrote:
>

> The diagnostics issued by check_*_reg() are pretty AT&T-centric. Re-use

> logic already used for SIMD memory operand size checking also for ones

> where GPRs would alternatively also be allowed. (There's certainly room

> for further improvement here.)

>

> gas/

> 2020-02-XX  Jan Beulich  <jbeulich@suse.com>

>

>         * config/tc-i386.c (operand_type_register_match): Also fall

>         through initial two if()-s when the template allows for a GPR

>         operand. Adjust comment.

>


OK.

Thanks.

-- 
H.J.

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -2246,8 +2246,7 @@  mismatch:
 
 /* If given types g0 and g1 are registers they must be of the same type
    unless the expected operand type register overlap is null.
-   Memory operand size of certain SIMD instructions is also being checked
-   here.  */
+   Some Intel syntax memory operand size checking also happens here.  */
 
 static INLINE int
 operand_type_register_match (i386_operand_type g0,
@@ -2259,14 +2258,16 @@  operand_type_register_match (i386_operan
       && g0.bitfield.class != RegSIMD
       && (!operand_type_check (g0, anymem)
 	  || g0.bitfield.unspecified
-	  || t0.bitfield.class != RegSIMD))
+	  || (t0.bitfield.class != Reg
+	      && t0.bitfield.class != RegSIMD)))
     return 1;
 
   if (g1.bitfield.class != Reg
       && g1.bitfield.class != RegSIMD
       && (!operand_type_check (g1, anymem)
 	  || g1.bitfield.unspecified
-	  || t1.bitfield.class != RegSIMD))
+	  || (t1.bitfield.class != Reg
+	      && t1.bitfield.class != RegSIMD)))
     return 1;
 
   if (g0.bitfield.byte == g1.bitfield.byte