From bb8cef51dfe7bb59109786a0ca46ad165c39aa38 Mon Sep 17 00:00:00 2001 From: Danil Malyshev Date: Thu, 17 May 2012 21:07:47 +0000 Subject: [PATCH] - Added ExecutionEngine/MCJIT tests - Added HOST_ARCH to Makefile.config.in The HOST_ARCH will be used by MCJIT tests filter, because MCJIT supported only x86 and ARM architectures now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157015 91177308-0d34-0410-b5e6-96231b3b80d8 --- Makefile.config.in | 2 + autoconf/configure.ac | 25 ++++ configure | 32 ++++- test/CMakeLists.txt | 3 + .../MCJIT/2002-12-16-ArgTest.ll | 37 ++++++ .../MCJIT/2003-01-04-ArgumentBug.ll | 13 +++ .../MCJIT/2003-01-04-LoopTest.ll | 20 ++++ .../MCJIT/2003-01-04-PhiTest.ll | 12 ++ .../MCJIT/2003-01-09-SARTest.ll | 11 ++ .../ExecutionEngine/MCJIT/2003-01-10-FUCOM.ll | 10 ++ .../MCJIT/2003-01-15-AlignmentTest.ll | 17 +++ .../MCJIT/2003-05-06-LivenessClobber.ll | 19 +++ .../MCJIT/2003-05-07-ArgumentTest.ll | 11 ++ .../MCJIT/2003-05-11-PHIRegAllocBug.ll | 15 +++ .../MCJIT/2003-06-04-bzip2-bug.ll | 19 +++ .../MCJIT/2003-06-05-PHIBug.ll | 17 +++ .../MCJIT/2003-08-15-AllocaAssertion.ll | 11 ++ .../MCJIT/2003-08-21-EnvironmentTest.ll | 21 ++++ .../2003-08-23-RegisterAllocatePhysReg.ll | 34 ++++++ ...8-PHINode-ConstantExpr-CondCode-Failure.ll | 23 ++++ .../MCJIT/2005-12-02-TailCallBug.ll | 22 ++++ .../MCJIT/2007-12-10-APIntLoadStore.ll | 19 +++ .../MCJIT/2008-06-05-APInt-OverAShr.ll | 59 ++++++++++ .../MCJIT/2010-01-15-UndefValue.ll | 8 ++ test/ExecutionEngine/MCJIT/fpbitcast.ll | 20 ++++ test/ExecutionEngine/MCJIT/hello.ll | 11 ++ test/ExecutionEngine/MCJIT/hello2.ll | 17 +++ test/ExecutionEngine/MCJIT/lit.local.cfg | 20 ++++ test/ExecutionEngine/MCJIT/simplesttest.ll | 6 + test/ExecutionEngine/MCJIT/simpletest.ll | 11 ++ test/ExecutionEngine/MCJIT/stubs.ll | 35 ++++++ test/ExecutionEngine/MCJIT/test-arith.ll | 34 ++++++ test/ExecutionEngine/MCJIT/test-branch.ll | 12 ++ .../MCJIT/test-call-no-external-funcs.ll | 14 +++ test/ExecutionEngine/MCJIT/test-call.ll | 21 ++++ test/ExecutionEngine/MCJIT/test-cast.ll | 109 ++++++++++++++++++ .../MCJIT/test-common-symbols.ll | 88 ++++++++++++++ .../MCJIT/test-constantexpr.ll | 12 ++ .../MCJIT/test-fp-no-external-funcs.ll | 21 ++++ test/ExecutionEngine/MCJIT/test-fp.ll | 23 ++++ .../MCJIT/test-global-init-nonzero.ll | 34 ++++++ test/ExecutionEngine/MCJIT/test-global.ll | 34 ++++++ test/ExecutionEngine/MCJIT/test-loadstore.ll | 31 +++++ test/ExecutionEngine/MCJIT/test-local.ll | 34 ++++++ test/ExecutionEngine/MCJIT/test-logical.ll | 18 +++ test/ExecutionEngine/MCJIT/test-loop.ll | 14 +++ test/ExecutionEngine/MCJIT/test-phi.ll | 34 ++++++ test/ExecutionEngine/MCJIT/test-ret.ll | 46 ++++++++ test/ExecutionEngine/MCJIT/test-return.ll | 8 ++ test/ExecutionEngine/MCJIT/test-setcond-fp.ll | 24 ++++ .../ExecutionEngine/MCJIT/test-setcond-int.ll | 69 +++++++++++ test/ExecutionEngine/MCJIT/test-shift.ll | 32 +++++ test/Makefile | 4 + test/lit.site.cfg.in | 2 + 54 files changed, 1295 insertions(+), 3 deletions(-) create mode 100644 test/ExecutionEngine/MCJIT/2002-12-16-ArgTest.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-01-04-ArgumentBug.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-01-04-LoopTest.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-01-04-PhiTest.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-01-09-SARTest.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-01-10-FUCOM.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-01-15-AlignmentTest.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-05-06-LivenessClobber.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-05-07-ArgumentTest.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-05-11-PHIRegAllocBug.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-06-04-bzip2-bug.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-06-05-PHIBug.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-08-15-AllocaAssertion.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-08-21-EnvironmentTest.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-08-23-RegisterAllocatePhysReg.ll create mode 100644 test/ExecutionEngine/MCJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll create mode 100644 test/ExecutionEngine/MCJIT/2005-12-02-TailCallBug.ll create mode 100644 test/ExecutionEngine/MCJIT/2007-12-10-APIntLoadStore.ll create mode 100644 test/ExecutionEngine/MCJIT/2008-06-05-APInt-OverAShr.ll create mode 100644 test/ExecutionEngine/MCJIT/2010-01-15-UndefValue.ll create mode 100644 test/ExecutionEngine/MCJIT/fpbitcast.ll create mode 100644 test/ExecutionEngine/MCJIT/hello.ll create mode 100644 test/ExecutionEngine/MCJIT/hello2.ll create mode 100644 test/ExecutionEngine/MCJIT/lit.local.cfg create mode 100644 test/ExecutionEngine/MCJIT/simplesttest.ll create mode 100644 test/ExecutionEngine/MCJIT/simpletest.ll create mode 100644 test/ExecutionEngine/MCJIT/stubs.ll create mode 100644 test/ExecutionEngine/MCJIT/test-arith.ll create mode 100644 test/ExecutionEngine/MCJIT/test-branch.ll create mode 100644 test/ExecutionEngine/MCJIT/test-call-no-external-funcs.ll create mode 100644 test/ExecutionEngine/MCJIT/test-call.ll create mode 100644 test/ExecutionEngine/MCJIT/test-cast.ll create mode 100644 test/ExecutionEngine/MCJIT/test-common-symbols.ll create mode 100644 test/ExecutionEngine/MCJIT/test-constantexpr.ll create mode 100644 test/ExecutionEngine/MCJIT/test-fp-no-external-funcs.ll create mode 100644 test/ExecutionEngine/MCJIT/test-fp.ll create mode 100644 test/ExecutionEngine/MCJIT/test-global-init-nonzero.ll create mode 100644 test/ExecutionEngine/MCJIT/test-global.ll create mode 100644 test/ExecutionEngine/MCJIT/test-loadstore.ll create mode 100644 test/ExecutionEngine/MCJIT/test-local.ll create mode 100644 test/ExecutionEngine/MCJIT/test-logical.ll create mode 100644 test/ExecutionEngine/MCJIT/test-loop.ll create mode 100644 test/ExecutionEngine/MCJIT/test-phi.ll create mode 100644 test/ExecutionEngine/MCJIT/test-ret.ll create mode 100644 test/ExecutionEngine/MCJIT/test-return.ll create mode 100644 test/ExecutionEngine/MCJIT/test-setcond-fp.ll create mode 100644 test/ExecutionEngine/MCJIT/test-setcond-int.ll create mode 100644 test/ExecutionEngine/MCJIT/test-shift.ll diff --git a/Makefile.config.in b/Makefile.config.in index 2ffdacbe90b..e90731b3a08 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -112,6 +112,8 @@ HOST_OS=@HOST_OS@ # Target operating system for which LLVM will compile for. TARGET_OS=@TARGET_OS@ +# Host hardware architecture +HOST_ARCH=@HOST_ARCH@ # Target hardware architecture ARCH=@ARCH@ TARGET_NATIVE_ARCH := $(ARCH) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 0f488ab5994..62c01f93159 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -388,6 +388,31 @@ esac dnl Define a substitution, ARCH, for the target architecture AC_SUBST(ARCH,$llvm_cv_target_arch) +dnl Determine what our host architecture. +dnl This will allow MCJIT regress tests runs only for supported +dnl platforms. +case $host in + i?86-*) host_arch="x86" ;; + amd64-* | x86_64-*) host_arch="x86_64" ;; + sparc*-*) host_arch="Sparc" ;; + powerpc*-*) host_arch="PowerPC" ;; + arm*-*) host_arch="ARM" ;; + mips-*) host_arch="Mips" ;; + mipsel-*) host_arch="Mips" ;; + xcore-*) host_arch="XCore" ;; + msp430-*) host_arch="MSP430" ;; + hexagon-*) host_arch="Hexagon" ;; + mblaze-*) host_arch="MBlaze" ;; + ptx-*) host_arch="PTX" ;; + *) host_arch="Unknown" ;; +esac + +if test "$host_arch" = "Unknown" ; then + AC_MSG_WARN([Configuring LLVM for an unknown host archicture]) +fi + +AC_SUBST(HOST_ARCH,$host_arch) + dnl Check for the endianness of the target AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) diff --git a/configure b/configure index 348436fc4d2..b3d37fd9055 100755 --- a/configure +++ b/configure @@ -674,6 +674,7 @@ NOLINKALL LLVM_ON_UNIX LLVM_ON_WIN32 ARCH +HOST_ARCH ENDIAN GREP EGREP @@ -3922,6 +3923,30 @@ esac ARCH=$llvm_cv_target_arch +case $host in + i?86-*) host_arch="x86" ;; + amd64-* | x86_64-*) host_arch="x86_64" ;; + sparc*-*) host_arch="Sparc" ;; + powerpc*-*) host_arch="PowerPC" ;; + arm*-*) host_arch="ARM" ;; + mips-*) host_arch="Mips" ;; + mipsel-*) host_arch="Mips" ;; + xcore-*) host_arch="XCore" ;; + msp430-*) host_arch="MSP430" ;; + hexagon-*) host_arch="Hexagon" ;; + mblaze-*) host_arch="MBlaze" ;; + ptx-*) host_arch="PTX" ;; + *) host_arch="Unknown" ;; +esac + +if test "$host_arch" = "Unknown" ; then + { echo "$as_me:$LINENO: WARNING: Configuring LLVM for an unknown host archicture" >&5 +echo "$as_me: WARNING: Configuring LLVM for an unknown host archicture" >&2;} +fi + +HOST_ARCH=$host_arch + + { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 @@ -10324,7 +10349,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <conf$$subs.sed <<_ACEOF +ENABLE_EMBED_STDCXX!$ENABLE_EMBED_STDCXX$ac_delim ENABLE_TIMESTAMPS!$ENABLE_TIMESTAMPS$ac_delim TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim LLVM_ENUM_TARGETS!$LLVM_ENUM_TARGETS$ac_delim @@ -22194,7 +22220,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 90; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b9e73d087b0..ebea47d6916 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -49,6 +49,9 @@ else() set(ENABLE_ASSERTIONS "0") endif() +set(HOST_OS ${CMAKE_HOST_SYSTEM_NAME}) +set(HOST_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR}) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg diff --git a/test/ExecutionEngine/MCJIT/2002-12-16-ArgTest.ll b/test/ExecutionEngine/MCJIT/2002-12-16-ArgTest.ll new file mode 100644 index 00000000000..46273d34009 --- /dev/null +++ b/test/ExecutionEngine/MCJIT/2002-12-16-ArgTest.ll @@ -0,0 +1,37 @@ +; RUN: %lli -use-mcjit %s > /dev/null + +@.LC0 = internal global [10 x i8] c"argc: %d\0A\00" ; <[10 x i8]*> [#uses=1] + +declare i32 @puts(i8*) + +define void @getoptions(i32* %argc) { +bb0: + ret void +} + +declare i32 @printf(i8*, ...) + +define i32 @main(i32 %argc, i8** %argv) { +bb0: + call i32 (i8*, ...)* @printf( i8* getelementptr ([10 x i8]* @.LC0, i64 0, i64 0), i32 %argc ) ; :0 [#uses=0] + %cast224 = bitcast i8** %argv to i8* ; [#uses=1] + %local = alloca i8* ; [#uses=3] + store i8* %cast224, i8** %local + %cond226 = icmp sle i32 %argc, 0 ; [#uses=1] + br i1 %cond226, label %bb3, label %bb2 +bb2: ; preds = %bb2, %bb0 + %cann-indvar = phi i32 [ 0, %bb0 ], [ %add1-indvar, %bb2 ] ; [#uses=2] + %add1-indvar = add i32 %cann-indvar, 1 ; [#uses=2] + %cann-indvar-idxcast = sext i32 %cann-indvar to i64 ; [#uses=1] + %CT = bitcast i8** %local to i8*** ; [#uses=1] + %reg115 = load i8*** %CT ; [#uses=1] + %cast235 = getelementptr i8** %reg115, i64 %cann-indvar-idxcast ; [#uses=1] + %reg117 = load i8** %cast235 ; [#uses=1] + %reg236 = call i32 @puts( i8* %reg117 ) ; [#uses=0] + %cond239 = icmp slt i32 %add1-indvar, %argc ; [#uses=1] + br i1 %cond239, label %bb2, label %bb3 +bb3: ; preds = %bb2, %bb0 + %cast243 = bitcast i8** %local to i32* ; [#uses=1] + call void @getoptions( i32* %cast243 ) + ret i32 0 +} diff --git a/test/ExecutionEngine/MCJIT/2003-01-04-ArgumentBug.ll b/test/ExecutionEngine/MCJIT/2003-01-04-ArgumentBug.ll new file mode 100644 index 00000000000..88bfbb3c09b --- /dev/null +++ b/test/ExecutionEngine/MCJIT/2003-01-04-ArgumentBug.ll @@ -0,0 +1,13 @@ +; RUN: %lli -use-mcjit %s > /dev/null + +define i32 @foo(i32 %X, i32 %Y, double %A) { + %cond212 = fcmp une double %A, 1.000000e+00 ; [#uses=1] + %cast110 = zext i1 %cond212 to i32 ; [#uses=1] + ret i32 %cast110 +} + +define i32 @main() { + %reg212 = call i32 @foo( i32 0, i32 1, double 1.000000e+00 ) ; [#uses=1] + ret i32 %reg212 +} + diff --git a/test/ExecutionEngine/MCJIT/2003-01-04-LoopTest.ll b/test/ExecutionEngine/MCJIT/2003-01-04-LoopTest.ll new file mode 100644 index 00000000000..d5f860d1704 --- /dev/null +++ b/test/ExecutionEngine/MCJIT/2003-01-04-LoopTest.ll @@ -0,0 +1,20 @@ +; RUN: %lli -use-mcjit %s > /dev/null + +define i32 @main() { + call i32 @mylog( i32 4 ) ; :1 [#uses=0] + ret i32 0 +} + +define internal i32 @mylog(i32 %num) { +bb0: + br label %bb2 +bb2: ; preds = %bb2, %bb0 + %reg112 = phi i32 [ 10, %bb2 ], [ 1, %bb0 ] ; [#uses=1] + %cann-indvar = phi i32 [ %cann-indvar, %bb2 ], [ 0, %bb0 ] ; [#uses=1] + %reg114 = add i32 %reg112, 1 ; [#uses=2] + %cond222 = icmp slt i32 %reg114, %num ; [#uses=1] + br i1 %cond222, label %bb2, label %bb3 +bb3: ; preds = %bb2 + ret i32 %reg114 +} + diff --git a/test/ExecutionEngine/MCJIT/2003-01-04-PhiTest.ll b/test/ExecutionEngine/MCJIT/2003-01-04-PhiTest.ll new file mode 100644 index 00000000000..721f2e8859d --- /dev/null +++ b/test/ExecutionEngine/MCJIT/2003-01-04-PhiTest.ll @@ -0,0 +1,12 @@ +; RUN: %lli -use-mcjit %s > /dev/null + +define i32 @main() { +;