1; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=EG-CHECK %s
2
3;EG-CHECK: @main
4;EG-CHECK: EXPORT T{{[0-9]+}}.XYXX
5;EG-CHECK: EXPORT T{{[0-9]+}}.ZXXX
6;EG-CHECK: EXPORT T{{[0-9]+}}.XXWX
7;EG-CHECK: EXPORT T{{[0-9]+}}.XXXW
8
9define void @main(<4 x float> inreg %reg0, <4 x float> inreg %reg1) #0 {
10main_body:
11  %0 = extractelement <4 x float> %reg1, i32 0
12  %1 = extractelement <4 x float> %reg1, i32 1
13  %2 = extractelement <4 x float> %reg1, i32 2
14  %3 = extractelement <4 x float> %reg1, i32 3
15  %4 = load <4 x float> addrspace(8)* null
16  %5 = extractelement <4 x float> %4, i32 1
17  %6 = load <4 x float> addrspace(8)* null
18  %7 = extractelement <4 x float> %6, i32 2
19  %8 = load <4 x float> addrspace(8)* null
20  %9 = extractelement <4 x float> %8, i32 0
21  %10 = fmul float 0.000000e+00, %9
22  %11 = load <4 x float> addrspace(8)* null
23  %12 = extractelement <4 x float> %11, i32 0
24  %13 = fmul float %5, %12
25  %14 = load <4 x float> addrspace(8)* null
26  %15 = extractelement <4 x float> %14, i32 0
27  %16 = fmul float 0.000000e+00, %15
28  %17 = load <4 x float> addrspace(8)* null
29  %18 = extractelement <4 x float> %17, i32 0
30  %19 = fmul float 0.000000e+00, %18
31  %20 = load <4 x float> addrspace(8)* null
32  %21 = extractelement <4 x float> %20, i32 0
33  %22 = fmul float %7, %21
34  %23 = load <4 x float> addrspace(8)* null
35  %24 = extractelement <4 x float> %23, i32 0
36  %25 = fmul float 0.000000e+00, %24
37  %26 = load <4 x float> addrspace(8)* null
38  %27 = extractelement <4 x float> %26, i32 0
39  %28 = fmul float 0.000000e+00, %27
40  %29 = load <4 x float> addrspace(8)* null
41  %30 = extractelement <4 x float> %29, i32 0
42  %31 = fmul float 0.000000e+00, %30
43  %32 = load <4 x float> addrspace(8)* null
44  %33 = extractelement <4 x float> %32, i32 0
45  %34 = fmul float 0.000000e+00, %33
46  %35 = load <4 x float> addrspace(8)* null
47  %36 = extractelement <4 x float> %35, i32 0
48  %37 = fmul float 0.000000e+00, %36
49  %38 = load <4 x float> addrspace(8)* null
50  %39 = extractelement <4 x float> %38, i32 0
51  %40 = fmul float 1.000000e+00, %39
52  %41 = load <4 x float> addrspace(8)* null
53  %42 = extractelement <4 x float> %41, i32 0
54  %43 = fmul float 0.000000e+00, %42
55  %44 = load <4 x float> addrspace(8)* null
56  %45 = extractelement <4 x float> %44, i32 0
57  %46 = fmul float 0.000000e+00, %45
58  %47 = load <4 x float> addrspace(8)* null
59  %48 = extractelement <4 x float> %47, i32 0
60  %49 = fmul float 0.000000e+00, %48
61  %50 = load <4 x float> addrspace(8)* null
62  %51 = extractelement <4 x float> %50, i32 0
63  %52 = fmul float 0.000000e+00, %51
64  %53 = load <4 x float> addrspace(8)* null
65  %54 = extractelement <4 x float> %53, i32 0
66  %55 = fmul float 1.000000e+00, %54
67  %56 = insertelement <4 x float> undef, float %0, i32 0
68  %57 = insertelement <4 x float> %56, float %1, i32 1
69  %58 = insertelement <4 x float> %57, float %2, i32 2
70  %59 = insertelement <4 x float> %58, float %3, i32 3
71  call void @llvm.R600.store.swizzle(<4 x float> %59, i32 60, i32 1)
72  %60 = insertelement <4 x float> undef, float %10, i32 0
73  %61 = insertelement <4 x float> %60, float %13, i32 1
74  %62 = insertelement <4 x float> %61, float %16, i32 2
75  %63 = insertelement <4 x float> %62, float %19, i32 3
76  call void @llvm.R600.store.swizzle(<4 x float> %63, i32 0, i32 2)
77  %64 = insertelement <4 x float> undef, float %22, i32 0
78  %65 = insertelement <4 x float> %64, float %25, i32 1
79  %66 = insertelement <4 x float> %65, float %28, i32 2
80  %67 = insertelement <4 x float> %66, float %31, i32 3
81  call void @llvm.R600.store.swizzle(<4 x float> %67, i32 1, i32 2)
82  %68 = insertelement <4 x float> undef, float %34, i32 0
83  %69 = insertelement <4 x float> %68, float %37, i32 1
84  %70 = insertelement <4 x float> %69, float %40, i32 2
85  %71 = insertelement <4 x float> %70, float %43, i32 3
86  call void @llvm.R600.store.swizzle(<4 x float> %71, i32 2, i32 2)
87  %72 = insertelement <4 x float> undef, float %46, i32 0
88  %73 = insertelement <4 x float> %72, float %49, i32 1
89  %74 = insertelement <4 x float> %73, float %52, i32 2
90  %75 = insertelement <4 x float> %74, float %55, i32 3
91  call void @llvm.R600.store.swizzle(<4 x float> %75, i32 3, i32 2)
92  ret void
93}
94
95; EG-CHECK: @main2
96; EG-CHECK: T{{[0-9]+}}.XY__
97; EG-CHECK: T{{[0-9]+}}.YXZ0
98
99define void @main2(<4 x float> inreg %reg0, <4 x float> inreg %reg1) #0 {
100main_body:
101  %0 = extractelement <4 x float> %reg1, i32 0
102  %1 = extractelement <4 x float> %reg1, i32 1
103  %2 = fadd float %0, 2.5
104  %3 = fmul float %1, 3.5
105  %4 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
106  %5 = extractelement <4 x float> %4, i32 0
107  %6 = call float @llvm.cos.f32(float %5)
108  %7 = load <4 x float> addrspace(8)* null
109  %8 = extractelement <4 x float> %7, i32 0
110  %9 = load <4 x float> addrspace(8)* null
111  %10 = extractelement <4 x float> %9, i32 1
112  %11 = insertelement <4 x float> undef, float %2, i32 0
113  %12 = insertelement <4 x float> %11, float %3, i32 1
114  call void @llvm.R600.store.swizzle(<4 x float> %12, i32 60, i32 1)
115  %13 = insertelement <4 x float> undef, float %6, i32 0
116  %14 = insertelement <4 x float> %13, float %8, i32 1
117  %15 = insertelement <4 x float> %14, float %10, i32 2
118  %16 = insertelement <4 x float> %15, float 0.000000e+00, i32 3
119  call void @llvm.R600.store.swizzle(<4 x float> %16, i32 0, i32 2)
120  ret void
121}
122
123; Function Attrs: nounwind readonly
124declare float @llvm.cos.f32(float) #1
125
126declare void @llvm.R600.store.swizzle(<4 x float>, i32, i32)
127
128attributes #0 = { "ShaderType"="1" }
129attributes #1 = { nounwind readonly }
130