summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Goodwin <david_goodwin@apple.com>2009-06-26 18:10:30 +0000
committerDavid Goodwin <david_goodwin@apple.com>2009-06-26 18:10:30 +0000
commit2634e98a931b182b7afb9b21e7d41a1d27c49fd2 (patch)
treeb3bbb68722b504048421c356524e2527b8c6626a
parentcb73734247158006a1bd3bf22bc2d5b5597eda53 (diff)
downloadllvm-2634e98a931b182b7afb9b21e7d41a1d27c49fd2.tar.gz
llvm-2634e98a931b182b7afb9b21e7d41a1d27c49fd2.tar.bz2
llvm-2634e98a931b182b7afb9b21e7d41a1d27c49fd2.tar.xz
Add Thumb-2 tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74295 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CodeGen/Thumb2/thumb2-add2.ll38
-rw-r--r--test/CodeGen/Thumb2/thumb2-add3.ll8
-rw-r--r--test/CodeGen/Thumb2/thumb2-add4.ll33
-rw-r--r--test/CodeGen/Thumb2/thumb2-add5.ll6
-rw-r--r--test/CodeGen/Thumb2/thumb2-add6.ll6
-rw-r--r--test/CodeGen/Thumb2/thumb2-bic.ll14
-rw-r--r--test/CodeGen/Thumb2/thumb2-cmp.ll31
-rw-r--r--test/CodeGen/Thumb2/thumb2-cmp2.ll11
-rw-r--r--test/CodeGen/Thumb2/thumb2-mla.ll13
-rw-r--r--test/CodeGen/Thumb2/thumb2-mls.ll14
-rw-r--r--test/CodeGen/Thumb2/thumb2-orn.ll14
-rw-r--r--test/CodeGen/Thumb2/thumb2-rsb.ll9
12 files changed, 195 insertions, 2 deletions
diff --git a/test/CodeGen/Thumb2/thumb2-add2.ll b/test/CodeGen/Thumb2/thumb2-add2.ll
new file mode 100644
index 0000000000..d0ef41d5a1
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-add2.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | llc | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#510} | Count 5
+
+target triple = "thumbv7-apple-darwin"
+
+; 171 = 0x000000ab
+define i32 @f1(i32 %a) {
+ %tmp = add i32 %a, 171
+ ret i32 %tmp
+}
+
+; 1179666 = 0x00120012
+define i32 @f2(i32 %a) {
+ %tmp = add i32 %a, 1179666
+ ret i32 %tmp
+}
+
+; 872428544 = 0x34003400
+define i32 @f3(i32 %a) {
+ %tmp = add i32 %a, 872428544
+ ret i32 %tmp
+}
+
+; 1448498774 = 0x56565656
+define i32 @f4(i32 %a) {
+ %tmp = add i32 %a, 1448498774
+ ret i32 %tmp
+}
+
+; 510 = 0x000001fe
+define i32 @f5(i32 %a) {
+ %tmp = add i32 %a, 510
+ ret i32 %tmp
+}
+
+define i32 @f6(i32 %a) {
+ %tmp = add i32 %a, 4095
+ ret i32 %tmp
+}
diff --git a/test/CodeGen/Thumb2/thumb2-add3.ll b/test/CodeGen/Thumb2/thumb2-add3.ll
new file mode 100644
index 0000000000..9b75b40709
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-add3.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | llc | grep {addw\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#4095} | Count 1
+
+target triple = "thumbv7-apple-darwin"
+
+define i32 @f1(i32 %a) {
+ %tmp = add i32 %a, 4095
+ ret i32 %tmp
+}
diff --git a/test/CodeGen/Thumb2/thumb2-add4.ll b/test/CodeGen/Thumb2/thumb2-add4.ll
new file mode 100644
index 0000000000..bb43acb6d1
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-add4.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | llc | grep {adds\\W*r\[0-9\],\\W*r\[0-9\],\\W*#\[0-9\]*} | grep {#171\\|#1179666\\|#872428544\\|#1448498774\\|#66846720} | Count 5
+
+target triple = "thumbv7-apple-darwin"
+
+; 171 = 0x000000ab
+define i64 @f1(i64 %a) {
+ %tmp = add i64 %a, 171
+ ret i64 %tmp
+}
+
+; 1179666 = 0x00120012
+define i64 @f2(i64 %a) {
+ %tmp = add i64 %a, 1179666
+ ret i64 %tmp
+}
+
+; 872428544 = 0x34003400
+define i64 @f3(i64 %a) {
+ %tmp = add i64 %a, 872428544
+ ret i64 %tmp
+}
+
+; 1448498774 = 0x56565656
+define i64 @f4(i64 %a) {
+ %tmp = add i64 %a, 1448498774
+ ret i64 %tmp
+}
+
+; 66846720 = 0x03fc0000
+define i64 @f5(i64 %a) {
+ %tmp = add i64 %a, 66846720
+ ret i64 %tmp
+}
diff --git a/test/CodeGen/Thumb2/thumb2-add5.ll b/test/CodeGen/Thumb2/thumb2-add5.ll
new file mode 100644
index 0000000000..11219715c2
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-add5.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {add\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | Count 1
+
+define i32 @f1(i32 %a, i32 %b) {
+ %tmp = add i32 %a, %b
+ ret i32 %tmp
+}
diff --git a/test/CodeGen/Thumb2/thumb2-add6.ll b/test/CodeGen/Thumb2/thumb2-add6.ll
new file mode 100644
index 0000000000..7e6b88ec54
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-add6.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {adds\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | Count 1
+
+define i64 @f1(i64 %a, i64 %b) {
+ %tmp = add i64 %a, %b
+ ret i64 %tmp
+}
diff --git a/test/CodeGen/Thumb2/thumb2-bic.ll b/test/CodeGen/Thumb2/thumb2-bic.ll
index 9cae8d3049..ac15ad635b 100644
--- a/test/CodeGen/Thumb2/thumb2-bic.ll
+++ b/test/CodeGen/Thumb2/thumb2-bic.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 2
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {bic\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 4
define i32 @f1(i32 %a, i32 %b) {
%tmp = xor i32 %b, 4294967295
@@ -11,3 +11,15 @@ define i32 @f2(i32 %a, i32 %b) {
%tmp1 = and i32 %tmp, %a
ret i32 %tmp1
}
+
+define i32 @f3(i32 %a, i32 %b) {
+ %tmp = xor i32 4294967295, %b
+ %tmp1 = and i32 %a, %tmp
+ ret i32 %tmp1
+}
+
+define i32 @f4(i32 %a, i32 %b) {
+ %tmp = xor i32 4294967295, %b
+ %tmp1 = and i32 %tmp, %a
+ ret i32 %tmp1
+}
diff --git a/test/CodeGen/Thumb2/thumb2-cmp.ll b/test/CodeGen/Thumb2/thumb2-cmp.ll
new file mode 100644
index 0000000000..56312aa490
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-cmp.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep "cmp " | grep {#187\\|#11141290\\|#3422604288\\|#1114112\\|#3722304989} | Count 5
+
+; 0x000000bb = 187
+define i1 @f1(i32 %a) {
+ %tmp = icmp ne i32 %a, 187
+ ret i1 %tmp
+}
+
+; 0x00aa00aa = 11141290
+define i1 @f2(i32 %a) {
+ %tmp = icmp eq i32 %a, 11141290
+ ret i1 %tmp
+}
+
+; 0xcc00cc00 = 3422604288
+define i1 @f3(i32 %a) {
+ %tmp = icmp ne i32 %a, 3422604288
+ ret i1 %tmp
+}
+
+; 0xdddddddd = 3722304989
+define i1 @f4(i32 %a) {
+ %tmp = icmp ne i32 %a, 3722304989
+ ret i1 %tmp
+}
+
+; 0x00110000 = 1114112
+define i1 @f5(i32 %a) {
+ %tmp = icmp eq i32 %a, 1114112
+ ret i1 %tmp
+}
diff --git a/test/CodeGen/Thumb2/thumb2-cmp2.ll b/test/CodeGen/Thumb2/thumb2-cmp2.ll
new file mode 100644
index 0000000000..c1d90b9487
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-cmp2.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {cmp\\W*r\[0-9\],\\W*r\[0-9\]} | Count 2
+
+define i1 @f1(i32 %a, i32 %b) {
+ %tmp = icmp ne i32 %a, %b
+ ret i1 %tmp
+}
+
+define i1 @f2(i32 %a, i32 %b) {
+ %tmp = icmp eq i32 %a, %b
+ ret i1 %tmp
+}
diff --git a/test/CodeGen/Thumb2/thumb2-mla.ll b/test/CodeGen/Thumb2/thumb2-mla.ll
new file mode 100644
index 0000000000..629495ae05
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-mla.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mla\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | Count 2
+
+define i32 @f1(i32 %a, i32 %b, i32 %c) {
+ %tmp1 = mul i32 %a, %b
+ %tmp2 = add i32 %c, %tmp1
+ ret i32 %tmp2
+}
+
+define i32 @f2(i32 %a, i32 %b, i32 %c) {
+ %tmp1 = mul i32 %a, %b
+ %tmp2 = add i32 %tmp1, %c
+ ret i32 %tmp2
+}
diff --git a/test/CodeGen/Thumb2/thumb2-mls.ll b/test/CodeGen/Thumb2/thumb2-mls.ll
new file mode 100644
index 0000000000..3c26306e41
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-mls.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {mls\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]} | Count 1
+
+define i32 @f1(i32 %a, i32 %b, i32 %c) {
+ %tmp1 = mul i32 %a, %b
+ %tmp2 = sub i32 %c, %tmp1
+ ret i32 %tmp2
+}
+
+; sub doesn't commute, so no mls for this one
+define i32 @f2(i32 %a, i32 %b, i32 %c) {
+ %tmp1 = mul i32 %a, %b
+ %tmp2 = sub i32 %tmp1, %c
+ ret i32 %tmp2
+}
diff --git a/test/CodeGen/Thumb2/thumb2-orn.ll b/test/CodeGen/Thumb2/thumb2-orn.ll
index 9b2802b9f1..1add347ef3 100644
--- a/test/CodeGen/Thumb2/thumb2-orn.ll
+++ b/test/CodeGen/Thumb2/thumb2-orn.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 2
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {orn\\W*r\[0-9\]*,\\W*r\[0-9\]*,\\W*r\[0-9\]*} | count 4
define i32 @f1(i32 %a, i32 %b) {
%tmp = xor i32 %b, 4294967295
@@ -11,3 +11,15 @@ define i32 @f2(i32 %a, i32 %b) {
%tmp1 = or i32 %tmp, %a
ret i32 %tmp1
}
+
+define i32 @f3(i32 %a, i32 %b) {
+ %tmp = xor i32 4294967295, %b
+ %tmp1 = or i32 %a, %tmp
+ ret i32 %tmp1
+}
+
+define i32 @f4(i32 %a, i32 %b) {
+ %tmp = xor i32 4294967295, %b
+ %tmp1 = or i32 %tmp, %a
+ ret i32 %tmp1
+}
diff --git a/test/CodeGen/Thumb2/thumb2-rsb.ll b/test/CodeGen/Thumb2/thumb2-rsb.ll
new file mode 100644
index 0000000000..b3a34514e2
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-rsb.ll
@@ -0,0 +1,9 @@
+; XFAIL: *
+; this will match as "sub" until we get register shifting
+
+; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep {rsb\\W*r\[0-9\],\\W*r\[0-9\],\\W*r\[0-9\]*} | Count 1
+
+define i32 @f1(i32 %a, i32 %b) {
+ %tmp = sub i32 %b, %a
+ ret i32 %tmp
+}