summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLam Wei Lun <weilun.lam@gmail.com>2026-02-01 20:23:54 +0800
committerLam Wei Lun <weilun.lam@gmail.com>2026-02-01 20:23:54 +0800
commitc4b73a1e99bda3cdfabe7ff3b64066b310ee7292 (patch)
treea9ac8db385f82865e1bed5798ceaf63920587b2d /tests
parentfcc9210aa32d671e16b392cf48546c4e2001ff8f (diff)
parenteafd8c67012ea253436b79f703dc0702046703f8 (diff)
Merge with main
Diffstat (limited to 'tests')
-rw-r--r--tests/features/test_asm_clobber.zc20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/features/test_asm_clobber.zc b/tests/features/test_asm_clobber.zc
new file mode 100644
index 0000000..2ba74da
--- /dev/null
+++ b/tests/features/test_asm_clobber.zc
@@ -0,0 +1,20 @@
+fn add(a: int, b: int) -> int {
+ let result: int;
+ asm {
+ "mov {a}, {result}"
+ "add {b}, {result}"
+ : out(result)
+ : in(a), in(b)
+ : clobber("cc")
+ }
+ return result;
+}
+
+test "asm_clobber" {
+ let res = add(10, 20);
+ if (res != 30) {
+ println "Failed: Expected 30, got {res}";
+ exit(1);
+ }
+ println "Success: asm with clobber works properly";
+}