mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-04 02:44:44 +00:00
* 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>
This commit is contained in:
@@ -86,7 +86,7 @@ compiler gcc:
|
||||
linkLibCmd: " -l$1",
|
||||
debug: "",
|
||||
pic: "-fPIC",
|
||||
asmStmtFrmt: "asm($1);$n",
|
||||
asmStmtFrmt: "__asm__($1);$n",
|
||||
structStmtFmt: "$1 $3 $2 ", # struct|union [packed] $name
|
||||
produceAsm: gnuAsmListing,
|
||||
cppXsupport: "-std=gnu++14 -funsigned-char",
|
||||
|
||||
15
tests/compiler/tasm.nim
Normal file
15
tests/compiler/tasm.nim
Normal file
@@ -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()
|
||||
Reference in New Issue
Block a user