Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt -S -instcombine %s | FileCheck %s
      2 
      3 define <1 x i8> @test1(<8 x i8> %in) {
      4 ; CHECK-LABEL: @test1
      5 ; CHECK: shufflevector <8 x i8> %in, <8 x i8> undef, <1 x i32> <i32 5>
      6   %val = extractelement <8 x i8> %in, i32 5
      7   %vec = insertelement <1 x i8> undef, i8 %val, i32 0
      8   ret <1 x i8> %vec
      9 }
     10 
     11 define <4 x i16> @test2(<8 x i16> %in, <8 x i16> %in2) {
     12 ; CHECK-LABEL: @test2
     13 ; CHECK: shufflevector <8 x i16> %in2, <8 x i16> %in, <4 x i32> <i32 11, i32 9, i32 0, i32 10>
     14   %elt0 = extractelement <8 x i16> %in, i32 3
     15   %elt1 = extractelement <8 x i16> %in, i32 1
     16   %elt2 = extractelement <8 x i16> %in2, i32 0
     17   %elt3 = extractelement <8 x i16> %in, i32 2
     18 
     19   %vec.0 = insertelement <4 x i16> undef, i16 %elt0, i32 0
     20   %vec.1 = insertelement <4 x i16> %vec.0, i16 %elt1, i32 1
     21   %vec.2 = insertelement <4 x i16> %vec.1, i16 %elt2, i32 2
     22   %vec.3 = insertelement <4 x i16> %vec.2, i16 %elt3, i32 3
     23 
     24   ret <4 x i16> %vec.3
     25 }
     26 
     27 define <2 x i64> @test_vcopyq_lane_p64(<2 x i64> %a, <1 x i64> %b) #0 {
     28 ; CHECK-LABEL: @test_vcopyq_lane_p64
     29 ; CHECK: extractelement
     30 ; CHECK: insertelement
     31 ; CHECK-NOT: shufflevector
     32 entry:
     33   %elt = extractelement <1 x i64> %b, i32 0
     34   %res = insertelement <2 x i64> %a, i64 %elt, i32 1
     35   ret <2 x i64> %res
     36 }
     37 
     38