From: Rafael Espindola Date: Sun, 27 Jul 2014 23:11:06 +0000 (+0000) Subject: Start adding some tests for the gold plugin. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=12cc465b434bb8bf6805c2f66a666817fa7f1db3;p=oota-llvm.git Start adding some tests for the gold plugin. These are only used when the 'ld' in the path is gold and the plugin has been built, but it is already a start to make sure we don't regress features that cannot be tested with llvm-lto. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214058 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/lit.cfg b/test/lit.cfg index 2b9b2d9a7d0..6f2632cba5d 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -301,8 +301,28 @@ else: if config.host_triple == config.target_triple: config.available_features.add("native") -# Ask llvm-config about assertion mode. import subprocess + +def have_ld_plugin_support(): + if not os.path.exists(os.path.join(config.llvm_shlib_dir, 'LLVMgold.so')): + return False + + ld_cmd = subprocess.Popen(['ld', '--help'], stdout = subprocess.PIPE) + if not '-plugin' in ld_cmd.stdout.read(): + return False + ld_cmd.wait() + + ld_version = subprocess.Popen(['ld', '--version'], stdout = subprocess.PIPE) + if not 'GNU gold' in ld_version.stdout.read(): + return False + ld_version.wait() + + return True + +if have_ld_plugin_support(): + config.available_features.add('ld_plugin') + +# Ask llvm-config about assertion mode. try: llvm_config_cmd = subprocess.Popen( [os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode'], diff --git a/test/tools/gold/lit.local.cfg b/test/tools/gold/lit.local.cfg new file mode 100644 index 00000000000..ddcd48ca470 --- /dev/null +++ b/test/tools/gold/lit.local.cfg @@ -0,0 +1,3 @@ +if (not 'ld_plugin' in config.available_features or + not 'X86' in config.root.targets): + config.unsupported = True diff --git a/test/tools/gold/option.ll b/test/tools/gold/option.ll new file mode 100644 index 00000000000..af24d831f4b --- /dev/null +++ b/test/tools/gold/option.ll @@ -0,0 +1,24 @@ +; RUN: llvm-as %s -o %t.o +; RUN: ld -plugin %llvmshlibdir/LLVMgold.so -m elf_x86_64 \ +; RUN: --plugin-opt=-jump-table-type=arity \ +; RUN: --plugin-opt=-mattr=+aes \ +; RUN: -shared %t.o -o %t2.o +; RUN: llvm-nm %t2.o | FileCheck %s + +; CHECK: T __llvm_jump_instr_table_0_1 +; CHECK: T __llvm_jump_instr_table_1_1 + +target triple = "x86_64-unknown-linux-gnu" +define i32 @g(i32 %a) unnamed_addr jumptable { + ret i32 %a +} + +define i32 @f() unnamed_addr jumptable { + ret i32 0 +} + +define <2 x i64> @test_avx(<2 x i64> %a0, <2 x i64> %a1) { + %res = call <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64> %a0, <2 x i64> %a1) + ret <2 x i64> %res +} +declare <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64>, <2 x i64>) nounwind readnone