Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7f86242
Start reformat for inline-assembly chapter
chorman0773 Jun 19, 2024
72df943
Remove rule prefix from section header ids
chorman0773 Jul 2, 2024
5a75b51
Add [dynamic.asm.template] and [dynamic.asm.operands]
chorman0773 Jul 3, 2024
0397d44
Add dynamic.asm.options
chorman0773 Jul 4, 2024
2fdf1fb
Finish dynamic.asm.evaluation and dynamic.asm.directives
chorman0773 Jul 9, 2024
320b414
Format dynamic.asm.registers
chorman0773 Jul 9, 2024
80bf3cf
Format dynamic.asm.template
chorman0773 Jul 9, 2024
bf615a9
Add examples/tests to the inline-assembly chapter
chorman0773 Jul 9, 2024
6512bc6
Fix doc links in dynamic.asm.operands.types
chorman0773 Jul 9, 2024
2a9f58d
Edit styling of dynamic.asm and fix test failures
chorman0773 Jul 10, 2024
1d9770f
Merge branch 'master' into spec-reformat-asm
chorman0773 Jul 10, 2024
c3af3ca
Change chapter identifier to be `asm` rather than `dynamic.asm`
chorman0773 Jul 11, 2024
a82d8f9
Switch link for `__m128` and `__m256`
chorman0773 Jul 11, 2024
3563e5a
Remove colour from .target-specific
chorman0773 Jul 16, 2024
38d2dae
Fix inline assembly tests to be handled "properly" off of x86_64
chorman0773 Jul 16, 2024
a464e1a
Apply suggestions from PR Review
chorman0773 Jul 17, 2024
f69509b
Apply suggestions from code review
chorman0773 Jul 17, 2024
15db17f
Finish applying suggestions from PR review
chorman0773 Jul 17, 2024
b362778
Change wording for asm.safety note
chorman0773 Jul 18, 2024
3633034
Use `that` instead of `which` in asm.safety note
chorman0773 Jul 18, 2024
7a320d3
Fix global_asm tests to actually run
chorman0773 Jul 18, 2024
012d7f6
Use *asm block* and *global asm block* instead of "Expansion of [`cor…
chorman0773 Jul 18, 2024
f886a47
Fix extraneous `r` in "Template Modifiers" header
chorman0773 Jul 18, 2024
b6f4bbb
Apply suggestions from code review
chorman0773 Jul 18, 2024
88a3964
Fix code block formatting and use "fails to compile" instead of "ill-…
chorman0773 Jul 18, 2024
13884d0
Remove trailing spaces from markdown source lines
chorman0773 Jul 18, 2024
5c0e505
Don't link to a rule that does not yet exist
chorman0773 Jul 18, 2024
e2a7a47
Properly fix end of line spaces
chorman0773 Jul 18, 2024
457e1d6
Change link to inline-assembly.html to point to asm.evaluation
chorman0773 Jul 18, 2024
d59ad1f
Update src/inline-assembly.md
chorman0773 Jul 25, 2024
9b78523
Merge branch 'master' into spec-reformat-asm
chorman0773 Jul 25, 2024
90ef108
Remove added claims from inline-assembly document.
chorman0773 Jul 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix inline assembly tests to be handled "properly" off of x86_64
  • Loading branch information
chorman0773 committed Jul 16, 2024
commit 38d2dae617caf4234d3c844e18bf4797e83514d8
20 changes: 17 additions & 3 deletions src/inline-assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ r[asm.invocation.asm]
The [`core::arch::asm!`] macro shall be expanded in an expression context only. The input tokens shall match the `asm_inner` production. The expansion is [`unsafe`][static.expr.safety] and has type `()`, unless the option `noreturn` is specified, in which case it has type `!`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link to unsafe is broken since there aren't any rules for that, yet. Can you make sure to link directly until those sections are ready? In this case,

[`unsafe`]: unsafety.md


```rust
# #[cfg(target_arch = "x86_64")]
pub fn main(){
# #[cfg(target_arch = "x86_64")]
unsafe{
core::arch::asm!("")
}
Expand All @@ -105,10 +105,14 @@ core::arch::global_asm!(".rodata", "FOO:", ".ascii \"Hello World\"");
```

```rust,compile_fail
# #[cfg(target_arch = "x86_64")]
pub fn main(){
# #[cfg(target_arch = "x86_64")]
# {
core::arch::global_asm!("FOO:", ".ascii \"Hello World\"");
# }
}
# #[cfg(not(target_arch = "x86_64"))]
# core::compile_error!("asm tests are not yet available off of x86_64");
```

r[asm.invocation.format-string]
Expand Down Expand Up @@ -284,6 +288,7 @@ struct Foo{x: i32}
let x: Foo;
core::arch::asm!("mov {output}, {input}", input = in(reg) 5i64, out("eax") x);
# }}
# #[cfg(not(target_arch = "x86_64"))] compile_error!("Inline Assembly Tests are not supported off of x86_64");
```

```rust,compile_fail
Expand All @@ -292,6 +297,7 @@ core::arch::asm!("mov {output}, {input}", input = in(reg) 5i64, out("eax") x);
let x: *mut [i32];
core::arch::asm!("mov {output}, {input}", input = in(reg) 5i64, out("eax") x);
# }}
# #[cfg(not(target_arch = "x86_64"))] compile_error!("Inline Assembly Tests are not supported off of x86_64");
```


Expand Down Expand Up @@ -321,6 +327,7 @@ An `output_expr` shall be the placeholder expression `_` or a (potentially uniti
let x: i32 = 0;
core::arch::asm!("", out("eax") x);
# }}
# #[cfg(not(target_arch = "x86_64"))] compile_error!("Inline Assembly Tests are not supported off of x86_64");
```

r[asm.operands.inout-expr]
Expand Down Expand Up @@ -396,6 +403,7 @@ The program shall not use an operand, other than a sym operand, in the expansion
```rust,compile_fail,ignore
# #[cfg(target_arch = "x86_64")]
core::arch::global_asm!("", in("eax") 5);
# #[cfg(not(target_arch = "x86_64"))] compile_error!("Inline Assembly Tests are not supported off of x86_64");
```

```rust,ignore
Expand Down Expand Up @@ -531,6 +539,7 @@ Certain registers and register classes are *clobbers only*. Such register names
let x: i64;
core::arch::asm!("mov {}, 5", out("k0") x);
# }}
# #[cfg(not(target_arch = "x86_64"))] compile_error!("Inline Assembly Tests are not supported off of x86_64");
```

r[asm.register.small-values]
Expand Down Expand Up @@ -647,6 +656,7 @@ Certain registers are reserved registers. Reserved Registers shall not be named
# #[cfg(target_arch = "x86_64")] { unsafe{
core::arch::asm!("mov rsp, 5", out("rsp") x);
# }}
# #[cfg(not(target_arch = "x86_64"))] compile_error!("Inline Assembly Tests are not supported off of x86_64");
```

## Template modifiers r[asm.template]
Expand Down Expand Up @@ -824,6 +834,7 @@ The program shall not specify both the `nomem` and `readonly` options.
# #[cfg(target_arch = "x86_64")] { unsafe{
core::arch::asm!("mov dword ptr [FOO+rip], 3", options(readonly, nomem));
# }}
# #[cfg(not(target_arch = "x86_64"))] compile_error!("Inline Assembly Tests are not supported off of x86_64");
```

r[asm.options.pure]
Expand Down Expand Up @@ -908,14 +919,17 @@ core::arch::asm!("", options(noreturn));
let x: i32;
core::arch::asm!("xor edi, edi", "call exit@plt", out("edi") x, options(noreturn));
# }}
# #[cfg(not(target_arch = "x86_64"))] compile_error!("Inline Assembly Tests are not supported off of x86_64");
```

r[asm.options.global]
A program shall not specify an option, other than the `att_syntax` option, in an invocation of the [`core::arch::global_asm!`] macro.

```rust,compile_fail
```rust,compile_fail,ignore
# #[cfg(target_arch = "x86_64")]
core::arch::global_asm!("", options(noreturn));

# #[cfg(not(target_arch = "x86_64"))] compile_error!("Inline Assembly Tests are not supported off of x86_64");
```

## Directives Support [asm.directives]
Expand Down