summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/PIC16
diff options
context:
space:
mode:
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
-rw-r--r--test/CodeGen/PIC16/global-in-user-section.ll5
-rw-r--r--test/CodeGen/PIC16/globals.ll15
-rw-r--r--test/CodeGen/PIC16/sext.ll10
5 files changed, 64 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..d7072dd
--- /dev/null
+++ b/test/CodeGen/PIC16/2009-07-17-PR4566-pic16.ll
@@ -0,0 +1,29 @@
+; RUN: llc < %s -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}]]
+}
diff --git a/test/CodeGen/PIC16/global-in-user-section.ll b/test/CodeGen/PIC16/global-in-user-section.ll
new file mode 100644
index 0000000..74c9d9d
--- /dev/null
+++ b/test/CodeGen/PIC16/global-in-user-section.ll
@@ -0,0 +1,5 @@
+; RUN: llc < %s -march=pic16 | FileCheck %s
+
+@G1 = common global i16 0, section "usersection", align 1
+; CHECK: usersection UDATA
+; CHECK: @G1 RES 2
diff --git a/test/CodeGen/PIC16/globals.ll b/test/CodeGen/PIC16/globals.ll
new file mode 100644
index 0000000..959eb25
--- /dev/null
+++ b/test/CodeGen/PIC16/globals.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -march=pic16 | FileCheck %s
+
+@G1 = global i32 4712, section "Address=412"
+; CHECK: @G1.412.idata.0.# IDATA 412
+; CHECK: @G1 dl 4712
+
+@G2 = global i32 0, section "Address=412"
+; CHECK: @G2.412.udata.0.# UDATA 412
+; CHECK: @G2 RES 4
+
+@G3 = addrspace(1) constant i32 4712, section "Address=412"
+; CHECK: @G3.412.romdata.1.# ROMDATA 412
+; CHECK: @G3 rom_dl 4712
+
+
diff --git a/test/CodeGen/PIC16/sext.ll b/test/CodeGen/PIC16/sext.ll
new file mode 100644
index 0000000..b49925f
--- /dev/null
+++ b/test/CodeGen/PIC16/sext.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s -march=pic16
+
+@main.auto.c = internal global i8 0 ; <i8*> [#uses=1]
+
+define i16 @main() nounwind {
+entry:
+ %tmp = load i8* @main.auto.c ; <i8> [#uses=1]
+ %conv = sext i8 %tmp to i16 ; <i16> [#uses=1]
+ ret i16 %conv
+}
OpenPOWER on IntegriCloud