[llvm-commits] [llvm] r148299 - in /llvm/trunk/test/ExecutionEngine: test-call-no-external-funcs.ll test-common-symbols.ll test-fp-no-external-funcs.ll test-global-init-nonzero.ll test-global.ll test-local.ll test-return.ll
Eli Bendersky
eli.bendersky at intel.com
Tue Jan 17 01:14:54 PST 2012
Author: eliben
Date: Tue Jan 17 03:14:54 2012
New Revision: 148299
URL: http://llvm.org/viewvc/llvm-project?rev=148299&view=rev
Log:
Additional ExecutionEngine tests, as part of bringing up the MCJIT on ELF
implementation.
Currently lit still executes ExecutionEngine tests with JIT (not MCJIT) by
default. MCJIT tests can be executed manually by calling llvm-lit with
--param jit_impl=mcjit
Added:
llvm/trunk/test/ExecutionEngine/test-call-no-external-funcs.ll
llvm/trunk/test/ExecutionEngine/test-common-symbols.ll
llvm/trunk/test/ExecutionEngine/test-fp-no-external-funcs.ll
llvm/trunk/test/ExecutionEngine/test-global-init-nonzero.ll
llvm/trunk/test/ExecutionEngine/test-global.ll
llvm/trunk/test/ExecutionEngine/test-local.ll
llvm/trunk/test/ExecutionEngine/test-return.ll
Added: llvm/trunk/test/ExecutionEngine/test-call-no-external-funcs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/test-call-no-external-funcs.ll?rev=148299&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/test-call-no-external-funcs.ll (added)
+++ llvm/trunk/test/ExecutionEngine/test-call-no-external-funcs.ll Tue Jan 17 03:14:54 2012
@@ -0,0 +1,16 @@
+; RUN: %lli %s > /dev/null
+; XFAIL: arm
+; XFAIL: mcjit
+
+define i32 @_Z14func_exit_codev() nounwind uwtable {
+entry:
+ ret i32 0
+}
+
+define i32 @main() nounwind uwtable {
+entry:
+ %retval = alloca i32, align 4
+ store i32 0, i32* %retval
+ %call = call i32 @_Z14func_exit_codev()
+ ret i32 %call
+}
Added: llvm/trunk/test/ExecutionEngine/test-common-symbols.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/test-common-symbols.ll?rev=148299&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/test-common-symbols.ll (added)
+++ llvm/trunk/test/ExecutionEngine/test-common-symbols.ll Tue Jan 17 03:14:54 2012
@@ -0,0 +1,90 @@
+; RUN: %lli -O0 -disable-lazy-compilation=false %s
+; XFAIL: arm
+; XFAIL: mcjit
+
+; The intention of this test is to verify that symbols mapped to COMMON in ELF
+; work as expected.
+;
+; Compiled from this C code:
+;
+; int zero_int;
+; double zero_double;
+; int zero_arr[10];
+;
+; int main()
+; {
+; zero_arr[zero_int + 5] = 40;
+;
+; if (zero_double < 1.0)
+; zero_arr[zero_int + 2] = 70;
+;
+; for (int i = 1; i < 10; ++i) {
+; zero_arr[i] = zero_arr[i - 1] + zero_arr[i];
+; }
+; return zero_arr[9] == 110 ? 0 : -1;
+; }
+
+ at zero_int = common global i32 0, align 4
+ at zero_arr = common global [10 x i32] zeroinitializer, align 16
+ at zero_double = common global double 0.000000e+00, align 8
+
+define i32 @main() nounwind {
+entry:
+ %retval = alloca i32, align 4
+ %i = alloca i32, align 4
+ store i32 0, i32* %retval
+ %0 = load i32* @zero_int, align 4
+ %add = add nsw i32 %0, 5
+ %idxprom = sext i32 %add to i64
+ %arrayidx = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom
+ store i32 40, i32* %arrayidx, align 4
+ %1 = load double* @zero_double, align 8
+ %cmp = fcmp olt double %1, 1.000000e+00
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ %2 = load i32* @zero_int, align 4
+ %add1 = add nsw i32 %2, 2
+ %idxprom2 = sext i32 %add1 to i64
+ %arrayidx3 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom2
+ store i32 70, i32* %arrayidx3, align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ store i32 1, i32* %i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %if.end
+ %3 = load i32* %i, align 4
+ %cmp4 = icmp slt i32 %3, 10
+ br i1 %cmp4, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %4 = load i32* %i, align 4
+ %sub = sub nsw i32 %4, 1
+ %idxprom5 = sext i32 %sub to i64
+ %arrayidx6 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom5
+ %5 = load i32* %arrayidx6, align 4
+ %6 = load i32* %i, align 4
+ %idxprom7 = sext i32 %6 to i64
+ %arrayidx8 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom7
+ %7 = load i32* %arrayidx8, align 4
+ %add9 = add nsw i32 %5, %7
+ %8 = load i32* %i, align 4
+ %idxprom10 = sext i32 %8 to i64
+ %arrayidx11 = getelementptr inbounds [10 x i32]* @zero_arr, i32 0, i64 %idxprom10
+ store i32 %add9, i32* %arrayidx11, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %9 = load i32* %i, align 4
+ %inc = add nsw i32 %9, 1
+ store i32 %inc, i32* %i, align 4
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ %10 = load i32* getelementptr inbounds ([10 x i32]* @zero_arr, i32 0, i64 9), align 4
+ %cmp12 = icmp eq i32 %10, 110
+ %cond = select i1 %cmp12, i32 0, i32 -1
+ ret i32 %cond
+}
Added: llvm/trunk/test/ExecutionEngine/test-fp-no-external-funcs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/test-fp-no-external-funcs.ll?rev=148299&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/test-fp-no-external-funcs.ll (added)
+++ llvm/trunk/test/ExecutionEngine/test-fp-no-external-funcs.ll Tue Jan 17 03:14:54 2012
@@ -0,0 +1,22 @@
+; RUN: %lli %s > /dev/null
+; XFAIL: mcjit
+
+define double @test(double* %DP, double %Arg) {
+ %D = load double* %DP ; <double> [#uses=1]
+ %V = fadd double %D, 1.000000e+00 ; <double> [#uses=2]
+ %W = fsub double %V, %V ; <double> [#uses=3]
+ %X = fmul double %W, %W ; <double> [#uses=2]
+ %Y = fdiv double %X, %X ; <double> [#uses=2]
+ %Q = fadd double %Y, %Arg ; <double> [#uses=1]
+ %R = bitcast double %Q to double ; <double> [#uses=1]
+ store double %Q, double* %DP
+ ret double %Y
+}
+
+define i32 @main() {
+ %X = alloca double ; <double*> [#uses=2]
+ store double 0.000000e+00, double* %X
+ call double @test( double* %X, double 2.000000e+00 ) ; <double>:1 [#uses=0]
+ ret i32 0
+}
+
Added: llvm/trunk/test/ExecutionEngine/test-global-init-nonzero.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/test-global-init-nonzero.ll?rev=148299&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/test-global-init-nonzero.ll (added)
+++ llvm/trunk/test/ExecutionEngine/test-global-init-nonzero.ll Tue Jan 17 03:14:54 2012
@@ -0,0 +1,36 @@
+; RUN: %lli %s > /dev/null
+; XFAIL: arm
+; XFAIL: mcjit
+
+ at count = global i32 1, align 4
+
+define i32 @main() nounwind uwtable {
+entry:
+ %retval = alloca i32, align 4
+ %i = alloca i32, align 4
+ store i32 0, i32* %retval
+ store i32 0, i32* %i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %0 = load i32* %i, align 4
+ %cmp = icmp slt i32 %0, 49
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %1 = load i32* @count, align 4
+ %inc = add nsw i32 %1, 1
+ store i32 %inc, i32* @count, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %2 = load i32* %i, align 4
+ %inc1 = add nsw i32 %2, 1
+ store i32 %inc1, i32* %i, align 4
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ %3 = load i32* @count, align 4
+ %sub = sub nsw i32 %3, 50
+ ret i32 %sub
+}
Added: llvm/trunk/test/ExecutionEngine/test-global.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/test-global.ll?rev=148299&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/test-global.ll (added)
+++ llvm/trunk/test/ExecutionEngine/test-global.ll Tue Jan 17 03:14:54 2012
@@ -0,0 +1,36 @@
+; RUN: %lli %s > /dev/null
+; XFAIL: arm
+; XFAIL: mcjit
+
+ at count = global i32 0, align 4
+
+define i32 @main() nounwind uwtable {
+entry:
+ %retval = alloca i32, align 4
+ %i = alloca i32, align 4
+ store i32 0, i32* %retval
+ store i32 0, i32* %i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %0 = load i32* %i, align 4
+ %cmp = icmp slt i32 %0, 50
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %1 = load i32* @count, align 4
+ %inc = add nsw i32 %1, 1
+ store i32 %inc, i32* @count, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %2 = load i32* %i, align 4
+ %inc1 = add nsw i32 %2, 1
+ store i32 %inc1, i32* %i, align 4
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ %3 = load i32* @count, align 4
+ %sub = sub nsw i32 %3, 50
+ ret i32 %sub
+}
Added: llvm/trunk/test/ExecutionEngine/test-local.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/test-local.ll?rev=148299&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/test-local.ll (added)
+++ llvm/trunk/test/ExecutionEngine/test-local.ll Tue Jan 17 03:14:54 2012
@@ -0,0 +1,35 @@
+; RUN: %lli %s > /dev/null
+; XFAIL: arm
+
+define i32 @main() nounwind uwtable {
+entry:
+ %retval = alloca i32, align 4
+ %count = alloca i32, align 4
+ %i = alloca i32, align 4
+ store i32 0, i32* %retval
+ store i32 0, i32* %count, align 4
+ store i32 0, i32* %i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %0 = load i32* %i, align 4
+ %cmp = icmp slt i32 %0, 50
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %1 = load i32* %count, align 4
+ %inc = add nsw i32 %1, 1
+ store i32 %inc, i32* %count, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %2 = load i32* %i, align 4
+ %inc1 = add nsw i32 %2, 1
+ store i32 %inc1, i32* %i, align 4
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ %3 = load i32* %count, align 4
+ %sub = sub nsw i32 %3, 50
+ ret i32 %sub
+}
Added: llvm/trunk/test/ExecutionEngine/test-return.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/test-return.ll?rev=148299&view=auto
==============================================================================
--- llvm/trunk/test/ExecutionEngine/test-return.ll (added)
+++ llvm/trunk/test/ExecutionEngine/test-return.ll Tue Jan 17 03:14:54 2012
@@ -0,0 +1,9 @@
+; RUN: %lli %s > /dev/null
+; XFAIL: arm
+
+define i32 @main() nounwind uwtable {
+entry:
+ %retval = alloca i32, align 4
+ store i32 0, i32* %retval
+ ret i32 0
+}
More information about the llvm-commits
mailing list