blob: a616a98a25a2e878e1f933b6ef58e69ea49b424e [file] [log] [blame]
Dan Gohmanfce288f2009-09-09 00:09:15 +00001; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s
Bob Wilson9b600c62009-08-06 00:38:31 +00002
Bob Wilsonec1d81c2009-10-06 21:16:19 +00003%struct.__neon_int8x8x4_t = type { <8 x i8>, <8 x i8>, <8 x i8>, <8 x i8> }
4%struct.__neon_int16x4x4_t = type { <4 x i16>, <4 x i16>, <4 x i16>, <4 x i16> }
5%struct.__neon_int32x2x4_t = type { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> }
6%struct.__neon_float32x2x4_t = type { <2 x float>, <2 x float>, <2 x float>, <2 x float> }
Bob Wilson0ea38bb2009-10-07 23:54:04 +00007%struct.__neon_int64x1x4_t = type { <1 x i64>, <1 x i64>, <1 x i64>, <1 x i64> }
Bob Wilson9b600c62009-08-06 00:38:31 +00008
Bob Wilson7708c222009-10-07 18:09:32 +00009%struct.__neon_int8x16x4_t = type { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> }
10%struct.__neon_int16x8x4_t = type { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> }
11%struct.__neon_int32x4x4_t = type { <4 x i32>, <4 x i32>, <4 x i32>, <4 x i32> }
12%struct.__neon_float32x4x4_t = type { <4 x float>, <4 x float>, <4 x float>, <4 x float> }
13
Bob Wilson9b600c62009-08-06 00:38:31 +000014define <8 x i8> @vld4i8(i8* %A) nounwind {
15;CHECK: vld4i8:
Bob Wilson40ff01a2010-09-23 21:43:54 +000016;Check the alignment value. Max for this instruction is 256 bits:
Bob Wilson7d247052010-10-08 06:15:13 +000017;CHECK: vld4.8 {d16, d17, d18, d19}, [r0, :64]
Bob Wilson40ff01a2010-09-23 21:43:54 +000018 %tmp1 = call %struct.__neon_int8x8x4_t @llvm.arm.neon.vld4.v8i8(i8* %A, i32 8)
Bob Wilsonec1d81c2009-10-06 21:16:19 +000019 %tmp2 = extractvalue %struct.__neon_int8x8x4_t %tmp1, 0
20 %tmp3 = extractvalue %struct.__neon_int8x8x4_t %tmp1, 2
Bob Wilson9b600c62009-08-06 00:38:31 +000021 %tmp4 = add <8 x i8> %tmp2, %tmp3
22 ret <8 x i8> %tmp4
23}
24
25define <4 x i16> @vld4i16(i16* %A) nounwind {
26;CHECK: vld4i16:
Bob Wilson40ff01a2010-09-23 21:43:54 +000027;Check the alignment value. Max for this instruction is 256 bits:
Bob Wilson7d247052010-10-08 06:15:13 +000028;CHECK: vld4.16 {d16, d17, d18, d19}, [r0, :128]
Bob Wilson02170c02010-04-20 00:17:16 +000029 %tmp0 = bitcast i16* %A to i8*
Bob Wilson40ff01a2010-09-23 21:43:54 +000030 %tmp1 = call %struct.__neon_int16x4x4_t @llvm.arm.neon.vld4.v4i16(i8* %tmp0, i32 16)
Bob Wilsonec1d81c2009-10-06 21:16:19 +000031 %tmp2 = extractvalue %struct.__neon_int16x4x4_t %tmp1, 0
32 %tmp3 = extractvalue %struct.__neon_int16x4x4_t %tmp1, 2
Bob Wilson9b600c62009-08-06 00:38:31 +000033 %tmp4 = add <4 x i16> %tmp2, %tmp3
34 ret <4 x i16> %tmp4
35}
36
37define <2 x i32> @vld4i32(i32* %A) nounwind {
38;CHECK: vld4i32:
Bob Wilson40ff01a2010-09-23 21:43:54 +000039;Check the alignment value. Max for this instruction is 256 bits:
Bob Wilson7d247052010-10-08 06:15:13 +000040;CHECK: vld4.32 {d16, d17, d18, d19}, [r0, :256]
Bob Wilson02170c02010-04-20 00:17:16 +000041 %tmp0 = bitcast i32* %A to i8*
Bob Wilson40ff01a2010-09-23 21:43:54 +000042 %tmp1 = call %struct.__neon_int32x2x4_t @llvm.arm.neon.vld4.v2i32(i8* %tmp0, i32 32)
Bob Wilsonec1d81c2009-10-06 21:16:19 +000043 %tmp2 = extractvalue %struct.__neon_int32x2x4_t %tmp1, 0
44 %tmp3 = extractvalue %struct.__neon_int32x2x4_t %tmp1, 2
Bob Wilson9b600c62009-08-06 00:38:31 +000045 %tmp4 = add <2 x i32> %tmp2, %tmp3
46 ret <2 x i32> %tmp4
47}
48
49define <2 x float> @vld4f(float* %A) nounwind {
50;CHECK: vld4f:
51;CHECK: vld4.32
Bob Wilson02170c02010-04-20 00:17:16 +000052 %tmp0 = bitcast float* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +000053 %tmp1 = call %struct.__neon_float32x2x4_t @llvm.arm.neon.vld4.v2f32(i8* %tmp0, i32 1)
Bob Wilsonec1d81c2009-10-06 21:16:19 +000054 %tmp2 = extractvalue %struct.__neon_float32x2x4_t %tmp1, 0
55 %tmp3 = extractvalue %struct.__neon_float32x2x4_t %tmp1, 2
Dan Gohmand4d01152010-05-03 22:36:46 +000056 %tmp4 = fadd <2 x float> %tmp2, %tmp3
Bob Wilson9b600c62009-08-06 00:38:31 +000057 ret <2 x float> %tmp4
58}
59
Bob Wilson0ea38bb2009-10-07 23:54:04 +000060define <1 x i64> @vld4i64(i64* %A) nounwind {
61;CHECK: vld4i64:
Bob Wilson40ff01a2010-09-23 21:43:54 +000062;Check the alignment value. Max for this instruction is 256 bits:
Bob Wilson7d247052010-10-08 06:15:13 +000063;CHECK: vld1.64 {d16, d17, d18, d19}, [r0, :256]
Bob Wilson02170c02010-04-20 00:17:16 +000064 %tmp0 = bitcast i64* %A to i8*
Bob Wilson40ff01a2010-09-23 21:43:54 +000065 %tmp1 = call %struct.__neon_int64x1x4_t @llvm.arm.neon.vld4.v1i64(i8* %tmp0, i32 64)
Bob Wilson0ea38bb2009-10-07 23:54:04 +000066 %tmp2 = extractvalue %struct.__neon_int64x1x4_t %tmp1, 0
67 %tmp3 = extractvalue %struct.__neon_int64x1x4_t %tmp1, 2
68 %tmp4 = add <1 x i64> %tmp2, %tmp3
69 ret <1 x i64> %tmp4
70}
71
Bob Wilson7708c222009-10-07 18:09:32 +000072define <16 x i8> @vld4Qi8(i8* %A) nounwind {
73;CHECK: vld4Qi8:
Bob Wilson40ff01a2010-09-23 21:43:54 +000074;Check the alignment value. Max for this instruction is 256 bits:
Bob Wilson7d247052010-10-08 06:15:13 +000075;CHECK: vld4.8 {d16, d18, d20, d22}, [r0, :256]!
76;CHECK: vld4.8 {d17, d19, d21, d23}, [r0, :256]
Bob Wilson40ff01a2010-09-23 21:43:54 +000077 %tmp1 = call %struct.__neon_int8x16x4_t @llvm.arm.neon.vld4.v16i8(i8* %A, i32 64)
Bob Wilson7708c222009-10-07 18:09:32 +000078 %tmp2 = extractvalue %struct.__neon_int8x16x4_t %tmp1, 0
79 %tmp3 = extractvalue %struct.__neon_int8x16x4_t %tmp1, 2
80 %tmp4 = add <16 x i8> %tmp2, %tmp3
81 ret <16 x i8> %tmp4
82}
83
84define <8 x i16> @vld4Qi16(i16* %A) nounwind {
85;CHECK: vld4Qi16:
Bob Wilson40ff01a2010-09-23 21:43:54 +000086;Check for no alignment specifier.
Bob Wilson7d247052010-10-08 06:15:13 +000087;CHECK: vld4.16 {d16, d18, d20, d22}, [r0]!
88;CHECK: vld4.16 {d17, d19, d21, d23}, [r0]
Bob Wilson02170c02010-04-20 00:17:16 +000089 %tmp0 = bitcast i16* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +000090 %tmp1 = call %struct.__neon_int16x8x4_t @llvm.arm.neon.vld4.v8i16(i8* %tmp0, i32 1)
Bob Wilson7708c222009-10-07 18:09:32 +000091 %tmp2 = extractvalue %struct.__neon_int16x8x4_t %tmp1, 0
92 %tmp3 = extractvalue %struct.__neon_int16x8x4_t %tmp1, 2
93 %tmp4 = add <8 x i16> %tmp2, %tmp3
94 ret <8 x i16> %tmp4
95}
96
97define <4 x i32> @vld4Qi32(i32* %A) nounwind {
98;CHECK: vld4Qi32:
99;CHECK: vld4.32
100;CHECK: vld4.32
Bob Wilson02170c02010-04-20 00:17:16 +0000101 %tmp0 = bitcast i32* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +0000102 %tmp1 = call %struct.__neon_int32x4x4_t @llvm.arm.neon.vld4.v4i32(i8* %tmp0, i32 1)
Bob Wilson7708c222009-10-07 18:09:32 +0000103 %tmp2 = extractvalue %struct.__neon_int32x4x4_t %tmp1, 0
104 %tmp3 = extractvalue %struct.__neon_int32x4x4_t %tmp1, 2
105 %tmp4 = add <4 x i32> %tmp2, %tmp3
106 ret <4 x i32> %tmp4
107}
108
109define <4 x float> @vld4Qf(float* %A) nounwind {
110;CHECK: vld4Qf:
111;CHECK: vld4.32
112;CHECK: vld4.32
Bob Wilson02170c02010-04-20 00:17:16 +0000113 %tmp0 = bitcast float* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +0000114 %tmp1 = call %struct.__neon_float32x4x4_t @llvm.arm.neon.vld4.v4f32(i8* %tmp0, i32 1)
Bob Wilson7708c222009-10-07 18:09:32 +0000115 %tmp2 = extractvalue %struct.__neon_float32x4x4_t %tmp1, 0
116 %tmp3 = extractvalue %struct.__neon_float32x4x4_t %tmp1, 2
Dan Gohmand4d01152010-05-03 22:36:46 +0000117 %tmp4 = fadd <4 x float> %tmp2, %tmp3
Bob Wilson7708c222009-10-07 18:09:32 +0000118 ret <4 x float> %tmp4
119}
120
Bob Wilson7a9ef442010-08-27 17:13:24 +0000121declare %struct.__neon_int8x8x4_t @llvm.arm.neon.vld4.v8i8(i8*, i32) nounwind readonly
122declare %struct.__neon_int16x4x4_t @llvm.arm.neon.vld4.v4i16(i8*, i32) nounwind readonly
123declare %struct.__neon_int32x2x4_t @llvm.arm.neon.vld4.v2i32(i8*, i32) nounwind readonly
124declare %struct.__neon_float32x2x4_t @llvm.arm.neon.vld4.v2f32(i8*, i32) nounwind readonly
125declare %struct.__neon_int64x1x4_t @llvm.arm.neon.vld4.v1i64(i8*, i32) nounwind readonly
Bob Wilson7708c222009-10-07 18:09:32 +0000126
Bob Wilson7a9ef442010-08-27 17:13:24 +0000127declare %struct.__neon_int8x16x4_t @llvm.arm.neon.vld4.v16i8(i8*, i32) nounwind readonly
128declare %struct.__neon_int16x8x4_t @llvm.arm.neon.vld4.v8i16(i8*, i32) nounwind readonly
129declare %struct.__neon_int32x4x4_t @llvm.arm.neon.vld4.v4i32(i8*, i32) nounwind readonly
130declare %struct.__neon_float32x4x4_t @llvm.arm.neon.vld4.v4f32(i8*, i32) nounwind readonly