forked from OSchip/llvm-project
38 lines
1.2 KiB
LLVM
38 lines
1.2 KiB
LLVM
; RUN: opt -S -instcombine %s | FileCheck %s
|
|
|
|
define <1 x i8> @test1(<8 x i8> %in) {
|
|
; CHECK-LABEL: @test1
|
|
; CHECK: shufflevector <8 x i8> %in, <8 x i8> undef, <1 x i32> <i32 5>
|
|
%val = extractelement <8 x i8> %in, i32 5
|
|
%vec = insertelement <1 x i8> undef, i8 %val, i32 0
|
|
ret <1 x i8> %vec
|
|
}
|
|
|
|
define <4 x i16> @test2(<8 x i16> %in, <8 x i16> %in2) {
|
|
; CHECK-LABEL: @test2
|
|
; CHECK: shufflevector <8 x i16> %in2, <8 x i16> %in, <4 x i32> <i32 11, i32 9, i32 0, i32 10>
|
|
%elt0 = extractelement <8 x i16> %in, i32 3
|
|
%elt1 = extractelement <8 x i16> %in, i32 1
|
|
%elt2 = extractelement <8 x i16> %in2, i32 0
|
|
%elt3 = extractelement <8 x i16> %in, i32 2
|
|
|
|
%vec.0 = insertelement <4 x i16> undef, i16 %elt0, i32 0
|
|
%vec.1 = insertelement <4 x i16> %vec.0, i16 %elt1, i32 1
|
|
%vec.2 = insertelement <4 x i16> %vec.1, i16 %elt2, i32 2
|
|
%vec.3 = insertelement <4 x i16> %vec.2, i16 %elt3, i32 3
|
|
|
|
ret <4 x i16> %vec.3
|
|
}
|
|
|
|
define <2 x i64> @test_vcopyq_lane_p64(<2 x i64> %a, <1 x i64> %b) #0 {
|
|
; CHECK-LABEL: @test_vcopyq_lane_p64
|
|
; CHECK: extractelement
|
|
; CHECK: insertelement
|
|
; CHECK-NOT: shufflevector
|
|
entry:
|
|
%elt = extractelement <1 x i64> %b, i32 0
|
|
%res = insertelement <2 x i64> %a, i64 %elt, i32 1
|
|
ret <2 x i64> %res
|
|
}
|
|
|