aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2020-01-24 01:49:23 +0000
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2020-09-11 20:45:09 +0000
commita908404e6d2380ae6b10c290d1870ac6ede2965a (patch)
treecf88f071899ab2e494ccc5ef47a17798ec189b6e /test cases
parent1d5fef89f004cb4b95c7d8603090c91b6135bddb (diff)
downloadmeson-a908404e6d2380ae6b10c290d1870ac6ede2965a.zip
meson-a908404e6d2380ae6b10c290d1870ac6ede2965a.tar.gz
meson-a908404e6d2380ae6b10c290d1870ac6ede2965a.tar.bz2
Fix test 'common/122 llvm ir and assembly' for Windows ARM
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/122 llvm ir and assembly/meson.build32
-rw-r--r--test cases/common/122 llvm ir and assembly/square-aarch64.S20
-rw-r--r--test cases/common/122 llvm ir and assembly/square-arm.S17
3 files changed, 59 insertions, 10 deletions
diff --git a/test cases/common/122 llvm ir and assembly/meson.build b/test cases/common/122 llvm ir and assembly/meson.build
index 3cc7d5e..fd07d87 100644
--- a/test cases/common/122 llvm ir and assembly/meson.build
+++ b/test cases/common/122 llvm ir and assembly/meson.build
@@ -1,7 +1,7 @@
project('llvm-ir', 'c', 'cpp')
cpu = host_machine.cpu_family()
-supported_cpus = ['arm', 'x86', 'x86_64']
+supported_cpus = ['arm', 'aarch64', 'x86', 'x86_64']
foreach lang : ['c', 'cpp']
cc = meson.get_compiler(lang)
@@ -26,19 +26,24 @@ foreach lang : ['c', 'cpp']
square_base = 'square-' + cpu
square_impl = square_base + '.S'
# MSVC cannot directly compile assembly files, so we pass it through the
- # cl.exe pre-processor first and then assemble it with the ml.exe assembler.
- # Then we can link it into the executable.
+ # cl.exe pre-processor first and then assemble it with ml.exe or armasm.exe
+ # assembler. Then we can link it into the executable.
if cc.get_argument_syntax() == 'msvc'
cl = cc.cmd_array()
if cpu == 'x86'
- ml = find_program('ml', required: false)
+ asmcmd = 'ml'
elif cpu == 'x86_64'
- ml = find_program('ml64', required: false)
+ asmcmd = 'ml64'
+ elif cpu == 'aarch64'
+ asmcmd = 'armasm64'
+ elif cpu == 'arm'
+ asmcmd = 'armasm'
else
error('Unsupported cpu family: "' + cpu + '"')
endif
+ ml = find_program(asmcmd, required: false)
if not ml.found()
- error('MESON_SKIP_TEST: ML (masm) not found')
+ error('MESON_SKIP_TEST: Microsoft assembler (ml/armasm) not found')
endif
# Preprocess file (ml doesn't support pre-processing)
# Force the intput to be C (/Tc) because ICL otherwise assumes it's an object (.obj) file
@@ -48,10 +53,17 @@ foreach lang : ['c', 'cpp']
output : preproc_name,
command : [cl, '/nologo', '/EP', '/P', '/Fi' + preproc_name, '/Tc', '@INPUT@'] + uscore_args)
# Use assembled object file instead of the original .S assembly source
- square_impl = custom_target(lang + square_impl,
- input : square_preproc,
- output : lang + square_base + '.obj',
- command : [ml, '/nologo', '/safeseh', '/Fo', '@OUTPUT@', '/c', '@INPUT@'])
+ if asmcmd.startswith('armasm')
+ square_impl = custom_target(lang + square_impl,
+ input : square_preproc,
+ output : lang + square_base + '.obj',
+ command : [ml, '-nologo', '-o', '@OUTPUT@', '@INPUT@'])
+ else
+ square_impl = custom_target(lang + square_impl,
+ input : square_preproc,
+ output : lang + square_base + '.obj',
+ command : [ml, '/nologo', '/safeseh', '/Fo', '@OUTPUT@', '/c', '@INPUT@'])
+ endif
endif
if supported_cpus.contains(cpu)
e = executable('square_asm_' + lang, square_impl, 'main.' + lang,
diff --git a/test cases/common/122 llvm ir and assembly/square-aarch64.S b/test cases/common/122 llvm ir and assembly/square-aarch64.S
new file mode 100644
index 0000000..ebe74e7
--- /dev/null
+++ b/test cases/common/122 llvm ir and assembly/square-aarch64.S
@@ -0,0 +1,20 @@
+#include "symbol-underscore.h"
+
+#ifdef _MSC_VER
+
+ AREA _TEXT, ARM64, CODE, READONLY
+
+ EXPORT SYMBOL_NAME(square_unsigned)
+SYMBOL_NAME(square_unsigned) PROC
+ mul x1, x0, x0
+ mov x0, x1
+ ret
+SYMBOL_NAME(square_unsigned) ENDP
+
+ END
+
+#else
+
+#error gas syntax assembly for this test needs to be written
+
+#endif
diff --git a/test cases/common/122 llvm ir and assembly/square-arm.S b/test cases/common/122 llvm ir and assembly/square-arm.S
index 4dd4467..aea3f1f 100644
--- a/test cases/common/122 llvm ir and assembly/square-arm.S
+++ b/test cases/common/122 llvm ir and assembly/square-arm.S
@@ -1,5 +1,20 @@
#include "symbol-underscore.h"
+#ifdef _MSC_VER
+
+ AREA _TEXT, ARM, CODE, READONLY
+
+ EXPORT SYMBOL_NAME(square_unsigned)
+SYMBOL_NAME(square_unsigned) PROC
+ mul r1, r0, r0
+ mov r0, r1
+ mov pc, lr
+SYMBOL_NAME(square_unsigned) ENDP
+
+ END
+
+#else
+
.text
.globl SYMBOL_NAME(square_unsigned)
# ifdef __linux__
@@ -10,3 +25,5 @@ SYMBOL_NAME(square_unsigned):
mul r1, r0, r0
mov r0, r1
mov pc, lr
+
+#endif