fd2cc8bdd91c35a9f6203ec074f96015ec35b0bb
[oota-llvm.git] / test / Transforms / BBVectorize / X86 / sh-rec3.ll
1 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
2 target triple = "x86_64-unknown-linux-gnu"
3 ; RUN: opt < %s -basicaa -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -bb-vectorize -S | FileCheck %s
4
5 %struct.gsm_state.2.8.39.44.45.55.56.57.58.59.62.63.64.65.74.75.76.77.80.87.92.93.94.95.96.97.110.111.112.113.114.128.130.135.136.137.138.139.140.141.142.143.144.145.148.149.150.151.152.169.170.177.178.179.184.185.186.187.188.201.208.209.219.220.221.223.224.225.230.231.232.233.235.236.237.238.245.246.248.249.272.274.279.280.281.282.283.286.293.298.299.314.315.316.317.318.319.320.321.322.323.324.325.326.327.328.329.330.331.332.333.334.335.336.337.338.339.340.341.342.343.344.345.346.347.348.349.350.351.352.353.565 = type { [280 x i16], i16, i64, i32, [8 x i16], [2 x [8 x i16]], i16, i16, [9 x i16], i16, i8, i8 }
6
7 define void @gsm_encode(%struct.gsm_state.2.8.39.44.45.55.56.57.58.59.62.63.64.65.74.75.76.77.80.87.92.93.94.95.96.97.110.111.112.113.114.128.130.135.136.137.138.139.140.141.142.143.144.145.148.149.150.151.152.169.170.177.178.179.184.185.186.187.188.201.208.209.219.220.221.223.224.225.230.231.232.233.235.236.237.238.245.246.248.249.272.274.279.280.281.282.283.286.293.298.299.314.315.316.317.318.319.320.321.322.323.324.325.326.327.328.329.330.331.332.333.334.335.336.337.338.339.340.341.342.343.344.345.346.347.348.349.350.351.352.353.565* %s, i16* %source, i8* %c) nounwind uwtable {
8 entry:
9   %LARc28 = alloca [2 x i64], align 16
10   %LARc28.sub = getelementptr inbounds [2 x i64]* %LARc28, i64 0, i64 0
11   %tmpcast = bitcast [2 x i64]* %LARc28 to [8 x i16]*
12   %Nc = alloca [4 x i16], align 2
13   %Mc = alloca [4 x i16], align 2
14   %bc = alloca [4 x i16], align 2
15   %xmc = alloca [52 x i16], align 16
16   %arraydecay = bitcast [2 x i64]* %LARc28 to i16*
17   %arraydecay1 = getelementptr inbounds [4 x i16]* %Nc, i64 0, i64 0
18   %arraydecay2 = getelementptr inbounds [4 x i16]* %bc, i64 0, i64 0
19   %arraydecay3 = getelementptr inbounds [4 x i16]* %Mc, i64 0, i64 0
20   %arraydecay5 = getelementptr inbounds [52 x i16]* %xmc, i64 0, i64 0
21   call void @Gsm_Coder(%struct.gsm_state.2.8.39.44.45.55.56.57.58.59.62.63.64.65.74.75.76.77.80.87.92.93.94.95.96.97.110.111.112.113.114.128.130.135.136.137.138.139.140.141.142.143.144.145.148.149.150.151.152.169.170.177.178.179.184.185.186.187.188.201.208.209.219.220.221.223.224.225.230.231.232.233.235.236.237.238.245.246.248.249.272.274.279.280.281.282.283.286.293.298.299.314.315.316.317.318.319.320.321.322.323.324.325.326.327.328.329.330.331.332.333.334.335.336.337.338.339.340.341.342.343.344.345.346.347.348.349.350.351.352.353.565* %s, i16* %source, i16* %arraydecay, i16* %arraydecay1, i16* %arraydecay2, i16* %arraydecay3, i16* undef, i16* %arraydecay5) nounwind
22   %0 = load i64* %LARc28.sub, align 16
23   %1 = trunc i64 %0 to i32
24   %conv1 = lshr i32 %1, 2
25   %and = and i32 %conv1, 15
26   %or = or i32 %and, 208
27   %conv6 = trunc i32 %or to i8
28   %incdec.ptr = getelementptr inbounds i8* %c, i64 1
29   store i8 %conv6, i8* %c, align 1
30   %conv84 = trunc i64 %0 to i8
31   %and9 = shl i8 %conv84, 6
32   %incdec.ptr15 = getelementptr inbounds i8* %c, i64 2
33   store i8 %and9, i8* %incdec.ptr, align 1
34   %2 = lshr i64 %0, 50
35   %shr226.tr = trunc i64 %2 to i8
36   %conv25 = and i8 %shr226.tr, 7
37   %incdec.ptr26 = getelementptr inbounds i8* %c, i64 3
38   store i8 %conv25, i8* %incdec.ptr15, align 1
39   %incdec.ptr42 = getelementptr inbounds i8* %c, i64 4
40   store i8 0, i8* %incdec.ptr26, align 1
41   %arrayidx52 = getelementptr inbounds [8 x i16]* %tmpcast, i64 0, i64 7
42   %3 = load i16* %arrayidx52, align 2
43   %conv537 = trunc i16 %3 to i8
44   %and54 = and i8 %conv537, 7
45   %incdec.ptr57 = getelementptr inbounds i8* %c, i64 5
46   store i8 %and54, i8* %incdec.ptr42, align 1
47   %incdec.ptr68 = getelementptr inbounds i8* %c, i64 6
48   store i8 0, i8* %incdec.ptr57, align 1
49   %4 = load i16* %arraydecay3, align 2
50   %conv748 = trunc i16 %4 to i8
51   %and75 = shl i8 %conv748, 5
52   %shl76 = and i8 %and75, 96
53   %incdec.ptr84 = getelementptr inbounds i8* %c, i64 7
54   store i8 %shl76, i8* %incdec.ptr68, align 1
55   %arrayidx94 = getelementptr inbounds [52 x i16]* %xmc, i64 0, i64 1
56   %5 = load i16* %arrayidx94, align 2
57   %conv959 = trunc i16 %5 to i8
58   %and96 = shl i8 %conv959, 1
59   %shl97 = and i8 %and96, 14
60   %or103 = or i8 %shl97, 1
61   %incdec.ptr105 = getelementptr inbounds i8* %c, i64 8
62   store i8 %or103, i8* %incdec.ptr84, align 1
63   %arrayidx115 = getelementptr inbounds [52 x i16]* %xmc, i64 0, i64 4
64   %6 = bitcast i16* %arrayidx115 to i32*
65   %7 = load i32* %6, align 8
66   %conv11610 = trunc i32 %7 to i8
67   %and117 = and i8 %conv11610, 7
68   %incdec.ptr120 = getelementptr inbounds i8* %c, i64 9
69   store i8 %and117, i8* %incdec.ptr105, align 1
70   %8 = lshr i32 %7, 16
71   %and12330 = shl nuw nsw i32 %8, 5
72   %and123 = trunc i32 %and12330 to i8
73   %incdec.ptr136 = getelementptr inbounds i8* %c, i64 10
74   store i8 %and123, i8* %incdec.ptr120, align 1
75   %incdec.ptr157 = getelementptr inbounds i8* %c, i64 11
76   store i8 0, i8* %incdec.ptr136, align 1
77   %incdec.ptr172 = getelementptr inbounds i8* %c, i64 12
78   store i8 0, i8* %incdec.ptr157, align 1
79   %arrayidx173 = getelementptr inbounds [4 x i16]* %Nc, i64 0, i64 1
80   %9 = load i16* %arrayidx173, align 2
81   %conv17412 = zext i16 %9 to i32
82   %and175 = shl nuw nsw i32 %conv17412, 1
83   %arrayidx177 = getelementptr inbounds [4 x i16]* %bc, i64 0, i64 1
84   %10 = load i16* %arrayidx177, align 2
85   %conv17826 = zext i16 %10 to i32
86   %shr17913 = lshr i32 %conv17826, 1
87   %and180 = and i32 %shr17913, 1
88   %or181 = or i32 %and175, %and180
89   %conv182 = trunc i32 %or181 to i8
90   %incdec.ptr183 = getelementptr inbounds i8* %c, i64 13
91   store i8 %conv182, i8* %incdec.ptr172, align 1
92   %arrayidx188 = getelementptr inbounds [4 x i16]* %Mc, i64 0, i64 1
93   %11 = load i16* %arrayidx188, align 2
94   %conv18914 = trunc i16 %11 to i8
95   %and190 = shl i8 %conv18914, 5
96   %shl191 = and i8 %and190, 96
97   %incdec.ptr199 = getelementptr inbounds i8* %c, i64 14
98   store i8 %shl191, i8* %incdec.ptr183, align 1
99   %arrayidx209 = getelementptr inbounds [52 x i16]* %xmc, i64 0, i64 14
100   %12 = load i16* %arrayidx209, align 4
101   %conv21015 = trunc i16 %12 to i8
102   %and211 = shl i8 %conv21015, 1
103   %shl212 = and i8 %and211, 14
104   %or218 = or i8 %shl212, 1
105   %incdec.ptr220 = getelementptr inbounds i8* %c, i64 15
106   store i8 %or218, i8* %incdec.ptr199, align 1
107   %arrayidx225 = getelementptr inbounds [52 x i16]* %xmc, i64 0, i64 16
108   %13 = bitcast i16* %arrayidx225 to i64*
109   %14 = load i64* %13, align 16
110   %conv22616 = trunc i64 %14 to i8
111   %and227 = shl i8 %conv22616, 3
112   %shl228 = and i8 %and227, 56
113   %incdec.ptr235 = getelementptr inbounds i8* %c, i64 16
114   store i8 %shl228, i8* %incdec.ptr220, align 1
115   %15 = lshr i64 %14, 32
116   %and23832 = shl nuw nsw i64 %15, 5
117   %and238 = trunc i64 %and23832 to i8
118   %incdec.ptr251 = getelementptr inbounds i8* %c, i64 17
119   store i8 %and238, i8* %incdec.ptr235, align 1
120   %arrayidx266 = getelementptr inbounds [52 x i16]* %xmc, i64 0, i64 23
121   %incdec.ptr272 = getelementptr inbounds i8* %c, i64 18
122   store i8 0, i8* %incdec.ptr251, align 1
123   %16 = load i16* %arrayidx266, align 2
124   %conv27418 = trunc i16 %16 to i8
125   %and275 = shl i8 %conv27418, 6
126   %incdec.ptr287 = getelementptr inbounds i8* %c, i64 19
127   store i8 %and275, i8* %incdec.ptr272, align 1
128   %arrayidx288 = getelementptr inbounds [4 x i16]* %Nc, i64 0, i64 2
129   %17 = load i16* %arrayidx288, align 2
130   %conv28919 = zext i16 %17 to i32
131   %and290 = shl nuw nsw i32 %conv28919, 1
132   %arrayidx292 = getelementptr inbounds [4 x i16]* %bc, i64 0, i64 2
133   %18 = load i16* %arrayidx292, align 2
134   %conv29327 = zext i16 %18 to i32
135   %shr29420 = lshr i32 %conv29327, 1
136   %and295 = and i32 %shr29420, 1
137   %or296 = or i32 %and290, %and295
138   %conv297 = trunc i32 %or296 to i8
139   %incdec.ptr298 = getelementptr inbounds i8* %c, i64 20
140   store i8 %conv297, i8* %incdec.ptr287, align 1
141   %conv30021 = trunc i16 %18 to i8
142   %and301 = shl i8 %conv30021, 7
143   %incdec.ptr314 = getelementptr inbounds i8* %c, i64 21
144   store i8 %and301, i8* %incdec.ptr298, align 1
145   %incdec.ptr335 = getelementptr inbounds i8* %c, i64 22
146   store i8 0, i8* %incdec.ptr314, align 1
147   %arrayidx340 = getelementptr inbounds [52 x i16]* %xmc, i64 0, i64 29
148   %19 = load i16* %arrayidx340, align 2
149   %conv34122 = trunc i16 %19 to i8
150   %and342 = shl i8 %conv34122, 3
151   %shl343 = and i8 %and342, 56
152   %incdec.ptr350 = getelementptr inbounds i8* %c, i64 23
153   store i8 %shl343, i8* %incdec.ptr335, align 1
154   %arrayidx355 = getelementptr inbounds [52 x i16]* %xmc, i64 0, i64 32
155   %20 = bitcast i16* %arrayidx355 to i32*
156   %21 = load i32* %20, align 16
157   %conv35623 = shl i32 %21, 2
158   %shl358 = and i32 %conv35623, 28
159   %22 = lshr i32 %21, 17
160   %and363 = and i32 %22, 3
161   %or364 = or i32 %shl358, %and363
162   %conv365 = trunc i32 %or364 to i8
163   store i8 %conv365, i8* %incdec.ptr350, align 1
164   unreachable
165 ; CHECK: @gsm_encode
166 }
167
168 declare void @Gsm_Coder(%struct.gsm_state.2.8.39.44.45.55.56.57.58.59.62.63.64.65.74.75.76.77.80.87.92.93.94.95.96.97.110.111.112.113.114.128.130.135.136.137.138.139.140.141.142.143.144.145.148.149.150.151.152.169.170.177.178.179.184.185.186.187.188.201.208.209.219.220.221.223.224.225.230.231.232.233.235.236.237.238.245.246.248.249.272.274.279.280.281.282.283.286.293.298.299.314.315.316.317.318.319.320.321.322.323.324.325.326.327.328.329.330.331.332.333.334.335.336.337.338.339.340.341.342.343.344.345.346.347.348.349.350.351.352.353.565*, i16*, i16*, i16*, i16*, i16*, i16*, i16*)
169
170 declare void @llvm.trap() noreturn nounwind