Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -march=x86 -mcpu=generic -mattr=sse4.1 | FileCheck %s
      2 ; RUN: llc < %s -march=x86 -mcpu=atom | FileCheck -check-prefix=ATOM %s
      3 
      4 ; Transpose example using the more generic vector shuffle. Return float8
      5 ; instead of float16
      6 ; ModuleID = 'transpose2_opt.bc'
      7 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
      8 target triple = "i386-apple-cl.1.0"
      9 @r0 = common global <4 x float> zeroinitializer, align 16		; <<4 x float>*> [#uses=1]
     10 @r1 = common global <4 x float> zeroinitializer, align 16		; <<4 x float>*> [#uses=1]
     11 @r2 = common global <4 x float> zeroinitializer, align 16		; <<4 x float>*> [#uses=1]
     12 @r3 = common global <4 x float> zeroinitializer, align 16		; <<4 x float>*> [#uses=1]
     13 
     14 define <8 x float> @__transpose2(<4 x float> %p0, <4 x float> %p1, <4 x float> %p2, <4 x float> %p3) nounwind {
     15 entry:
     16 ; CHECK: transpose2
     17 ; CHECK: unpckhps
     18 ; CHECK: unpckhps
     19 ; CHECK: unpcklps
     20 ; CHECK: unpckhps
     21 ; Different instruction order for Atom.
     22 ; ATOM: transpose2
     23 ; ATOM: unpckhps
     24 ; ATOM: unpckhps
     25 ; ATOM: unpckhps
     26 ; ATOM: unpcklps
     27 	%unpcklps = shufflevector <4 x float> %p0, <4 x float> %p2, <4 x i32> < i32 0, i32 4, i32 1, i32 5 >		; <<4 x float>> [#uses=2]
     28 	%unpckhps = shufflevector <4 x float> %p0, <4 x float> %p2, <4 x i32> < i32 2, i32 6, i32 3, i32 7 >		; <<4 x float>> [#uses=2]
     29 	%unpcklps8 = shufflevector <4 x float> %p1, <4 x float> %p3, <4 x i32> < i32 0, i32 4, i32 1, i32 5 >		; <<4 x float>> [#uses=2]
     30 	%unpckhps11 = shufflevector <4 x float> %p1, <4 x float> %p3, <4 x i32> < i32 2, i32 6, i32 3, i32 7 >		; <<4 x float>> [#uses=2]
     31 	%unpcklps14 = shufflevector <4 x float> %unpcklps, <4 x float> %unpcklps8, <4 x i32> < i32 0, i32 4, i32 1, i32 5 >		; <<4 x float>> [#uses=1]
     32 	%unpckhps17 = shufflevector <4 x float> %unpcklps, <4 x float> %unpcklps8, <4 x i32> < i32 2, i32 6, i32 3, i32 7 >		; <<4 x float>> [#uses=1]
     33         %r1 = shufflevector <4 x float> %unpcklps14,  <4 x float> %unpckhps17,  <8 x i32> < i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7 >
     34 	%unpcklps20 = shufflevector <4 x float> %unpckhps, <4 x float> %unpckhps11, <4 x i32> < i32 0, i32 4, i32 1, i32 5 >		; <<4 x float>> [#uses=1]
     35 	%unpckhps23 = shufflevector <4 x float> %unpckhps, <4 x float> %unpckhps11, <4 x i32> < i32 2, i32 6, i32 3, i32 7 >		; <<4 x float>> [#uses=1]
     36         %r2 = shufflevector <4 x float> %unpcklps20,  <4 x float> %unpckhps23,  <8 x i32> < i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7 >
     37 ;       %r3 = shufflevector <8 x float> %r1,  <8 x float> %r2,  <16 x i32> < i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15 >; 
     38 	ret <8 x float> %r2
     39 }
     40 
     41 define <2 x i64> @lo_hi_shift(float* nocapture %x, float* nocapture %y) nounwind {
     42 entry:
     43 ; movhps should happen before extractps to assure it gets the correct value.
     44 ; CHECK: lo_hi_shift
     45 ; CHECK: movhps ([[BASEREG:%[a-z]+]]),
     46 ; CHECK: extractps ${{[0-9]+}}, %xmm{{[0-9]+}}, {{[0-9]*}}([[BASEREG]])
     47 ; CHECK: extractps ${{[0-9]+}}, %xmm{{[0-9]+}}, {{[0-9]*}}([[BASEREG]])
     48 ; ATOM: lo_hi_shift
     49 ; ATOM: movhps ([[BASEREG:%[a-z]+]]),
     50 ; ATOM: movd %xmm{{[0-9]+}}, {{[0-9]*}}([[BASEREG]])
     51 ; ATOM: movd %xmm{{[0-9]+}}, {{[0-9]*}}([[BASEREG]])
     52   %v.i = bitcast float* %y to <4 x float>*
     53   %0 = load <4 x float>* %v.i, align 1
     54   %1 = bitcast float* %x to <1 x i64>*
     55   %.val = load <1 x i64>* %1, align 1
     56   %2 = bitcast <1 x i64> %.val to <2 x float>
     57   %shuffle.i = shufflevector <2 x float> %2, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
     58   %shuffle1.i = shufflevector <4 x float> %0, <4 x float> %shuffle.i, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
     59   %cast.i = bitcast <4 x float> %0 to <2 x i64>
     60   %extract.i = extractelement <2 x i64> %cast.i, i32 1
     61   %3 = bitcast float* %x to i64*
     62   store i64 %extract.i, i64* %3, align 4
     63   %4 = bitcast <4 x float> %0 to <16 x i8>
     64   %5 = bitcast <4 x float> %shuffle1.i to <16 x i8>
     65   %palignr = shufflevector <16 x i8> %5, <16 x i8> %4, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23>
     66   %6 = bitcast <16 x i8> %palignr to <2 x i64>
     67   ret <2 x i64> %6
     68 }
     69