summary refs log tree commit diff stats
path: root/tests/compiler
diff options
context:
space:
mode:
authorDaniel Clarke <dan137clarke@gmail.com>2022-07-13 22:55:33 +1000
committerGitHub <noreply@github.com>2022-07-13 20:55:33 +0800
commit489f6ddfefc4993af97eb2884b6d8173a4ee8b9d (patch)
treeb06d5e17a633d54f4eed813eb3ccaa732800f77f /tests/compiler
parentaf140966ea5b58ea248459acb74bf84537deb423 (diff)
downloadNim-489f6ddfefc4993af97eb2884b6d8173a4ee8b9d.tar.gz
fix #20012 (#20013)
* replace gcc asm with __asm__ and add a test

* update test case to specify gcc or clang and not cpp

Co-authored-by: daniel <danielclarke@wearepopgun.com>
Diffstat (limited to 'tests/compiler')
-rw-r--r--tests/compiler/tasm.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/compiler/tasm.nim b/tests/compiler/tasm.nim
new file mode 100644
index 000000000..9f60231e0
--- /dev/null
+++ b/tests/compiler/tasm.nim
@@ -0,0 +1,15 @@
+proc testAsm() =
+  let src = 41
+  var dst = 0
+
+  asm """
+    mov %1, %0\n\t
+    add $1, %0
+    : "=r" (`dst`)
+    : "r" (`src`)"""
+
+  doAssert dst == 42
+
+when defined(gcc) or defined(clang) and not defined(cpp):
+  {.passc: "-std=c99".}
+  testAsm()
\ No newline at end of file