https://sourceware.org/bugzilla/show_bug.cgi?id=25438

--- Comment #2 from Jan Beulich <jbeulich at suse dot com> ---
(In reply to H.J. Lu from comment #1)
> movz* with incorrect operands should be rejected, not silently changed
> to something else:
> 
> [hjl@gnu-snb-1 tmp]$ cat x.s
> movzbw        %al, %ecx
> movzbw        %al, %rcx
> movzbl        %al, %cx
> movzbl        %al, %rcx
> movzbq        %al, %cx
> movzbq        %al, %ecx
> [hjl@gnu-snb-1 tmp]$ gcc -c x.s
> [hjl@gnu-snb-1 tmp]$ objdump -dw x.o
> 
> x.o:     file format elf64-x86-64
> 
> 
> Disassembly of section .text:
> 
> 0000000000000000 <.text>:
>    0: 0f b6 c8                movzbl %al,%ecx
>    3: 48 0f b6 c8             movzbq %al,%rcx
>    7: 66 0f b6 c8             movzbw %al,%cx
>    b: 48 0f b6 c8             movzbq %al,%rcx
>    f: 66 0f b6 c8             movzbw %al,%cx
>   13: 0f b6 c8                movzbl %al,%ecx
> [hjl@gnu-snb-1 tmp]$

Indeed that's what the patch is doing, for 64-bit code.

For 32-bit (and 16-bit) code though this isn't the way to go, as long as e.g.

        movl    %al, %al
        movl    %ax, %ax

produce an error on the first line, but only two warnings on the second one.
Behavior for MOVZ* simply gets brought in line with this by the proposed patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to