aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/PIC16
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-07-20 22:02:59 +0000
committerDavid Greene <greened@obbligato.org>2009-07-20 22:02:59 +0000
commit76081c4ef7ac6f085253a4af3af740333b6dfc5b (patch)
treee24f032f85a1533045a2c2df3c5e11dfc6f93d0f /test/CodeGen/PIC16
parent87faa1fc67d0cf4729cad6e8dc63cca0ee8fd51f (diff)
downloadexternal_llvm-76081c4ef7ac6f085253a4af3af740333b6dfc5b.zip
external_llvm-76081c4ef7ac6f085253a4af3af740333b6dfc5b.tar.gz
external_llvm-76081c4ef7ac6f085253a4af3af740333b6dfc5b.tar.bz2
Re-apply 75490, 75806 and 76177 with fixes and tests. Efficiency comes
next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76486 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/PIC16')
-rw-r--r--test/CodeGen/PIC16/2009-07-17-PR4566-pic16.ll29
-rw-r--r--test/CodeGen/PIC16/dg.exp5
2 files changed, 34 insertions, 0 deletions
diff --git a/test/CodeGen/PIC16/2009-07-17-PR4566-pic16.ll b/test/CodeGen/PIC16/2009-07-17-PR4566-pic16.ll
new file mode 100644
index 0000000..aa2c51e
--- /dev/null
+++ b/test/CodeGen/PIC16/2009-07-17-PR4566-pic16.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | llc -march=pic16 | grep {movf \\+@i + 0, \\+W}
+
+target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8-f32:32:32"
+target triple = "pic16-"
+@i = global i32 -10, align 1 ; <i32*> [#uses=1]
+@j = global i32 -20, align 1 ; <i32*> [#uses=1]
+@pc = global i8* inttoptr (i64 160 to i8*), align 1 ; <i8**> [#uses=3]
+@main.auto.k = internal global i32 0 ; <i32*> [#uses=2]
+
+define void @main() nounwind {
+entry:
+ %tmp = load i32* @i ; <i32> [#uses=1]
+ %tmp1 = load i32* @j ; <i32> [#uses=1]
+ %add = add i32 %tmp, %tmp1 ; <i32> [#uses=1]
+ store i32 %add, i32* @main.auto.k
+ %tmp2 = load i32* @main.auto.k ; <i32> [#uses=1]
+ %add3 = add i32 %tmp2, 32 ; <i32> [#uses=1]
+ %conv = trunc i32 %add3 to i8 ; <i8> [#uses=1]
+ %tmp4 = load i8** @pc ; <i8*> [#uses=1]
+ store i8 %conv, i8* %tmp4
+ %tmp5 = load i8** @pc ; <i8*> [#uses=1]
+ %tmp6 = load i8* %tmp5 ; <i8> [#uses=1]
+ %conv7 = sext i8 %tmp6 to i16 ; <i16> [#uses=1]
+ %sub = sub i16 %conv7, 1 ; <i16> [#uses=1]
+ %conv8 = trunc i16 %sub to i8 ; <i8> [#uses=1]
+ %tmp9 = load i8** @pc ; <i8*> [#uses=1]
+ store i8 %conv8, i8* %tmp9
+ ret void
+}
diff --git a/test/CodeGen/PIC16/dg.exp b/test/CodeGen/PIC16/dg.exp
new file mode 100644
index 0000000..b08b985
--- /dev/null
+++ b/test/CodeGen/PIC16/dg.exp
@@ -0,0 +1,5 @@
+load_lib llvm.exp
+
+if { [llvm_supports_target PIC16] } {
+ RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+}