OSDN Git Service

am 0d041145: am 19c6fbb3: Merge "Adds the ability to run the llvm test suite in-tree."
[android-x86/external-llvm.git] / test / CodeGen / AArch64 / arm64-build-vector.ll
1 ; RUN: llc < %s -march=arm64 -aarch64-neon-syntax=apple | FileCheck %s
2
3 ; Check that building up a vector w/ only one non-zero lane initializes
4 ; intelligently.
5 define void @one_lane(i32* nocapture %out_int, i32 %skip0) nounwind {
6 ; CHECK-LABEL: one_lane:
7 ; CHECK: dup.16b v[[REG:[0-9]+]], wzr
8 ; CHECK-NEXT: ins.b v[[REG]][0], w1
9 ; v and q are aliases, and str is preferred against st.16b when possible
10 ; rdar://11246289
11 ; CHECK: str q[[REG]], [x0]
12 ; CHECK: ret
13   %conv = trunc i32 %skip0 to i8
14   %vset_lane = insertelement <16 x i8> <i8 undef, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, i8 %conv, i32 0
15   %tmp = bitcast i32* %out_int to <4 x i32>*
16   %tmp1 = bitcast <16 x i8> %vset_lane to <4 x i32>
17   store <4 x i32> %tmp1, <4 x i32>* %tmp, align 16
18   ret void
19 }
20
21 ; Check that building a vector from floats doesn't insert an unnecessary
22 ; copy for lane zero.
23 define <4 x float>  @foo(float %a, float %b, float %c, float %d) nounwind {
24 ; CHECK-LABEL: foo:
25 ; CHECK-NOT: ins.s v0[0], v0[0]
26 ; CHECK: ins.s v0[1], v1[0]
27 ; CHECK: ins.s v0[2], v2[0]
28 ; CHECK: ins.s v0[3], v3[0]
29 ; CHECK: ret
30   %1 = insertelement <4 x float> undef, float %a, i32 0
31   %2 = insertelement <4 x float> %1, float %b, i32 1
32   %3 = insertelement <4 x float> %2, float %c, i32 2
33   %4 = insertelement <4 x float> %3, float %d, i32 3
34   ret <4 x float> %4
35 }