Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 074bbab

Browse files
authoredMar 18, 2025··
Merge pull request #1693 from nbdd0121/master
Add reference for asm-goto
2 parents dda31c8 + 9a6e970 commit 074bbab

File tree

1 file changed

+86
-57
lines changed

1 file changed

+86
-57
lines changed
 

‎src/inline-assembly.md‎

Lines changed: 86 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ format_string := STRING_LITERAL / RAW_STRING_LITERAL
5252
dir_spec := "in" / "out" / "lateout" / "inout" / "inlateout"
5353
reg_spec := <register class> / "\"" <explicit register> "\""
5454
operand_expr := expr / "_" / expr "=>" expr / expr "=>" "_"
55-
reg_operand := [ident "="] dir_spec "(" reg_spec ")" operand_expr / sym <path> / const <expr>
55+
reg_operand := [ident "="] dir_spec "(" reg_spec ")" operand_expr / sym <path> / const <expr> / label <block>
5656
clobber_abi := "clobber_abi(" <abi> *("," <abi>) [","] ")"
5757
option := "pure" / "nomem" / "readonly" / "preserves_flags" / "noreturn" / "nostack" / "att_syntax" / "raw"
5858
options := "options(" option *("," option) [","] ")"
@@ -225,8 +225,8 @@ r[asm.operand-type.supported-operands.in]
225225
* `in(<reg>) <expr>`
226226
- `<reg>` can refer to a register class or an explicit register.
227227
The allocated register name is substituted into the asm template string.
228-
- The allocated register will contain the value of `<expr>` at the start of the asm code.
229-
- The allocated register must contain the same value at the end of the asm code (except if a `lateout` is allocated to the same register).
228+
- The allocated register will contain the value of `<expr>` at the start of the assembly code.
229+
- The allocated register must contain the same value at the end of the assembly code (except if a `lateout` is allocated to the same register).
230230

231231
```rust
232232
# #[cfg(target_arch = "x86_64")] {
@@ -239,9 +239,9 @@ r[asm.operand-type.supported-operands.out]
239239
* `out(<reg>) <expr>`
240240
- `<reg>` can refer to a register class or an explicit register.
241241
The allocated register name is substituted into the asm template string.
242-
- The allocated register will contain an undefined value at the start of the asm code.
243-
- `<expr>` must be a (possibly uninitialized) place expression, to which the contents of the allocated register are written at the end of the asm code.
244-
- An underscore (`_`) may be specified instead of an expression, which will cause the contents of the register to be discarded at the end of the asm code (effectively acting as a clobber).
242+
- The allocated register will contain an undefined value at the start of the assembly code.
243+
- `<expr>` must be a (possibly uninitialized) place expression, to which the contents of the allocated register are written at the end of the assembly code.
244+
- An underscore (`_`) may be specified instead of an expression, which will cause the contents of the register to be discarded at the end of the assembly code (effectively acting as a clobber).
245245

246246
```rust
247247
# #[cfg(target_arch = "x86_64")] {
@@ -271,8 +271,8 @@ r[asm.operand-type.supported-operands.inout]
271271
* `inout(<reg>) <expr>`
272272
- `<reg>` can refer to a register class or an explicit register.
273273
The allocated register name is substituted into the asm template string.
274-
- The allocated register will contain the value of `<expr>` at the start of the asm code.
275-
- `<expr>` must be a mutable initialized place expression, to which the contents of the allocated register are written at the end of the asm code.
274+
- The allocated register will contain the value of `<expr>` at the start of the assembly code.
275+
- `<expr>` must be a mutable initialized place expression, to which the contents of the allocated register are written at the end of the assembly code.
276276

277277
```rust
278278
# #[cfg(target_arch = "x86_64")] {
@@ -286,8 +286,8 @@ assert_eq!(x, 5);
286286
r[asm.operand-type.supported-operands.inout-arrow]
287287
* `inout(<reg>) <in expr> => <out expr>`
288288
- Same as `inout` except that the initial value of the register is taken from the value of `<in expr>`.
289-
- `<out expr>` must be a (possibly uninitialized) place expression, to which the contents of the allocated register are written at the end of the asm code.
290-
- An underscore (`_`) may be specified instead of an expression for `<out expr>`, which will cause the contents of the register to be discarded at the end of the asm code (effectively acting as a clobber).
289+
- `<out expr>` must be a (possibly uninitialized) place expression, to which the contents of the allocated register are written at the end of the assembly code.
290+
- An underscore (`_`) may be specified instead of an expression for `<out expr>`, which will cause the contents of the register to be discarded at the end of the assembly code (effectively acting as a clobber).
291291
- `<in expr>` and `<out expr>` may have different types.
292292

293293
```rust
@@ -318,7 +318,7 @@ r[asm.operand-type.supported-operands.sym]
318318
- `<path>` must refer to a `fn` or `static`.
319319
- A mangled symbol name referring to the item is substituted into the asm template string.
320320
- The substituted string does not include any modifiers (e.g. GOT, PLT, relocations, etc).
321-
- `<path>` is allowed to point to a `#[thread_local]` static, in which case the asm code can combine the symbol with relocations (e.g. `@plt`, `@TPOFF`) to read from thread-local data.
321+
- `<path>` is allowed to point to a `#[thread_local]` static, in which case the assembly code can combine the symbol with relocations (e.g. `@plt`, `@TPOFF`) to read from thread-local data.
322322

323323
```rust
324324
# #[cfg(target_arch = "x86_64")] {
@@ -354,6 +354,22 @@ assert_eq!(y, [3, 2, 0, 1]);
354354
# }
355355
```
356356

357+
r[asm.operand-type.supported-operands.label]
358+
* `label <block>`
359+
- The address of the block is substituted into the asm template string. The assembly code may jump to the substituted address.
360+
- After execution of the block, the `asm!` expression returns.
361+
- The type of the block must be unit or `!` (never).
362+
- The block starts a new safety context; unsafe operations within the `label` block must be wrapped in an inner `unsafe` block, even though the entire `asm!` expression is already wrapped in `unsafe`.
363+
364+
```rust
365+
# #[cfg(target_arch = "x86_64")]
366+
unsafe {
367+
core::arch::asm!("jmp {}", label {
368+
println!("Hello from inline assembly label");
369+
});
370+
}
371+
```
372+
357373
r[asm.operand-type.left-to-right]
358374
Operand expressions are evaluated from left to right, just like function call arguments.
359375
After the `asm!` has executed, outputs are written to in left to right order.
@@ -733,7 +749,7 @@ Some registers cannot be used for input or output operands:
733749

734750
| Architecture | Unsupported register | Reason |
735751
| ------------ | -------------------- | ------ |
736-
| All | `sp`, `r15` (s390x) | The stack pointer must be restored to its original value at the end of an asm code block. |
752+
| All | `sp`, `r15` (s390x) | The stack pointer must be restored to its original value at the end of the assembly code or before jumping to a `label` block. |
737753
| All | `bp` (x86), `x29` (AArch64 and Arm64EC), `x8` (RISC-V), `$fp` (LoongArch), `r11` (s390x) | The frame pointer cannot be used as an input or output. |
738754
| ARM | `r7` or `r11` | On ARM the frame pointer can be either `r7` or `r11` depending on the target. The frame pointer cannot be used as an input or output. |
739755
| All | `si` (x86-32), `bx` (x86-64), `r6` (ARM), `x19` (AArch64 and Arm64EC), `x9` (RISC-V), `$s8` (LoongArch) | This is used internally by LLVM as a "base pointer" for functions with complex stack frames. |
@@ -847,7 +863,7 @@ assert_eq!(x, 0x1000u16);
847863

848864
r[asm.template-modifiers.smaller-value]
849865
As stated in the previous section, passing an input value smaller than the register width will result in the upper bits of the register containing undefined values.
850-
This is not a problem if the inline asm only accesses the lower bits of the register, which can be done by using a template modifier to use a subregister name in the asm code (e.g. `ax` instead of `rax`).
866+
This is not a problem if the inline asm only accesses the lower bits of the register, which can be done by using a template modifier to use a subregister name in the assembly code (e.g. `ax` instead of `rax`).
851867
Since this an easy pitfall, the compiler will suggest a template modifier to use where appropriate given the input type.
852868
If all references to an operand already have modifiers then the warning is suppressed for that operand.
853869

@@ -857,7 +873,7 @@ r[asm.abi-clobbers]
857873
## ABI clobbers
858874

859875
r[asm.abi-clobbers.intro]
860-
The `clobber_abi` keyword can be used to apply a default set of clobbers to an `asm!` block.
876+
The `clobber_abi` keyword can be used to apply a default set of clobbers to the assembly code.
861877
This will automatically insert the necessary clobber constraints as needed for calling a function with a particular calling convention: if the calling convention does not fully preserve the value of a register across a call then `lateout("...") _` is implicitly added to the operands list (where the `...` is replaced by the register's name).
862878

863879
```rust
@@ -950,12 +966,12 @@ r[asm.options]
950966
## Options
951967

952968
r[asm.options.supported-options]
953-
Flags are used to further influence the behavior of the inline assembly block.
969+
Flags are used to further influence the behavior of the inline assembly code.
954970
Currently the following options are defined:
955971

956972
r[asm.options.supported-options.pure]
957-
- `pure`: The `asm!` block has no side effects, must eventually return, and its outputs depend only on its direct inputs (i.e. the values themselves, not what they point to) or values read from memory (unless the `nomem` options is also set).
958-
This allows the compiler to execute the `asm!` block fewer times than specified in the program (e.g. by hoisting it out of a loop) or even eliminate it entirely if the outputs are not used.
973+
- `pure`: The assembly code has no side effects, must eventually return, and its outputs depend only on its direct inputs (i.e. the values themselves, not what they point to) or values read from memory (unless the `nomem` options is also set).
974+
This allows the compiler to execute the assembly code fewer times than specified in the program (e.g. by hoisting it out of a loop) or even eliminate it entirely if the outputs are not used.
959975
The `pure` option must be combined with either the `nomem` or `readonly` options, otherwise a compile-time error is emitted.
960976

961977
```rust
@@ -982,16 +998,17 @@ assert_eq!(z, 0);
982998
```
983999

9841000
r[asm.options.supported-options.nomem]
985-
- `nomem`: The `asm!` block does not read from or write to any memory accessible outside of the `asm!` block.
986-
This allows the compiler to cache the values of modified global variables in registers across the `asm!` block since it knows that they are not read or written to by the `asm!`.
987-
The compiler also assumes that this `asm!` block does not perform any kind of synchronization with other threads, e.g. via fences.
1001+
- `nomem`: The assembly code does not read from or write to any memory accessible outside of the assembly code.
1002+
This allows the compiler to cache the values of modified global variables in registers across execution of the assembly code since it knows that they are not read from or written to by it.
1003+
The compiler also assumes that the assembly code does not perform any kind of synchronization with other threads, e.g. via fences.
9881004

9891005
<!-- no_run: This test has unpredictable or undefined behavior at runtime -->
9901006
```rust,no_run
9911007
# #[cfg(target_arch = "x86_64")] {
9921008
let mut x = 0i32;
9931009
let z: i32;
994-
// Accessing memory from a nomem asm block is disallowed
1010+
// Accessing outside memory from assembly when `nomem` is
1011+
// specified is disallowed
9951012
unsafe {
9961013
core::arch::asm!("mov {val:e}, dword ptr [{ptr}]",
9971014
ptr = in(reg) &mut x,
@@ -1000,7 +1017,8 @@ unsafe {
10001017
)
10011018
}
10021019
1003-
// Writing to memory is also undefined behaviour
1020+
// Writing to outside memory from assembly when `nomem` is
1021+
// specified is also undefined behaviour
10041022
unsafe {
10051023
core::arch::asm!("mov dword ptr [{ptr}], {val:e}",
10061024
ptr = in(reg) &mut x,
@@ -1028,15 +1046,15 @@ assert_eq!(z, 1);
10281046
```
10291047

10301048
r[asm.options.supported-options.readonly]
1031-
- `readonly`: The `asm!` block does not write to any memory accessible outside of the `asm!` block.
1032-
This allows the compiler to cache the values of unmodified global variables in registers across the `asm!` block since it knows that they are not written to by the `asm!`.
1033-
The compiler also assumes that this `asm!` block does not perform any kind of synchronization with other threads, e.g. via fences.
1049+
- `readonly`: The assembly code does not write to any memory accessible outside of the assembly code.
1050+
This allows the compiler to cache the values of unmodified global variables in registers across execution of the assembly code since it knows that they are not written to by it.
1051+
The compiler also assumes that this assembly code does not perform any kind of synchronization with other threads, e.g. via fences.
10341052

10351053
<!-- no_run: This test has undefined behaviour at runtime -->
10361054
```rust,no_run
10371055
# #[cfg(target_arch = "x86_64")] {
10381056
let mut x = 0;
1039-
// We cannot modify memory in readonly
1057+
// We cannot modify outside memory when `readonly` is specified
10401058
unsafe {
10411059
core::arch::asm!("mov dword ptr[{}], 1", in(reg) &mut x, options(readonly))
10421060
}
@@ -1074,13 +1092,11 @@ assert_eq!(z, 1);
10741092
```
10751093

10761094
r[asm.options.supported-options.preserves_flags]
1077-
- `preserves_flags`: The `asm!` block does not modify the flags register (defined in the rules below).
1078-
This allows the compiler to avoid recomputing the condition flags after the `asm!` block.
1095+
- `preserves_flags`: The assembly code does not modify the flags register (defined in the rules below).
1096+
This allows the compiler to avoid recomputing the condition flags after execution of the assembly code.
10791097

10801098
r[asm.options.supported-options.noreturn]
1081-
- `noreturn`: The `asm!` block never returns, and its return type is defined as `!` (never).
1082-
Behavior is undefined if execution falls through past the end of the asm code.
1083-
A `noreturn` asm block behaves just like a function which doesn't return; notably, local variables in scope are not dropped before it is invoked.
1099+
- `noreturn`: The assembly code does not fall through; behavior is undefined if it does. It may still jump to `label` blocks. If any `label` blocks return unit, the `asm!` block will return unit. Otherwise it will return `!` (never). As with a call to a function that does not return, local variables in scope are not dropped before execution of the assembly code.
10841100

10851101
<!-- no_run: This test aborts at runtime -->
10861102
```rust,no_run
@@ -1101,8 +1117,18 @@ unsafe { core::arch::asm!("", options(noreturn)); }
11011117
# }
11021118
```
11031119

1120+
```rust
1121+
# #[cfg(target_arch = "x86_64")]
1122+
let _: () = unsafe {
1123+
// You may still jump to a `label` block
1124+
core::arch::asm!("jmp {}", label {
1125+
println!();
1126+
}, options(noreturn));
1127+
};
1128+
```
1129+
11041130
r[asm.options.supported-options.nostack]
1105-
- `nostack`: The `asm!` block does not push data to the stack, or write to the stack red-zone (if supported by the target).
1131+
- `nostack`: The assembly code does not push data to the stack, or write to the stack red-zone (if supported by the target).
11061132
If this option is *not* used then the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call.
11071133

11081134
<!-- no_run: Test has undefined behavior at runtime -->
@@ -1165,7 +1191,10 @@ unsafe { core::arch::asm!("", options(pure)); }
11651191
```
11661192

11671193
r[asm.options.checks.noreturn]
1168-
- It is a compile-time error to specify `noreturn` on an asm block with outputs.
1194+
- It is a compile-time error to specify `noreturn` on an asm block with outputs and without labels.
1195+
1196+
r[asm.options.checks.label-with-outputs]
1197+
- It is a compile-time error to have any `label` blocks in an asm block with outputs.
11691198

11701199
```rust,compile_fail
11711200
# #[cfg(target_arch = "x86_64")] {
@@ -1196,52 +1225,52 @@ r[asm.rules.intro]
11961225
To avoid undefined behavior, these rules must be followed when using function-scope inline assembly (`asm!`):
11971226

11981227
r[asm.rules.reg-not-input]
1199-
- Any registers not specified as inputs will contain an undefined value on entry to the asm block.
1228+
- Any registers not specified as inputs will contain an undefined value on entry to the assembly code.
12001229
- An "undefined value" in the context of inline assembly means that the register can (non-deterministically) have any one of the possible values allowed by the architecture.
12011230
Notably it is not the same as an LLVM `undef` which can have a different value every time you read it (since such a concept does not exist in assembly code).
12021231

12031232
r[asm.rules.reg-not-output]
1204-
- Any registers not specified as outputs must have the same value upon exiting the asm block as they had on entry, otherwise behavior is undefined.
1233+
- Any registers not specified as outputs must have the same value upon exiting the assembly code as they had on entry, otherwise behavior is undefined.
12051234
- This only applies to registers which can be specified as an input or output.
12061235
Other registers follow target-specific rules.
12071236
- Note that a `lateout` may be allocated to the same register as an `in`, in which case this rule does not apply.
12081237
Code should not rely on this however since it depends on the results of register allocation.
12091238

12101239
r[asm.rules.unwind]
1211-
- Behavior is undefined if execution unwinds out of an asm block.
1240+
- Behavior is undefined if execution unwinds out of the assembly code.
12121241
- This also applies if the assembly code calls a function which then unwinds.
12131242

12141243
r[asm.rules.mem-same-as-ffi]
12151244
- The set of memory locations that assembly code is allowed to read and write are the same as those allowed for an FFI function.
12161245
- Refer to the unsafe code guidelines for the exact rules.
12171246
- If the `readonly` option is set, then only memory reads are allowed.
12181247
- If the `nomem` option is set then no reads or writes to memory are allowed.
1219-
- These rules do not apply to memory which is private to the asm code, such as stack space allocated within the asm block.
1248+
- These rules do not apply to memory which is private to the assembly code, such as stack space allocated within it.
12201249

12211250
r[asm.rules.black-box]
1222-
- The compiler cannot assume that the instructions in the asm are the ones that will actually end up executed.
1223-
- This effectively means that the compiler must treat the `asm!` as a black box and only take the interface specification into account, not the instructions themselves.
1251+
- The compiler cannot assume that the instructions in the assembly code are the ones that will actually end up executed.
1252+
- This effectively means that the compiler must treat the assembly code as a black box and only take the interface specification into account, not the instructions themselves.
12241253
- Runtime code patching is allowed, via target-specific mechanisms.
1225-
- However there is no guarantee that each `asm!` directly corresponds to a single instance of instructions in the object file: the compiler is free to duplicate or deduplicate `asm!` blocks.
1254+
- However there is no guarantee that each block of assembly code in the source directly corresponds to a single instance of instructions in the object file; the compiler is free to duplicate or deduplicate the assembly code in `asm!` blocks.
12261255

12271256
r[asm.rules.stack-below-sp]
1228-
- Unless the `nostack` option is set, asm code is allowed to use stack space below the stack pointer.
1229-
- On entry to the asm block the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call.
1257+
- Unless the `nostack` option is set, assembly code is allowed to use stack space below the stack pointer.
1258+
- On entry to the assembly code the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call.
12301259
- You are responsible for making sure you don't overflow the stack (e.g. use stack probing to ensure you hit a guard page).
12311260
- You should adjust the stack pointer when allocating stack memory as required by the target ABI.
1232-
- The stack pointer must be restored to its original value before leaving the asm block.
1261+
- The stack pointer must be restored to its original value before leaving the assembly code.
12331262

12341263
r[asm.rules.noreturn]
1235-
- If the `noreturn` option is set then behavior is undefined if execution falls through to the end of the asm block.
1264+
- If the `noreturn` option is set then behavior is undefined if execution falls through the end of the assembly code.
12361265

12371266
r[asm.rules.pure]
12381267
- If the `pure` option is set then behavior is undefined if the `asm!` has side-effects other than its direct outputs.
12391268
Behavior is also undefined if two executions of the `asm!` code with the same inputs result in different outputs.
12401269
- When used with the `nomem` option, "inputs" are just the direct inputs of the `asm!`.
1241-
- When used with the `readonly` option, "inputs" comprise the direct inputs of the `asm!` and any memory that the `asm!` block is allowed to read.
1270+
- When used with the `readonly` option, "inputs" comprise the direct inputs of the assembly code and any memory that it is allowed to read.
12421271

12431272
r[asm.rules.preserved-registers]
1244-
- These flags registers must be restored upon exiting the asm block if the `preserves_flags` option is set:
1273+
- These flags registers must be restored upon exiting the assembly code if the `preserves_flags` option is set:
12451274
- x86
12461275
- Status flags in `EFLAGS` (CF, PF, AF, ZF, SF, OF).
12471276
- Floating-point status word (all).
@@ -1265,12 +1294,12 @@ r[asm.rules.preserved-registers]
12651294
- The condition code register `cc`.
12661295

12671296
r[asm.rules.x86-df]
1268-
- On x86, the direction flag (DF in `EFLAGS`) is clear on entry to an asm block and must be clear on exit.
1269-
- Behavior is undefined if the direction flag is set on exiting an asm block.
1297+
- On x86, the direction flag (DF in `EFLAGS`) is clear on entry to the assembly code and must be clear on exit.
1298+
- Behavior is undefined if the direction flag is set on exiting the assembly code.
12701299

12711300
r[asm.rules.x86-x87]
12721301
- On x86, the x87 floating-point register stack must remain unchanged unless all of the `st([0-7])` registers have been marked as clobbered with `out("st(0)") _, out("st(1)") _, ...`.
1273-
- If all x87 registers are clobbered then the x87 register stack is guaranteed to be empty upon entering an `asm` block. Assembly code must ensure that the x87 register stack is also empty when exiting the asm block.
1302+
- If all x87 registers are clobbered then the x87 register stack is guaranteed to be empty upon entering the assembly code. Assembly code must ensure that the x87 register stack is also empty when exiting the asssembly code.
12741303

12751304
```rust
12761305
# #[cfg(target_arch = "x86_64")]
@@ -1309,11 +1338,11 @@ r[asm.rules.arm64ec]
13091338
- On arm64ec, [call checkers with appropriate thunks](https://learn.microsoft.com/en-us/windows/arm/arm64ec-abi#authoring-arm64ec-in-assembly) are mandatory when calling functions.
13101339

13111340
r[asm.rules.only-on-exit]
1312-
- The requirement of restoring the stack pointer and non-output registers to their original value only applies when exiting an `asm!` block.
1313-
- This means that `asm!` blocks that never return (even if not marked `noreturn`) don't need to preserve these registers.
1314-
- When returning to a different `asm!` block than you entered (e.g. for context switching), these registers must contain the value they had upon entering the `asm!` block that you are *exiting*.
1315-
- You cannot exit an `asm!` block that has not been entered.
1316-
Neither can you exit an `asm!` block that has already been exited (without first entering it again).
1341+
- The requirement of restoring the stack pointer and non-output registers to their original value only applies when exiting the assembly code.
1342+
- This means that assembly code that does not fall through and does not jump to any `label` blocks, even if not marked `noreturn`, doesn't need to preserve these registers.
1343+
- When returning to the assembly code of a different `asm!` block than you entered (e.g. for context switching), these registers must contain the value they had upon entering the `asm!` block that you are *exiting*.
1344+
- You cannot exit the assembly code of an `asm!` block that has not been entered.
1345+
Neither can you exit the assembly code of an `asm!` block whose assembly code has already been exited (without first entering it again).
13171346
- You are responsible for switching any target-specific state (e.g. thread-local storage, stack bounds).
13181347
- You cannot jump from an address in one `asm!` block to an address in another, even within the same function or block, without treating their contexts as potentially different and requiring context switching. You cannot assume that any particular value in those contexts (e.g. current stack pointer or temporary values below the stack pointer) will remain unchanged between the two `asm!` blocks.
13191348
- The set of memory locations that you may access is the intersection of those allowed by the `asm!` blocks you entered and exited.
@@ -1341,7 +1370,7 @@ In addition to all of the previous rules, the string argument to `asm!` must ult
13411370
after all other arguments are evaluated, formatting is performed, and operands are translated---
13421371
assembly that is both syntactically correct and semantically valid for the target architecture.
13431372
The formatting rules allow the compiler to generate assembly with correct syntax.
1344-
Rules concerning operands permit valid translation of Rust operands into and out of `asm!`.
1373+
Rules concerning operands permit valid translation of Rust operands into and out of the assembly code.
13451374
Adherence to these rules is necessary, but not sufficient, for the final expanded assembly to be
13461375
both correct and valid. For instance:
13471376

@@ -1367,7 +1396,7 @@ Inline assembly supports a subset of the directives supported by both GNU AS and
13671396
The result of using other directives is assembler-specific (and may cause an error, or may be accepted as-is).
13681397

13691398
r[asm.directives.stateful]
1370-
If inline assembly includes any "stateful" directive that modifies how subsequent assembly is processed, the block must undo the effects of any such directives before the inline assembly ends.
1399+
If inline assembly includes any "stateful" directive that modifies how subsequent assembly is processed, the assembly code must undo the effects of any such directives before the inline assembly ends.
13711400

13721401
r[asm.directives.supported-directives]
13731402
The following directives are guaranteed to be supported by the assembler:
@@ -1494,7 +1523,7 @@ On x86 targets, both 32-bit and 64-bit, the following additional directives are
14941523
- `.code32`
14951524
- `.code64`
14961525

1497-
Use of `.code16`, `.code32`, and `.code64` directives are only supported if the state is reset to the default before exiting the assembly block.
1526+
Use of `.code16`, `.code32`, and `.code64` directives are only supported if the state is reset to the default before exiting the assembly code.
14981527
32-bit x86 uses `.code32` by default, and x86_64 uses `.code64` by default.
14991528

15001529
r[asm.target-specific-directives.arm-32-bit]

0 commit comments

Comments
 (0)
Please sign in to comment.