From 0207e542aff9409c4d1b2abf6fc9e61f3237e697 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Wed, 13 Feb 2008 03:23:53 +0000 Subject: New tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47047 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/X86/coalescer-commute1.ll | 26 ++++++++++++++++++++++++++ test/CodeGen/X86/coalescer-commute2.ll | 21 +++++++++++++++++++++ test/CodeGen/X86/coalescer-commute3.ll | 24 ++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 test/CodeGen/X86/coalescer-commute1.ll create mode 100644 test/CodeGen/X86/coalescer-commute2.ll create mode 100644 test/CodeGen/X86/coalescer-commute3.ll (limited to 'test/CodeGen') diff --git a/test/CodeGen/X86/coalescer-commute1.ll b/test/CodeGen/X86/coalescer-commute1.ll new file mode 100644 index 0000000..6613ac2 --- /dev/null +++ b/test/CodeGen/X86/coalescer-commute1.ll @@ -0,0 +1,26 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -mattr=+sse2 -coalescer-commute-instrs | not grep movaps +; PR1877 + +@NNTOT = weak global i32 0 ; [#uses=1] +@G = weak global float 0.000000e+00 ; [#uses=1] + +define void @runcont(i32* %source) nounwind { +entry: + %tmp10 = load i32* @NNTOT, align 4 ; [#uses=1] + br label %bb + +bb: ; preds = %bb, %entry + %neuron.0 = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; [#uses=2] + %thesum.0 = phi float [ 0.000000e+00, %entry ], [ %tmp6, %bb ] ; [#uses=1] + %tmp2 = getelementptr i32* %source, i32 %neuron.0 ; [#uses=1] + %tmp3 = load i32* %tmp2, align 4 ; [#uses=1] + %tmp34 = sitofp i32 %tmp3 to float ; [#uses=1] + %tmp6 = add float %tmp34, %thesum.0 ; [#uses=2] + %indvar.next = add i32 %neuron.0, 1 ; [#uses=2] + %exitcond = icmp eq i32 %indvar.next, %tmp10 ; [#uses=1] + br i1 %exitcond, label %bb13, label %bb + +bb13: ; preds = %bb + volatile store float %tmp6, float* @G, align 4 + ret void +} diff --git a/test/CodeGen/X86/coalescer-commute2.ll b/test/CodeGen/X86/coalescer-commute2.ll new file mode 100644 index 0000000..f90ab9e --- /dev/null +++ b/test/CodeGen/X86/coalescer-commute2.ll @@ -0,0 +1,21 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -mattr=+sse2 -coalescer-commute-instrs | grep movsd | count 4 + +define i32 @main(i32 %argc, i8** %argv) nounwind { +entry: + br label %bb145.us.i.i + +bb145.us.i.i: ; preds = %bb145.us.i.i, %entry + %seed.3.reg2mem.0.us.i.i = phi double [ 0.000000e+00, %entry ], [ %tmp9.i.us.i.i, %bb145.us.i.i ] ; [#uses=1] + %tmp2.i13.us.i.i = mul double %seed.3.reg2mem.0.us.i.i, 1.680700e+04 ; [#uses=1] + %tmp3.i.us.i.i = add double %tmp2.i13.us.i.i, 1.000000e+00 ; [#uses=1] + %tmp6.i15.us.i.i = call double @floor( double 0.000000e+00 ) nounwind readnone ; [#uses=1] + %tmp7.i16.us.i.i = mul double %tmp6.i15.us.i.i, 0xC1DFFFFFFFC00000 ; [#uses=1] + %tmp9.i.us.i.i = add double %tmp7.i16.us.i.i, %tmp3.i.us.i.i ; [#uses=2] + %tmp5.i12.us.i.i = mul double %tmp9.i.us.i.i, 2.000000e+00 ; [#uses=1] + %tmp6.i.us.i.i = fdiv double %tmp5.i12.us.i.i, 0x41DFFFFFFFC00000 ; [#uses=1] + %tmp8.i.us.i.i = add double %tmp6.i.us.i.i, -1.000000e+00 ; [#uses=1] + store double %tmp8.i.us.i.i, double* null, align 8 + br label %bb145.us.i.i +} + +declare double @floor(double) nounwind readnone diff --git a/test/CodeGen/X86/coalescer-commute3.ll b/test/CodeGen/X86/coalescer-commute3.ll new file mode 100644 index 0000000..57204eb --- /dev/null +++ b/test/CodeGen/X86/coalescer-commute3.ll @@ -0,0 +1,24 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -mattr=+sse2 -coalescer-commute-instrs | grep mov | count 6 + + %struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* } + +define fastcc i32 @perimeter(%struct.quad_struct* %tree, i32 %size) nounwind { +entry: + switch i32 %size, label %UnifiedReturnBlock [ + i32 2, label %bb + i32 0, label %bb50 + ] + +bb: ; preds = %entry + %tmp31 = tail call fastcc i32 @perimeter( %struct.quad_struct* null, i32 0 ) nounwind ; [#uses=1] + %tmp40 = tail call fastcc i32 @perimeter( %struct.quad_struct* null, i32 0 ) nounwind ; [#uses=1] + %tmp33 = add i32 0, %tmp31 ; [#uses=1] + %tmp42 = add i32 %tmp33, %tmp40 ; [#uses=1] + ret i32 %tmp42 + +bb50: ; preds = %entry + ret i32 0 + +UnifiedReturnBlock: ; preds = %entry + ret i32 0 +} -- cgit v1.1