-
-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3483 from Orvid/labeloperands
Issue 1829 - Allow labels as inline asm operands
- Loading branch information
Showing
3 changed files
with
104 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
|
|
||
| version (D_InlineAsm_X86) | ||
| version = TestInlineAsm; | ||
| else version (D_InlineAsm_X86_64) | ||
| version = TestInlineAsm; | ||
| else | ||
| pragma(msg, "Inline asm not supported, not testing."); | ||
|
|
||
| version (TestInlineAsm) | ||
| { | ||
| void testInlineAsm() | ||
| { | ||
| asm | ||
| { | ||
| L1: | ||
| nop; | ||
| nop; | ||
| nop; | ||
| nop; | ||
|
|
||
| mov EAX, dword ptr L1; // Check back references | ||
| mov EAX, dword ptr L2; // Check forward references | ||
| mov EAX, dword ptr DS:L1; // Not really useful in standard use, but who knows. | ||
| mov EAX, dword ptr FS:L2; // Once again, not really useful, but it is valid. | ||
| mov EAX, dword ptr CS:L1; // This is what the first test case should implicitly be. | ||
|
|
||
| L2: | ||
| nop; | ||
| nop; | ||
| nop; | ||
| nop; | ||
|
|
||
| } | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/fail12635.d(19): Error: Cannot generate a segment prefix for a branching instruction | ||
| --- | ||
| */ | ||
|
|
||
| void foo() | ||
| { | ||
| enum NOP = 0x9090_9090_9090_9090; | ||
|
|
||
| asm | ||
| { | ||
| L1: | ||
| dq NOP,NOP,NOP,NOP; // 32 | ||
| dq NOP,NOP,NOP,NOP; // 64 | ||
| dq NOP,NOP,NOP,NOP; // 96 | ||
| dq NOP,NOP,NOP,NOP; // 128 | ||
| jmp DS:L1; | ||
| } | ||
| } |