diff options
Diffstat (limited to 'test/CodeGen/PIC16')
-rw-r--r-- | test/CodeGen/PIC16/2009-07-17-PR4566-pic16.ll | 31 | ||||
-rw-r--r-- | test/CodeGen/PIC16/2009-11-20-NewNode.ll | 36 | ||||
-rw-r--r-- | test/CodeGen/PIC16/C16-11.ll | 37 | ||||
-rw-r--r-- | test/CodeGen/PIC16/C16-15.ll | 44 | ||||
-rw-r--r-- | test/CodeGen/PIC16/C16-49.ll | 15 | ||||
-rw-r--r-- | test/CodeGen/PIC16/check_inc_files.ll | 9 | ||||
-rw-r--r-- | test/CodeGen/PIC16/dg.exp | 5 | ||||
-rw-r--r-- | test/CodeGen/PIC16/global-in-user-section.ll | 5 | ||||
-rw-r--r-- | test/CodeGen/PIC16/globals.ll | 17 | ||||
-rw-r--r-- | test/CodeGen/PIC16/result_direction.ll | 13 | ||||
-rw-r--r-- | test/CodeGen/PIC16/sext.ll | 10 | ||||
-rw-r--r-- | test/CodeGen/PIC16/test_indf_name.ll | 12 |
12 files changed, 234 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..b508026 --- /dev/null +++ b/test/CodeGen/PIC16/2009-07-17-PR4566-pic16.ll @@ -0,0 +1,31 @@ +; RUN: llc < %s -march=pic16 | FileCheck %s + +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 +} + +; CHECK: movf @i + 0, W diff --git a/test/CodeGen/PIC16/2009-11-20-NewNode.ll b/test/CodeGen/PIC16/2009-11-20-NewNode.ll new file mode 100644 index 0000000..d68f0f4 --- /dev/null +++ b/test/CodeGen/PIC16/2009-11-20-NewNode.ll @@ -0,0 +1,36 @@ +; RUN: llc -march=pic16 < %s +; PR5558 + +define i64 @_strtoll_r(i16 %base) nounwind { +entry: + br i1 undef, label %if.then, label %if.end27 + +if.then: ; preds = %do.end + br label %if.end27 + +if.end27: ; preds = %if.then, %do.end + %cond66 = select i1 undef, i64 -9223372036854775808, i64 9223372036854775807 ; <i64> [#uses=3] + %conv69 = sext i16 %base to i64 ; <i64> [#uses=1] + %div = udiv i64 %cond66, %conv69 ; <i64> [#uses=1] + br label %for.cond + +for.cond: ; preds = %if.end116, %if.end27 + br i1 undef, label %if.then152, label %if.then93 + +if.then93: ; preds = %for.cond + br i1 undef, label %if.end116, label %if.then152 + +if.end116: ; preds = %if.then93 + %cmp123 = icmp ugt i64 undef, %div ; <i1> [#uses=1] + %or.cond = or i1 undef, %cmp123 ; <i1> [#uses=0] + br label %for.cond + +if.then152: ; preds = %if.then93, %for.cond + br i1 undef, label %if.end182, label %if.then172 + +if.then172: ; preds = %if.then152 + ret i64 %cond66 + +if.end182: ; preds = %if.then152 + ret i64 %cond66 +} diff --git a/test/CodeGen/PIC16/C16-11.ll b/test/CodeGen/PIC16/C16-11.ll new file mode 100644 index 0000000..e70092b --- /dev/null +++ b/test/CodeGen/PIC16/C16-11.ll @@ -0,0 +1,37 @@ +;RUN: llc < %s -march=pic16 + +@c612.auto.a.b = internal global i1 false ; <i1*> [#uses=2] +@c612.auto.A.b = internal global i1 false ; <i1*> [#uses=2] + +define void @c612() nounwind { +entry: + %tmp3.b = load i1* @c612.auto.a.b ; <i1> [#uses=1] + %tmp3 = zext i1 %tmp3.b to i16 ; <i16> [#uses=1] + %tmp4.b = load i1* @c612.auto.A.b ; <i1> [#uses=1] + %tmp4 = select i1 %tmp4.b, i16 2, i16 0 ; <i16> [#uses=1] + %cmp5 = icmp ne i16 %tmp3, %tmp4 ; <i1> [#uses=1] + %conv7 = zext i1 %cmp5 to i8 ; <i8> [#uses=1] + tail call void @expectWrap(i8 %conv7, i8 2) + ret void +} + +define void @expectWrap(i8 %boolresult, i8 %errCode) nounwind { +entry: + %tobool = icmp eq i8 %boolresult, 0 ; <i1> [#uses=1] + br i1 %tobool, label %if.then, label %if.end + +if.then: ; preds = %entry + tail call void @exit(i16 1) + unreachable + +if.end: ; preds = %entry + ret void +} + +define i16 @main() nounwind { +entry: + tail call void @c612() + ret i16 0 +} + +declare void @exit(i16) noreturn nounwind diff --git a/test/CodeGen/PIC16/C16-15.ll b/test/CodeGen/PIC16/C16-15.ll new file mode 100644 index 0000000..2e1dc0c --- /dev/null +++ b/test/CodeGen/PIC16/C16-15.ll @@ -0,0 +1,44 @@ +; RUN: llc < %s -march=pic16 | grep "extern @.lib.unordered.f32" | count 3 + +@pc = global i8* inttoptr (i64 160 to i8*), align 1 ; <i8**> [#uses=2] +@aa = common global i16 0, align 1 ; <i16*> [#uses=0] +@c6214.auto.d = internal global float 0.000000e+00, align 4 ; <float*> [#uses=1] +@c6214.auto.l = internal global float 0.000000e+00, align 4 ; <float*> [#uses=1] + +define float @dvalue(float %f) nounwind { +entry: + ret float %f +} + +define void @_assert(i16 %line, i16 %result) nounwind { +entry: + %add = add i16 %line, %result ; <i16> [#uses=1] + %conv = trunc i16 %add to i8 ; <i8> [#uses=1] + %tmp2 = load i8** @pc ; <i8*> [#uses=1] + store i8 %conv, i8* %tmp2 + ret void +} + +define i16 @main() nounwind { +entry: + %retval = alloca i16, align 1 ; <i16*> [#uses=2] + store i16 0, i16* %retval + call void @c6214() + %0 = load i16* %retval ; <i16> [#uses=1] + ret i16 %0 +} + +define internal void @c6214() nounwind { +entry: + %call = call float @dvalue(float 0x3FF3C0CA40000000) ; <float> [#uses=3] + store float %call, float* @c6214.auto.d + store float %call, float* @c6214.auto.l + %cmp = fcmp ord float %call, 0.000000e+00 ; <i1> [#uses=1] + %conv = zext i1 %cmp to i16 ; <i16> [#uses=1] + call void @_assert(i16 10, i16 %conv) + %tmp3 = load i8** @pc ; <i8*> [#uses=2] + %tmp4 = load i8* %tmp3 ; <i8> [#uses=1] + %sub = add i8 %tmp4, -10 ; <i8> [#uses=1] + store i8 %sub, i8* %tmp3 + ret void +} diff --git a/test/CodeGen/PIC16/C16-49.ll b/test/CodeGen/PIC16/C16-49.ll new file mode 100644 index 0000000..e59800b --- /dev/null +++ b/test/CodeGen/PIC16/C16-49.ll @@ -0,0 +1,15 @@ +;RUN: llvm-as < %s | llc -march=pic16 + +@aa = global i16 55, align 1 ; <i16*> [#uses=1] +@bb = global i16 44, align 1 ; <i16*> [#uses=1] +@PORTD = external global i8 ; <i8*> [#uses=1] + +define void @foo() nounwind { +entry: + %tmp = volatile load i16* @aa ; <i16> [#uses=1] + %tmp1 = volatile load i16* @bb ; <i16> [#uses=1] + %sub = sub i16 %tmp, %tmp1 ; <i16> [#uses=1] + %conv = trunc i16 %sub to i8 ; <i8> [#uses=1] + store i8 %conv, i8* @PORTD + ret void +} diff --git a/test/CodeGen/PIC16/check_inc_files.ll b/test/CodeGen/PIC16/check_inc_files.ll new file mode 100644 index 0000000..436d416 --- /dev/null +++ b/test/CodeGen/PIC16/check_inc_files.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llc -march=pic16 | FileCheck %s + +;CHECK: #include p16f1xxx.inc +;CHECK: #include stdmacros.inc + +define void @foo() nounwind { +entry: + 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..432c291 --- /dev/null +++ b/test/CodeGen/PIC16/globals.ll @@ -0,0 +1,17 @@ +; RUN: llc < %s -march=pic16 | FileCheck %s + +@G1 = global i32 4712, section "Address=412" +; CHECK: @G1.412..user_section.# IDATA 412 +; CHECK: @G1 +; CHECK: dl 4712 + +@G2 = global i32 0, section "Address=412" +; CHECK: @G2.412..user_section.# UDATA 412 +; CHECK: @G2 RES 4 + +@G3 = addrspace(1) constant i32 4712, section "Address=412" +; CHECK: @G3.412..user_section.# ROMDATA 412 +; CHECK: @G3 +; CHECK: rom_dl 4712 + + diff --git a/test/CodeGen/PIC16/result_direction.ll b/test/CodeGen/PIC16/result_direction.ll new file mode 100644 index 0000000..8549e21 --- /dev/null +++ b/test/CodeGen/PIC16/result_direction.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -march=pic16 | FileCheck %s + +@a = common global i16 0, align 1 ; <i16*> [#uses=2] + +define void @foo() nounwind { +entry: + %tmp = load i16* @a ; <i16> [#uses=1] + %add = add nsw i16 %tmp, 1 ; <i16> [#uses=1] + store i16 %add, i16* @a +;CHECK: movlw 1 +;CHECK: addwf @a + 0, F + ret void +} 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 +} diff --git a/test/CodeGen/PIC16/test_indf_name.ll b/test/CodeGen/PIC16/test_indf_name.ll new file mode 100644 index 0000000..d52fc11 --- /dev/null +++ b/test/CodeGen/PIC16/test_indf_name.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llc -march=pic16 | FileCheck %s + +@pi = common global i16* null, align 1 ; <i16**> [#uses=1] + +define void @foo() nounwind { +entry: + %tmp = load i16** @pi ; <i16*> [#uses=1] + store i16 1, i16* %tmp +; CHECK: movwi {{[0-1]}}[INDF{{[0-1]}}] +; CHECK: movwi {{[0-1]}}[INDF{{[0-1]}}] + ret void +} |