summaryrefslogtreecommitdiff
path: root/test/CodeGen/XCore
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-06-02 17:52:33 +0000
committerEd Schouten <ed@FreeBSD.org>2009-06-02 17:52:33 +0000
commit009b1c42aa6266385f2c37e227516b24077e6dd7 (patch)
tree64ba909838c23261cace781ece27d106134ea451 /test/CodeGen/XCore
Notes
Diffstat (limited to 'test/CodeGen/XCore')
-rw-r--r--test/CodeGen/XCore/2008-11-17-Shl64.ll6
-rw-r--r--test/CodeGen/XCore/2009-01-08-Crash.ll12
-rw-r--r--test/CodeGen/XCore/2009-01-14-Remat-Crash.ll18
-rw-r--r--test/CodeGen/XCore/2009-03-27-v2f64-param.ll6
-rw-r--r--test/CodeGen/XCore/addsub64.ll12
-rw-r--r--test/CodeGen/XCore/basictest.ll6
-rw-r--r--test/CodeGen/XCore/bitrev.ll8
-rw-r--r--test/CodeGen/XCore/cos.ll16
-rw-r--r--test/CodeGen/XCore/dg.exp5
-rw-r--r--test/CodeGen/XCore/exp.ll16
-rw-r--r--test/CodeGen/XCore/exp2.ll16
-rw-r--r--test/CodeGen/XCore/fneg.ll8
-rw-r--r--test/CodeGen/XCore/getid.ll8
-rw-r--r--test/CodeGen/XCore/log.ll16
-rw-r--r--test/CodeGen/XCore/log10.ll16
-rw-r--r--test/CodeGen/XCore/log2.ll16
-rw-r--r--test/CodeGen/XCore/pow.ll16
-rw-r--r--test/CodeGen/XCore/powi.ll16
-rw-r--r--test/CodeGen/XCore/private.ll21
-rw-r--r--test/CodeGen/XCore/sin.ll16
-rw-r--r--test/CodeGen/XCore/sqrt.ll16
-rw-r--r--test/CodeGen/XCore/trap.ll11
22 files changed, 281 insertions, 0 deletions
diff --git a/test/CodeGen/XCore/2008-11-17-Shl64.ll b/test/CodeGen/XCore/2008-11-17-Shl64.ll
new file mode 100644
index 000000000000..97ea41b8d0c0
--- /dev/null
+++ b/test/CodeGen/XCore/2008-11-17-Shl64.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; PR3080
+define i64 @test(i64 %a) {
+ %result = shl i64 %a, 1
+ ret i64 %result
+}
diff --git a/test/CodeGen/XCore/2009-01-08-Crash.ll b/test/CodeGen/XCore/2009-01-08-Crash.ll
new file mode 100644
index 000000000000..6f5fb7c6871e
--- /dev/null
+++ b/test/CodeGen/XCore/2009-01-08-Crash.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+;; This caused a compilation failure since the
+;; address arithmetic was folded into the LDWSP instruction,
+;; resulting in a negative offset which eliminateFrameIndex was
+;; unable to eliminate.
+define i32 @test(i32 %bar) nounwind readnone {
+entry:
+ %bar_addr = alloca i32
+ %0 = getelementptr i32* %bar_addr, i32 -1
+ %1 = load i32* %0, align 4
+ ret i32 %1
+}
diff --git a/test/CodeGen/XCore/2009-01-14-Remat-Crash.ll b/test/CodeGen/XCore/2009-01-14-Remat-Crash.ll
new file mode 100644
index 000000000000..735e988e91c8
--- /dev/null
+++ b/test/CodeGen/XCore/2009-01-14-Remat-Crash.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; PR3324
+define double @f1(double %a, double %b, double %c, double %d, double %e, double %f, double %g) nounwind {
+entry:
+ br i1 false, label %bb113, label %bb129
+
+bb113: ; preds = %entry
+ ret double 0.000000e+00
+
+bb129: ; preds = %entry
+ %tmp134 = sub double %b, %a ; <double> [#uses=1]
+ %tmp136 = sub double %tmp134, %c ; <double> [#uses=1]
+ %tmp138 = add double %tmp136, %d ; <double> [#uses=1]
+ %tmp140 = sub double %tmp138, %e ; <double> [#uses=1]
+ %tmp142 = add double %tmp140, %f ; <double> [#uses=1]
+ %tmp.0 = mul double %tmp142, 0.000000e+00 ; <double> [#uses=1]
+ ret double %tmp.0
+}
diff --git a/test/CodeGen/XCore/2009-03-27-v2f64-param.ll b/test/CodeGen/XCore/2009-03-27-v2f64-param.ll
new file mode 100644
index 000000000000..e834d66df241
--- /dev/null
+++ b/test/CodeGen/XCore/2009-03-27-v2f64-param.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | llc -march=xcore
+; PR3898
+
+define i32 @vector_param(<2 x double> %x) nounwind {
+ ret i32 1;
+}
diff --git a/test/CodeGen/XCore/addsub64.ll b/test/CodeGen/XCore/addsub64.ll
new file mode 100644
index 000000000000..41224fca1cc2
--- /dev/null
+++ b/test/CodeGen/XCore/addsub64.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -march=xcore -mcpu=xs1b-generic > %t1.s
+; RUN: grep ladd %t1.s | count 2
+; RUN: grep lsub %t1.s | count 2
+define i64 @add64(i64 %a, i64 %b) {
+ %result = add i64 %a, %b
+ ret i64 %result
+}
+
+define i64 @sub64(i64 %a, i64 %b) {
+ %result = sub i64 %a, %b
+ ret i64 %result
+}
diff --git a/test/CodeGen/XCore/basictest.ll b/test/CodeGen/XCore/basictest.ll
new file mode 100644
index 000000000000..803ffcb74cc1
--- /dev/null
+++ b/test/CodeGen/XCore/basictest.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | llc -march=xcore
+
+define i32 @test(i32 %X) {
+ %tmp.1 = add i32 %X, 1
+ ret i32 %tmp.1
+}
diff --git a/test/CodeGen/XCore/bitrev.ll b/test/CodeGen/XCore/bitrev.ll
new file mode 100644
index 000000000000..38f394869763
--- /dev/null
+++ b/test/CodeGen/XCore/bitrev.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep bitrev %t1.s | count 1
+declare i32 @llvm.xcore.bitrev(i32)
+
+define i32 @test(i32 %val) {
+ %result = call i32 @llvm.xcore.bitrev(i32 %val)
+ ret i32 %result
+}
diff --git a/test/CodeGen/XCore/cos.ll b/test/CodeGen/XCore/cos.ll
new file mode 100644
index 000000000000..334f0d50561d
--- /dev/null
+++ b/test/CodeGen/XCore/cos.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "bl cosf" %t1.s | count 1
+; RUN: grep "bl cos" %t1.s | count 2
+declare double @llvm.cos.f64(double)
+
+define double @test(double %F) {
+ %result = call double @llvm.cos.f64(double %F)
+ ret double %result
+}
+
+declare float @llvm.cos.f32(float)
+
+define float @testf(float %F) {
+ %result = call float @llvm.cos.f32(float %F)
+ ret float %result
+}
diff --git a/test/CodeGen/XCore/dg.exp b/test/CodeGen/XCore/dg.exp
new file mode 100644
index 000000000000..7110eabb3a53
--- /dev/null
+++ b/test/CodeGen/XCore/dg.exp
@@ -0,0 +1,5 @@
+load_lib llvm.exp
+
+if { [llvm_supports_target XCore] } {
+ RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+}
diff --git a/test/CodeGen/XCore/exp.ll b/test/CodeGen/XCore/exp.ll
new file mode 100644
index 000000000000..8412e7a59956
--- /dev/null
+++ b/test/CodeGen/XCore/exp.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "bl expf" %t1.s | count 1
+; RUN: grep "bl exp" %t1.s | count 2
+declare double @llvm.exp.f64(double)
+
+define double @test(double %F) {
+ %result = call double @llvm.exp.f64(double %F)
+ ret double %result
+}
+
+declare float @llvm.exp.f32(float)
+
+define float @testf(float %F) {
+ %result = call float @llvm.exp.f32(float %F)
+ ret float %result
+}
diff --git a/test/CodeGen/XCore/exp2.ll b/test/CodeGen/XCore/exp2.ll
new file mode 100644
index 000000000000..a53b767ad0d0
--- /dev/null
+++ b/test/CodeGen/XCore/exp2.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "bl exp2f" %t1.s | count 1
+; RUN: grep "bl exp2" %t1.s | count 2
+declare double @llvm.exp2.f64(double)
+
+define double @test(double %F) {
+ %result = call double @llvm.exp2.f64(double %F)
+ ret double %result
+}
+
+declare float @llvm.exp2.f32(float)
+
+define float @testf(float %F) {
+ %result = call float @llvm.exp2.f32(float %F)
+ ret float %result
+}
diff --git a/test/CodeGen/XCore/fneg.ll b/test/CodeGen/XCore/fneg.ll
new file mode 100644
index 000000000000..e4426fd908f3
--- /dev/null
+++ b/test/CodeGen/XCore/fneg.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "xor" %t1.s | count 1
+define i1 @test(double %F) nounwind {
+entry:
+ %0 = sub double -0.000000e+00, %F
+ %1 = fcmp olt double 0.000000e+00, %0
+ ret i1 %1
+}
diff --git a/test/CodeGen/XCore/getid.ll b/test/CodeGen/XCore/getid.ll
new file mode 100644
index 000000000000..810e8ad6e75c
--- /dev/null
+++ b/test/CodeGen/XCore/getid.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "get r11, id" %t1.s | count 1
+declare i32 @llvm.xcore.getid()
+
+define i32 @test() {
+ %result = call i32 @llvm.xcore.getid()
+ ret i32 %result
+}
diff --git a/test/CodeGen/XCore/log.ll b/test/CodeGen/XCore/log.ll
new file mode 100644
index 000000000000..88d9d7ffcd39
--- /dev/null
+++ b/test/CodeGen/XCore/log.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "bl logf" %t1.s | count 1
+; RUN: grep "bl log" %t1.s | count 2
+declare double @llvm.log.f64(double)
+
+define double @test(double %F) {
+ %result = call double @llvm.log.f64(double %F)
+ ret double %result
+}
+
+declare float @llvm.log.f32(float)
+
+define float @testf(float %F) {
+ %result = call float @llvm.log.f32(float %F)
+ ret float %result
+}
diff --git a/test/CodeGen/XCore/log10.ll b/test/CodeGen/XCore/log10.ll
new file mode 100644
index 000000000000..f844d8fc6a24
--- /dev/null
+++ b/test/CodeGen/XCore/log10.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "bl log10f" %t1.s | count 1
+; RUN: grep "bl log10" %t1.s | count 2
+declare double @llvm.log10.f64(double)
+
+define double @test(double %F) {
+ %result = call double @llvm.log10.f64(double %F)
+ ret double %result
+}
+
+declare float @llvm.log10.f32(float)
+
+define float @testf(float %F) {
+ %result = call float @llvm.log10.f32(float %F)
+ ret float %result
+}
diff --git a/test/CodeGen/XCore/log2.ll b/test/CodeGen/XCore/log2.ll
new file mode 100644
index 000000000000..b8a3dbd2317f
--- /dev/null
+++ b/test/CodeGen/XCore/log2.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "bl log2f" %t1.s | count 1
+; RUN: grep "bl log2" %t1.s | count 2
+declare double @llvm.log2.f64(double)
+
+define double @test(double %F) {
+ %result = call double @llvm.log2.f64(double %F)
+ ret double %result
+}
+
+declare float @llvm.log2.f32(float)
+
+define float @testf(float %F) {
+ %result = call float @llvm.log2.f32(float %F)
+ ret float %result
+}
diff --git a/test/CodeGen/XCore/pow.ll b/test/CodeGen/XCore/pow.ll
new file mode 100644
index 000000000000..a7b6318c1091
--- /dev/null
+++ b/test/CodeGen/XCore/pow.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "bl powf" %t1.s | count 1
+; RUN: grep "bl pow" %t1.s | count 2
+declare double @llvm.pow.f64(double, double)
+
+define double @test(double %F, double %power) {
+ %result = call double @llvm.pow.f64(double %F, double %power)
+ ret double %result
+}
+
+declare float @llvm.pow.f32(float, float)
+
+define float @testf(float %F, float %power) {
+ %result = call float @llvm.pow.f32(float %F, float %power)
+ ret float %result
+}
diff --git a/test/CodeGen/XCore/powi.ll b/test/CodeGen/XCore/powi.ll
new file mode 100644
index 000000000000..30e6d7ea88f3
--- /dev/null
+++ b/test/CodeGen/XCore/powi.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "bl __powidf2" %t1.s | count 1
+; RUN: grep "bl __powisf2" %t1.s | count 1
+declare double @llvm.powi.f64(double, i32)
+
+define double @test(double %F, i32 %power) {
+ %result = call double @llvm.powi.f64(double %F, i32 %power)
+ ret double %result
+}
+
+declare float @llvm.powi.f32(float, i32)
+
+define float @testf(float %F, i32 %power) {
+ %result = call float @llvm.powi.f32(float %F, i32 %power)
+ ret float %result
+}
diff --git a/test/CodeGen/XCore/private.ll b/test/CodeGen/XCore/private.ll
new file mode 100644
index 000000000000..888ccdf297d5
--- /dev/null
+++ b/test/CodeGen/XCore/private.ll
@@ -0,0 +1,21 @@
+; Test to make sure that the 'private' is used correctly.
+;
+; RUN: llvm-as < %s | llc -march=xcore > %t
+; RUN: grep .Lfoo: %t
+; RUN: grep bl.*\.Lfoo %t
+; RUN: grep .Lbaz: %t
+; RUN: grep ldw.*\.Lbaz %t
+
+declare void @foo()
+
+define private void @foo() {
+ ret void
+}
+
+@baz = private global i32 4;
+
+define i32 @bar() {
+ call void @foo()
+ %1 = load i32* @baz, align 4
+ ret i32 %1
+}
diff --git a/test/CodeGen/XCore/sin.ll b/test/CodeGen/XCore/sin.ll
new file mode 100644
index 000000000000..41aab675953f
--- /dev/null
+++ b/test/CodeGen/XCore/sin.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "bl sinf" %t1.s | count 1
+; RUN: grep "bl sin" %t1.s | count 2
+declare double @llvm.sin.f64(double)
+
+define double @test(double %F) {
+ %result = call double @llvm.sin.f64(double %F)
+ ret double %result
+}
+
+declare float @llvm.sin.f32(float)
+
+define float @testf(float %F) {
+ %result = call float @llvm.sin.f32(float %F)
+ ret float %result
+}
diff --git a/test/CodeGen/XCore/sqrt.ll b/test/CodeGen/XCore/sqrt.ll
new file mode 100644
index 000000000000..221d1ac1a781
--- /dev/null
+++ b/test/CodeGen/XCore/sqrt.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "bl sqrtf" %t1.s | count 1
+; RUN: grep "bl sqrt" %t1.s | count 2
+declare double @llvm.sqrt.f64(double)
+
+define double @test(double %F) {
+ %result = call double @llvm.sqrt.f64(double %F)
+ ret double %result
+}
+
+declare float @llvm.sqrt.f32(float)
+
+define float @testf(float %F) {
+ %result = call float @llvm.sqrt.f32(float %F)
+ ret float %result
+}
diff --git a/test/CodeGen/XCore/trap.ll b/test/CodeGen/XCore/trap.ll
new file mode 100644
index 000000000000..b3d3bc2270e3
--- /dev/null
+++ b/test/CodeGen/XCore/trap.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; RUN: grep "ecallf" %t1.s | count 1
+; RUN: grep "ldc" %t1.s | count 1
+define i32 @test() noreturn nounwind {
+entry:
+ tail call void @llvm.trap( )
+ unreachable
+}
+
+declare void @llvm.trap() nounwind
+