1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-eabi -aarch64-neon-syntax=apple | FileCheck %s
4 ; Check that building a vector from floats doesn't insert an unnecessary
6 define <4 x float> @foo(float %a, float %b, float %c, float %d) nounwind {
9 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
10 ; CHECK-NEXT: // kill: def $s1 killed $s1 def $q1
11 ; CHECK-NEXT: // kill: def $s2 killed $s2 def $q2
12 ; CHECK-NEXT: // kill: def $s3 killed $s3 def $q3
13 ; CHECK-NEXT: mov.s v0[1], v1[0]
14 ; CHECK-NEXT: mov.s v0[2], v2[0]
15 ; CHECK-NEXT: mov.s v0[3], v3[0]
17 %1 = insertelement <4 x float> undef, float %a, i32 0
18 %2 = insertelement <4 x float> %1, float %b, i32 1
19 %3 = insertelement <4 x float> %2, float %c, i32 2
20 %4 = insertelement <4 x float> %3, float %d, i32 3
24 define <8 x i16> @build_all_zero(<8 x i16> %a) #1 {
25 ; CHECK-LABEL: build_all_zero:
27 ; CHECK-NEXT: mov w8, #44672
28 ; CHECK-NEXT: fmov s1, w8
29 ; CHECK-NEXT: mul.8h v0, v0, v1
31 %b = add <8 x i16> %a, <i16 -32768, i16 undef, i16 undef, i16 undef, i16 undef, i16 undef, i16 undef, i16 undef>
32 %c = mul <8 x i16> %b, <i16 -20864, i16 undef, i16 undef, i16 undef, i16 undef, i16 undef, i16 undef, i16 undef>
36 ; There is an optimization in DAG Combiner as following:
37 ; fold (concat_vectors (BUILD_VECTOR A, B, ...), (BUILD_VECTOR C, D, ...))
38 ; -> (BUILD_VECTOR A, B, ..., C, D, ...)
39 ; This case checks when A,B and C,D are different types, there should be no
41 define <8 x i16> @concat_2_build_vector(<4 x i16> %in0) {
42 ; CHECK-LABEL: concat_2_build_vector:
44 ; CHECK-NEXT: movi.2d v0, #0000000000000000
46 %vshl_n = shl <4 x i16> %in0, <i16 8, i16 8, i16 8, i16 8>
47 %vshl_n2 = shl <4 x i16> %vshl_n, <i16 9, i16 9, i16 9, i16 9>
48 %shuffle.i = shufflevector <4 x i16> %vshl_n2, <4 x i16> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
49 ret <8 x i16> %shuffle.i
52 ; The lowering of a widened f16 BUILD_VECTOR tries to optimize it by building
53 ; an equivalent integer vector and BITCAST-ing that. This case checks that
54 ; normalizing the vector generates a valid result. The choice of the
55 ; constant prevents earlier passes from replacing the BUILD_VECTOR.
56 define void @widen_f16_build_vector(half* %addr) {
57 ; CHECK-LABEL: widen_f16_build_vector:
59 ; CHECK-NEXT: mov w8, #13294
60 ; CHECK-NEXT: dup.4h v0, w8
61 ; CHECK-NEXT: str s0, [x0]
63 %1 = bitcast half* %addr to <2 x half>*
64 store <2 x half> <half 0xH33EE, half 0xH33EE>, <2 x half>* %1, align 2
68 ; Check that a single element vector is constructed with a mov
69 define <1 x i64> @single_element_vector_i64(<1 x i64> %arg) {
70 ; CHECK-LABEL: single_element_vector_i64:
71 ; CHECK: // %bb.0: // %entry
72 ; CHECK-NEXT: mov w8, #1
73 ; CHECK-NEXT: fmov d1, x8
74 ; CHECK-NEXT: add d0, d0, d1
77 %add = add <1 x i64> %arg, <i64 1>
81 define <1 x double> @single_element_vector_double(<1 x double> %arg) {
82 ; CHECK-LABEL: single_element_vector_double:
83 ; CHECK: // %bb.0: // %entry
84 ; CHECK-NEXT: fmov d1, #1.00000000
85 ; CHECK-NEXT: fadd d0, d0, d1
88 %add = fadd <1 x double> %arg, <double 1.0>