Bug 33386 - Dubious assembler in read_rgba_span_x86.S
Summary: Dubious assembler in read_rgba_span_x86.S
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86 (IA32) All
: medium normal
Assignee: Ian Romanick
QA Contact:
Depends on:
Reported: 2011-01-23 11:30 UTC by Dimitry Andric
Modified: 2011-01-24 13:38 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Change movzxw to movzwl in read_rgba_span_x86.S (332 bytes, application/octet-stream)
2011-01-23 11:30 UTC, Dimitry Andric

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric 2011-01-23 11:30:12 UTC
Created attachment 42345 [details]
Change movzxw to movzwl in read_rgba_span_x86.S

While building Mesa with the trunk version of clang, using its
integrated assembler, it complains about the 'movzxw' mnemonic in

clang -c -I../../include -I../../src/mesa -I../../src/mesa/main -I/usr/local/include -O2 -pipe -fno-strict-aliasing -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing  -fPIC  -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING x86/read_rgba_span_x86.S -o x86/read_rgba_span_x86.o
/tmp/cc-iXYqNz.s:528:2: error: invalid instruction mnemonic 'movzxw'
 movzxw (%eax), %ecx

This mnemonic is accepted by GNU as, but disassembling the relevant part
of a .o file produced by it, gives:

 436:   66 0f b7 08             movzww (%eax),%cx

This is a really weird opcode, apparently moving a word to a word,
without zero extending anything.  An Intel disassembler gives:

  00000466: 66 0F B7 08        movzx       cx,word ptr [eax]

Since the source code in question says:

        /* At this point there can be at most 1 pixel left to process.
         * Process it if needed.

and it is about 16-bit RBG565 pixels, it seems most likely a move from a
word to a dword with zero extension was intended, e.g.:

        /* At this point there can be at most 1 pixel left to process.
         * Process it if needed.

        testl   $0x01, %ecx
        je      .L01

        movzwl  (%eax), %ecx	/* opcodes: 0f b7 08 */
        movd    %ecx, %mm4

        pshufw  $0x00, %mm4, %mm0

which in Intel syntax would be: "movzx ecx,word ptr [eax]".
Comment 1 Brian Paul 2011-01-24 08:12:14 UTC
I believe Ian's the original author of that code.  Reassigning.
Comment 2 Brian Paul 2011-01-24 13:38:32 UTC
I'm committing this one too since it sounds like the same story as 33388.

Commit 811ee32a9ef177bec46c82692eeac8bc7297753c

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.