Summary: | Dubious assembler in read_rgba_span_x86.S | ||
---|---|---|---|
Product: | Mesa | Reporter: | Dimitry Andric <dimitry> |
Component: | Mesa core | Assignee: | Ian Romanick <idr> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | CC: | kwm |
Version: | git | ||
Hardware: | x86 (IA32) | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | Change movzxw to movzwl in read_rgba_span_x86.S |
I believe Ian's the original author of that code. Reassigning. 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.
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 src/mesa/x86/read_rgba_span_x86.S: 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]".