1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Add Thumb-2 tests.

llvm-svn: 74295
This commit is contained in:
David Goodwin 2009-06-26 18:10:30 +00:00
parent 1069071612
commit 4a98908300
12 changed files with 195 additions and 2 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View 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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View 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
}

View File

@ -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
}