898c470b1726045df7820e08cc1ff32a7f3cf099
[oota-llvm.git] / test / CodeGen / PowerPC / 2007-09-08-unaligned.ll
1 ; RUN: llc < %s | grep stfd | count 3
2 ; RUN: llc < %s | grep stfs | count 1
3 ; RUN: llc < %s | grep lfd | count 2
4 ; RUN: llc < %s | grep lfs | count 2
5 ; ModuleID = 'foo.c'
6 target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
7 target triple = "powerpc-apple-darwin8"
8         %struct.anon = type <{ i8, float }>
9 @s = global %struct.anon <{ i8 3, float 0x4014666660000000 }>           ; <%struct.anon*> [#uses=1]
10 @u = global <{ i8, double }> <{ i8 3, double 5.100000e+00 }>            ; <<{ i8, double }>*> [#uses=1]
11 @t = weak global %struct.anon zeroinitializer           ; <%struct.anon*> [#uses=2]
12 @v = weak global <{ i8, double }> zeroinitializer               ; <<{ i8, double }>*> [#uses=2]
13 @.str = internal constant [8 x i8] c"%f %lf\0A\00"              ; <[8 x i8]*> [#uses=1]
14
15 define i32 @foo() {
16 entry:
17         %retval = alloca i32, align 4           ; <i32*> [#uses=1]
18         %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
19         %tmp = getelementptr %struct.anon* @s, i32 0, i32 1             ; <float*> [#uses=1]
20         %tmp1 = load float* %tmp, align 1               ; <float> [#uses=1]
21         %tmp2 = getelementptr %struct.anon* @t, i32 0, i32 1            ; <float*> [#uses=1]
22         store float %tmp1, float* %tmp2, align 1
23         %tmp3 = getelementptr <{ i8, double }>* @u, i32 0, i32 1                ; <double*> [#uses=1]
24         %tmp4 = load double* %tmp3, align 1             ; <double> [#uses=1]
25         %tmp5 = getelementptr <{ i8, double }>* @v, i32 0, i32 1                ; <double*> [#uses=1]
26         store double %tmp4, double* %tmp5, align 1
27         br label %return
28
29 return:         ; preds = %entry
30         %retval6 = load i32* %retval            ; <i32> [#uses=1]
31         ret i32 %retval6
32 }
33
34 define i32 @main() {
35 entry:
36         %retval = alloca i32, align 4           ; <i32*> [#uses=1]
37         %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
38         %tmp = call i32 @foo( )         ; <i32> [#uses=0]
39         %tmp1 = getelementptr %struct.anon* @t, i32 0, i32 1            ; <float*> [#uses=1]
40         %tmp2 = load float* %tmp1, align 1              ; <float> [#uses=1]
41         %tmp23 = fpext float %tmp2 to double            ; <double> [#uses=1]
42         %tmp4 = getelementptr <{ i8, double }>* @v, i32 0, i32 1                ; <double*> [#uses=1]
43         %tmp5 = load double* %tmp4, align 1             ; <double> [#uses=1]
44         %tmp6 = getelementptr [8 x i8]* @.str, i32 0, i32 0             ; <i8*> [#uses=1]
45         %tmp7 = call i32 (i8*, ...)* @printf( i8* %tmp6, double %tmp23, double %tmp5 )          ; <i32> [#uses=0]
46         br label %return
47
48 return:         ; preds = %entry
49         %retval8 = load i32* %retval            ; <i32> [#uses=1]
50         ret i32 %retval8
51 }
52
53 declare i32 @printf(i8*, ...)