diff options
Diffstat (limited to 'test cases/common/123 llvm ir and assembly')
8 files changed, 0 insertions, 187 deletions
diff --git a/test cases/common/123 llvm ir and assembly/main.c b/test cases/common/123 llvm ir and assembly/main.c deleted file mode 100644 index 97fe723..0000000 --- a/test cases/common/123 llvm ir and assembly/main.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <stdio.h> - -unsigned square_unsigned (unsigned a); - -int -main (int argc, char * argv[]) -{ - unsigned int ret = square_unsigned (2); - if (ret != 4) { - printf("Got %u instead of 4\n", ret); - return 1; - } - return 0; -} diff --git a/test cases/common/123 llvm ir and assembly/main.cpp b/test cases/common/123 llvm ir and assembly/main.cpp deleted file mode 100644 index f2c7de3..0000000 --- a/test cases/common/123 llvm ir and assembly/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include <stdio.h> - -extern "C" { - unsigned square_unsigned (unsigned a); -} - -int -main (int argc, char * argv[]) -{ - unsigned int ret = square_unsigned (2); - if (ret != 4) { - printf("Got %u instead of 4\n", ret); - return 1; - } - return 0; -} diff --git a/test cases/common/123 llvm ir and assembly/meson.build b/test cases/common/123 llvm ir and assembly/meson.build deleted file mode 100644 index 3cc7d5e..0000000 --- a/test cases/common/123 llvm ir and assembly/meson.build +++ /dev/null @@ -1,63 +0,0 @@ -project('llvm-ir', 'c', 'cpp') - -cpu = host_machine.cpu_family() -supported_cpus = ['arm', 'x86', 'x86_64'] - -foreach lang : ['c', 'cpp'] - cc = meson.get_compiler(lang) - cc_id = cc.get_id() - ## Build a trivial executable with mixed LLVM IR source - if cc_id == 'clang' - e = executable('square_ir_' + lang, 'square.ll', 'main.' + lang) - test('test IR square' + lang, e) - endif - ## Build a trivial executable with mixed assembly source - # This also helps test whether cc.symbols_have_underscore_prefix() is working - # properly. This is done by assembling some assembly into an object that will - # provide the unsigned_squared() symbol to main.c/cpp. This requires the - # C symbol mangling to be known in advance. - if cc.symbols_have_underscore_prefix() - uscore_args = ['-DMESON_TEST__UNDERSCORE_SYMBOL'] - message('underscore is prefixed') - else - uscore_args = [] - message('underscore is NOT prefixed') - endif - 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. - if cc.get_argument_syntax() == 'msvc' - cl = cc.cmd_array() - if cpu == 'x86' - ml = find_program('ml', required: false) - elif cpu == 'x86_64' - ml = find_program('ml64', required: false) - else - error('Unsupported cpu family: "' + cpu + '"') - endif - if not ml.found() - error('MESON_SKIP_TEST: ML (masm) 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 - preproc_name = lang + square_base + '.i' - square_preproc = custom_target(lang + square_impl + 'preproc', - input : square_impl, - 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@']) - endif - if supported_cpus.contains(cpu) - e = executable('square_asm_' + lang, square_impl, 'main.' + lang, - c_args : uscore_args, cpp_args : uscore_args) - test('test ASM square' + lang, e) - elif cc_id != 'clang' - error('MESON_SKIP_TEST: Unsupported cpu: "' + cpu + '", and LLVM not found') - endif -endforeach diff --git a/test cases/common/123 llvm ir and assembly/square-arm.S b/test cases/common/123 llvm ir and assembly/square-arm.S deleted file mode 100644 index 4dd4467..0000000 --- a/test cases/common/123 llvm ir and assembly/square-arm.S +++ /dev/null @@ -1,12 +0,0 @@ -#include "symbol-underscore.h" - -.text -.globl SYMBOL_NAME(square_unsigned) -# ifdef __linux__ -.type square_unsigned, %function -#endif - -SYMBOL_NAME(square_unsigned): - mul r1, r0, r0 - mov r0, r1 - mov pc, lr diff --git a/test cases/common/123 llvm ir and assembly/square-x86.S b/test cases/common/123 llvm ir and assembly/square-x86.S deleted file mode 100644 index 18284c1..0000000 --- a/test cases/common/123 llvm ir and assembly/square-x86.S +++ /dev/null @@ -1,36 +0,0 @@ -#include "symbol-underscore.h" - -/* This sadly doesn't test the symbol underscore stuff. I can't figure out how - * to not use an automatic stdcall mechanism and do everything manually. */ -#ifdef _MSC_VER - -.386 -.MODEL FLAT, C - -PUBLIC square_unsigned -_TEXT SEGMENT - -square_unsigned PROC var1:DWORD - mov eax, var1 - imul eax, eax - ret - -square_unsigned ENDP - -_TEXT ENDS -END - -#else - -.text -.globl SYMBOL_NAME(square_unsigned) -# ifdef __linux__ -.type square_unsigned, %function -#endif - -SYMBOL_NAME(square_unsigned): - movl 4(%esp), %eax - imull %eax, %eax - retl - -#endif diff --git a/test cases/common/123 llvm ir and assembly/square-x86_64.S b/test cases/common/123 llvm ir and assembly/square-x86_64.S deleted file mode 100644 index 5678d00..0000000 --- a/test cases/common/123 llvm ir and assembly/square-x86_64.S +++ /dev/null @@ -1,37 +0,0 @@ -#include "symbol-underscore.h" - -#ifdef _MSC_VER /* MSVC on Windows */ - -PUBLIC SYMBOL_NAME(square_unsigned) -_TEXT SEGMENT - -SYMBOL_NAME(square_unsigned) PROC - mov eax, ecx - imul eax, eax - ret -SYMBOL_NAME(square_unsigned) ENDP - -_TEXT ENDS -END - -#else - -.text -.globl SYMBOL_NAME(square_unsigned) -# ifdef __linux__ -.type square_unsigned, %function -#endif - -# if defined(_WIN32) || defined(__CYGWIN__) /* msabi */ -SYMBOL_NAME(square_unsigned): - imull %ecx, %ecx - movl %ecx, %eax - retq -# else /* sysvabi */ -SYMBOL_NAME(square_unsigned): - imull %edi, %edi - movl %edi, %eax - retq -# endif - -#endif diff --git a/test cases/common/123 llvm ir and assembly/square.ll b/test cases/common/123 llvm ir and assembly/square.ll deleted file mode 100644 index 7c321aa..0000000 --- a/test cases/common/123 llvm ir and assembly/square.ll +++ /dev/null @@ -1,4 +0,0 @@ -define i32 @square_unsigned(i32 %a) { - %1 = mul i32 %a, %a - ret i32 %1 -} diff --git a/test cases/common/123 llvm ir and assembly/symbol-underscore.h b/test cases/common/123 llvm ir and assembly/symbol-underscore.h deleted file mode 100644 index d0f3ef9..0000000 --- a/test cases/common/123 llvm ir and assembly/symbol-underscore.h +++ /dev/null @@ -1,5 +0,0 @@ -#if defined(MESON_TEST__UNDERSCORE_SYMBOL) -# define SYMBOL_NAME(name) _##name -#else -# define SYMBOL_NAME(name) name -#endif |