~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to test/Transforms/InstCombine/vec_shuffle.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
  ret <8 x i8> %tmp3
154
154
}
155
155
 
156
 
; We should form a shuffle out of a select with constant condition.
157
 
define <4 x i16> @test13a(<4 x i16> %lhs, <4 x i16> %rhs) {
158
 
; CHECK: @test13a
159
 
; CHECK-NEXT: shufflevector <4 x i16> %lhs, <4 x i16> %rhs, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
160
 
; CHECK-NEXT: ret
161
 
  %A = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>,
162
 
           <4 x i16> %lhs, <4 x i16> %rhs
163
 
  ret <4 x i16> %A
164
 
}
165
 
 
166
 
define <4 x i16> @test13b(<4 x i16> %lhs, <4 x i16> %rhs) {
167
 
; CHECK: @test13b
168
 
; CHECK-NEXT: ret <4 x i16> %lhs
169
 
  %A = select <4 x i1> <i1 true, i1 undef, i1 true, i1 true>,
170
 
           <4 x i16> %lhs, <4 x i16> %rhs
171
 
  ret <4 x i16> %A
172
 
}
173
 
 
174
 
define <4 x i16> @test13c(<4 x i16> %lhs, <4 x i16> %rhs) {
175
 
; CHECK: @test13c
176
 
; CHECK-NEXT: shufflevector <4 x i16> %lhs, <4 x i16> %rhs, <4 x i32> <i32 0, i32 undef, i32 2, i32 7>
177
 
; CHECK-NEXT: ret
178
 
  %A = select <4 x i1> <i1 true, i1 undef, i1 true, i1 false>,
179
 
           <4 x i16> %lhs, <4 x i16> %rhs
180
 
  ret <4 x i16> %A
181
 
}
182
 
 
183
 
define <4 x i16> @test13d(<4 x i16> %lhs, <4 x i16> %rhs) {
184
 
; CHECK: @test13d
185
 
; CHECK: select
186
 
; CHECK-NEXT: ret
187
 
  %A = select <4 x i1> <i1 true, i1 icmp ugt (<4 x i16>(<4 x i16>, <4 x i16>)* @test13a, <4 x i16>(<4 x i16>, <4 x i16>)* @test13b), i1 true, i1 false>,
188
 
           <4 x i16> %lhs, <4 x i16> %rhs
189
 
  ret <4 x i16> %A
190
 
}
191
 
 
192
 
define <4 x i16> @test13e(<4 x i16> %lhs, <4 x i16> %rhs) {
193
 
; CHECK: @test13e
194
 
; CHECK-NEXT: ret <4 x i16> %rhs
195
 
  %A = select <4 x i1> <i1 false, i1 false, i1 false, i1 false>,
196
 
           <4 x i16> %lhs, <4 x i16> %rhs
197
 
  ret <4 x i16> %A
198
 
}
199
 
 
200
 
; Check that sequences of insert/extract element are
201
 
; collapsed into shuffle instruction with correct shuffle indexes.
202
 
 
203
 
define <4 x float> @test14a(<4 x float> %LHS, <4 x float> %RHS) {
204
 
; CHECK: @test14a
205
 
; CHECK-NEXT: shufflevector <4 x float> %LHS, <4 x float> %RHS, <4 x i32> <i32 4, i32 0, i32 6, i32 6>
206
 
; CHECK-NEXT: ret <4 x float> %tmp4
207
 
        %tmp1 = extractelement <4 x float> %LHS, i32 0
208
 
        %tmp2 = insertelement <4 x float> %RHS, float %tmp1, i32 1
209
 
        %tmp3 = extractelement <4 x float> %RHS, i32 2
210
 
        %tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 3
211
 
        ret <4 x float> %tmp4
212
 
}
213
 
 
214
 
define <4 x float> @test14b(<4 x float> %LHS, <4 x float> %RHS) {
215
 
; CHECK: @test14b
216
 
; CHECK-NEXT: shufflevector <4 x float> %LHS, <4 x float> %RHS, <4 x i32> <i32 4, i32 3, i32 6, i32 6>
217
 
; CHECK-NEXT: ret <4 x float> %tmp5
218
 
        %tmp0 = extractelement <4 x float> %LHS, i32 3
219
 
        %tmp1 = insertelement <4 x float> %RHS, float %tmp0, i32 0
220
 
        %tmp2 = extractelement <4 x float> %tmp1, i32 0
221
 
        %tmp3 = insertelement <4 x float> %RHS, float %tmp2, i32 1
222
 
        %tmp4 = extractelement <4 x float> %RHS, i32 2
223
 
        %tmp5 = insertelement <4 x float> %tmp3, float %tmp4, i32 3
224
 
        ret <4 x float> %tmp5
225
 
}