test(asm): lock indirect-memory =*m rejection (Phase G prep)
Adds examples/1652-platform-asm-indirect-mem.sx exercising a `=*m -> @x`
indirect-memory place output. Currently rejected loudly at lowering
("not yet implemented"); this locks that behavior as a passing test.
The next commit implements indirect-memory outputs and flips this
example to run end-to-end (store-through-pointer → 42).
This commit is contained in:
19
examples/1652-platform-asm-indirect-mem.sx
Normal file
19
examples/1652-platform-asm-indirect-mem.sx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// ASM stream — indirect-memory (`=*m`) place output. The place address is passed
|
||||||
|
// to the asm as a pointer and the asm writes THROUGH it (no return slot): here
|
||||||
|
// `str x9, %[out]` stores 42 into `x`'s storage directly. Distinct from a
|
||||||
|
// write-through `=` output (which returns a value that is then stored). Mixes a
|
||||||
|
// value output and an input below to exercise operand ordering. aarch64-pinned;
|
||||||
|
// ir-only elsewhere (the `.ir` locks the `=*m` constraint + `elementtype` attr).
|
||||||
|
poke :: () -> i64 {
|
||||||
|
x : i64 = 0;
|
||||||
|
asm volatile {
|
||||||
|
#string ASM
|
||||||
|
mov x9, #42
|
||||||
|
str x9, %[out]
|
||||||
|
ASM,
|
||||||
|
[out] "=*m" -> @x,
|
||||||
|
clobbers(.x9),
|
||||||
|
};
|
||||||
|
return x; // 42 — written through the pointer
|
||||||
|
}
|
||||||
|
main :: () -> i64 { return poke(); }
|
||||||
1
examples/expected/1652-platform-asm-indirect-mem.exit
Normal file
1
examples/expected/1652-platform-asm-indirect-mem.exit
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1
|
||||||
19
examples/expected/1652-platform-asm-indirect-mem.stderr
Normal file
19
examples/expected/1652-platform-asm-indirect-mem.stderr
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
error: indirect-memory (`*`) asm outputs are not yet implemented
|
||||||
|
--> examples/1652-platform-asm-indirect-mem.sx:9:5
|
||||||
|
|
|
||||||
|
9 | asm volatile {
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
10 | #string ASM
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
11 | mov x9, #42
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
12 | str x9, %[out]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
13 | ASM,
|
||||||
|
| ^^^^
|
||||||
|
14 | [out] "=*m" -> @x,
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
15 | clobbers(.x9),
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
16 | };
|
||||||
|
| ^^^^^
|
||||||
1
examples/expected/1652-platform-asm-indirect-mem.stdout
Normal file
1
examples/expected/1652-platform-asm-indirect-mem.stdout
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
Reference in New Issue
Block a user