D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9965 - Wrong Assembly For DIL, SIL Registers
Summary: Wrong Assembly For DIL, SIL Registers
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: iasm, wrong-code
: 9972 (view as issue list)
Depends on:
Blocks:
 
Reported: 2013-04-19 12:47 UTC by David Simcha
Modified: 2015-06-09 05:11 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2013-04-19 12:47:53 UTC
D Source:

import core.stdc.stdio;

void main() {
  ulong stuff;
  asm {
    xor RDI, RDI;
    mov DIL, 1;
    mov stuff, RDI;
  }

  printf("%lld\n", stuff);
}

Output:  0

obj2asm disassembly of main():

		push	RBP
		mov	RBP,RSP
		sub	RSP,010h
		mov	qword ptr -8[RBP],0
		xor	RDI,RDI
		mov	BH,1
		mov	-8[RBP],RDI
		mov	RSI,-8[RBP]
		mov	RDI,offset FLAT:.rodata@64
		xor	EAX,EAX
		call	  printf@PC32
		xor	EAX,EAX
		mov	RSP,RBP
		pop	RBP
		ret

The opcode for BH is being generated when the assembly language code says DIL.

Similarly, DH is generated when SIL is in the source code.
Comment 2 Martin Nowak 2013-04-21 04:02:07 UTC
*** Issue 9972 has been marked as a duplicate of this issue. ***
Comment 3 github-bugzilla 2013-04-21 04:13:51 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c275b372c3ec3cc58a54a4a7da66736b53932eca
fix Issue 9965 - Wrong Assembly For DIL, SIL Registers

https://github.com/D-Programming-Language/dmd/commit/bddba0574f25ff06917f6ca3b380c2c515e3963b
Merge pull request #1916 from WalterBright/fix9965

fix Issue 9965 - Wrong Assembly For DIL, SIL Registers
Comment 4 github-bugzilla 2013-04-21 12:27:30 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/0f741f4665959ec5dc1826d1aa3169e173edb559
Merge pull request #1916 from WalterBright/fix9965

fix Issue 9965 - Wrong Assembly For DIL, SIL Registers