OSDN Git Service

Add Thumb-2 tests.
authorDavid Goodwin <david_goodwin@apple.com>
Fri, 26 Jun 2009 18:10:30 +0000 (18:10 +0000)
committerDavid Goodwin <david_goodwin@apple.com>
Fri, 26 Jun 2009 18:10:30 +0000 (18:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74295 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
test/CodeGen/Thumb2/thumb2-add2.ll [new file with mode: 0644]
test/CodeGen/Thumb2/thumb2-add3.ll [new file with mode: 0644]
test/CodeGen/Thumb2/thumb2-add4.ll [new file with mode: 0644]
test/CodeGen/Thumb2/thumb2-add5.ll [new file with mode: 0644]
test/CodeGen/Thumb2/thumb2-add6.ll [new file with mode: 0644]
test/CodeGen/Thumb2/thumb2-bic.ll
test/CodeGen/Thumb2/thumb2-cmp.ll [new file with mode: 0644]
test/CodeGen/Thumb2/thumb2-cmp2.ll [new file with mode: 0644]
test/CodeGen/Thumb2/thumb2-mla.ll [new file with mode: 0644]
test/CodeGen/Thumb2/thumb2-mls.ll [new file with mode: 0644]
test/CodeGen/Thumb2/thumb2-orn.ll
test/CodeGen/Thumb2/thumb2-rsb.ll [new file with mode: 0644]

diff --git a/test/CodeGen/Thumb2/thumb2-add2.ll b/test/CodeGen/Thumb2/thumb2-add2.ll
new file mode 100644 (file)
index 0000000..d0ef41d
--- /dev/null
@@ -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 (file)
index 0000000..9b75b40
--- /dev/null
@@ -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 (file)
index 0000000..bb43acb
--- /dev/null
@@ -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 (file)
index 0000000..1121971
--- /dev/null
@@ -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 (file)
index 0000000..7e6b88e
--- /dev/null
@@ -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
+}
index 9cae8d3..ac15ad6 100644 (file)
@@ -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 (file)
index 0000000..56312aa
--- /dev/null
@@ -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 (file)
index 0000000..c1d90b9
--- /dev/null
@@ -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 (file)
index 0000000..629495a
--- /dev/null
@@ -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 (file)
index 0000000..3c26306
--- /dev/null
@@ -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
+}
index 9b2802b..1add347 100644 (file)
@@ -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 (file)
index 0000000..b3a3451
--- /dev/null
@@ -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
+}