test(asm): lock read-write + place-output rejection (Phase G prep)
Adds examples/1650-platform-asm-rw-place.sx exercising a `+r -> @x`
read-write place output. Currently rejected loudly at lowering
("not yet implemented"); this locks that behavior as a passing test.
The next commit implements read-write outputs and flips this example
to run end-to-end (increment-in-place → 42).
This commit is contained in:
11
examples/1650-platform-asm-rw-place.sx
Normal file
11
examples/1650-platform-asm-rw-place.sx
Normal file
@@ -0,0 +1,11 @@
|
||||
// ASM stream Phase 2 — read-write (`+`) place output. The place is LOADED as a
|
||||
// seed, the asm both reads and writes the operand register (tied input ↔ output),
|
||||
// and the (modified) result is STORED back through the place. Increment-in-place:
|
||||
// the register holds 41 on entry, the asm adds 1, 42 is written back to `x`.
|
||||
// aarch64-pinned; ir-only elsewhere.
|
||||
compute :: () -> i64 {
|
||||
x : i64 = 41;
|
||||
asm volatile { "add %[v], %[v], #1", [v] "+r" -> @x };
|
||||
return x; // 42
|
||||
}
|
||||
main :: () -> i64 { return compute(); }
|
||||
1
examples/expected/1650-platform-asm-rw-place.exit
Normal file
1
examples/expected/1650-platform-asm-rw-place.exit
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
5
examples/expected/1650-platform-asm-rw-place.stderr
Normal file
5
examples/expected/1650-platform-asm-rw-place.stderr
Normal file
@@ -0,0 +1,5 @@
|
||||
error: read-write (`+`) asm outputs are not yet implemented; use a write-only `=` output
|
||||
--> examples/1650-platform-asm-rw-place.sx:8:5
|
||||
|
|
||||
8 | asm volatile { "add %[v], %[v], #1", [v] "+r" -> @x };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1
examples/expected/1650-platform-asm-rw-place.stdout
Normal file
1
examples/expected/1650-platform-asm-rw-place.stdout
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user