Search

Inline assembler assembles ARPL instruction incorrectly by Myria

Closed
as Fixed Help for as Fixed

2
0
Sign in
to vote
Type: Bug
ID: 691217
Opened: 9/27/2011 6:00:10 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
Visual Studio's inline assembler reverses the order of the operands to the "arpl" x86 instruction when it generates the machine code. MASM, however, gets it correct.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling version

Visual Studio 2010 SP1

Steps to reproduce

For C:
__declspec(naked) void __fastcall ARPL_Test(unsigned __int16 x, unsigned __int16 y)
{
__asm
{
    arpl cx, dx
    movzx eax, cx
    ret
}
}


For MASM:
.586
.model flat

.code

PUBLIC @ARPL_Test@8
@ARPL_Test@8 PROC
    arpl cx, dx
    movzx eax, cx
    ret
@ARPL_Test@8 ENDP


_TEXT ENDS

END

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

Output from dumping the C .obj file:

C:\Projects\temp\vs10bug>dumpbin /disasm:bytes arpl-c.obj
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.


Dump of file arpl-c.obj

File Type: COFF OBJECT

@ARPL_Test@8:
00000000: 63 CA             arpl        dx,cx
00000002: 0F B7 C1         movzx     eax,cx
00000005: C3                 ret

Summary

         74 .debug$S
         2F .drectve
         6 .text

Expected results

Output from dumping the MASM .obj file:

C:\Projects\temp\vs10bug>dumpbin /disasm:bytes arpl-asm.obj
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.


Dump of file arpl-asm.obj

File Type: COFF OBJECT

@ARPL_Test@8:
00000000: 63 D1             arpl        cx,dx
00000002: 0F B7 C1         movzx     eax,cx
00000005: C3                 ret

Summary

         0 .data
         1B8 .debug$S
         1C .debug$T
         6 .text
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 12/5/2011 at 5:06 PM
Good catch!

We have fixed the x86 inline assembler to agree with MASM (and with the Instruction Set Spec). This fix will ship in the next release of the compiler.

Thanks,

Jim
Posted by MS-Moderator09 [Feedback Moderator] on 9/27/2011 at 7:53 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 9/27/2011 at 6:44 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.