From 953bfef72ddcf6f835c7b462db65843ff91ac3d7 Mon Sep 17 00:00:00 2001 From: demotomohiro Date: Tue, 24 Dec 2024 19:43:47 +0900 Subject: [PATCH] Add inline assembler tests for i386, arm, arm64, riscv32 and riscv64 --- tests/compiler/tasm.nim | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/compiler/tasm.nim b/tests/compiler/tasm.nim index 31db5643c9222..63c8344f035aa 100644 --- a/tests/compiler/tasm.nim +++ b/tests/compiler/tasm.nim @@ -1,16 +1,25 @@ -discard """ -disabled: "arm64" -""" - proc testAsm() = let src = 41 var dst = 0 - asm """ - mov %1, %0\n\t - add $1, %0 - : "=r" (`dst`) - : "r" (`src`)""" + when defined(i386) or defined(amd64): + asm """ + mov %1, %0\n\t + add $1, %0 + : "=r" (`dst`) + : "r" (`src`)""" + elif defined(arm) or defined(arm64): + asm """ + mov %0, %1\n\t + add %0, %0, #1 + : "=r" (`dst`) + : "r" (`src`)""" + elif defined(riscv32) or defined(riscv64): + asm """ + addi %0, %1, 0\n\t + addi %0, %0, 1 + : "=r" (`dst`) + : "r" (`src)""" doAssert dst == 42