blob: e524395c501a5c434c019113ec1aa9df44d2122a [file] [log] [blame]
Dan Gohmanfce288f2009-09-09 00:09:15 +00001; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s
Jakob Stoklund Olesenca6fd002011-03-31 22:14:03 +00002; RUN: llc < %s -march=arm -mattr=+neon -regalloc=basic | FileCheck %s
Bob Wilson205a5ca2009-07-08 18:11:30 +00003
4define <8 x i8> @vld1i8(i8* %A) nounwind {
Bob Wilson3765d0f2009-08-05 23:51:20 +00005;CHECK: vld1i8:
Bob Wilson40ff01a2010-09-23 21:43:54 +00006;Check the alignment value. Max for this instruction is 64 bits:
Bob Wilson7d247052010-10-08 06:15:13 +00007;CHECK: vld1.8 {d16}, [r0, :64]
Bob Wilson40ff01a2010-09-23 21:43:54 +00008 %tmp1 = call <8 x i8> @llvm.arm.neon.vld1.v8i8(i8* %A, i32 16)
Bob Wilson205a5ca2009-07-08 18:11:30 +00009 ret <8 x i8> %tmp1
10}
11
12define <4 x i16> @vld1i16(i16* %A) nounwind {
Bob Wilson3765d0f2009-08-05 23:51:20 +000013;CHECK: vld1i16:
14;CHECK: vld1.16
Bob Wilson02170c02010-04-20 00:17:16 +000015 %tmp0 = bitcast i16* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +000016 %tmp1 = call <4 x i16> @llvm.arm.neon.vld1.v4i16(i8* %tmp0, i32 1)
Bob Wilson205a5ca2009-07-08 18:11:30 +000017 ret <4 x i16> %tmp1
18}
19
Bob Wilson1c3ef902011-02-07 17:43:21 +000020;Check for a post-increment updating load.
21define <4 x i16> @vld1i16_update(i16** %ptr) nounwind {
22;CHECK: vld1i16_update:
Jakob Stoklund Olesenca6fd002011-03-31 22:14:03 +000023;CHECK: vld1.16 {d16}, [{{r[0-9]+}}]!
Bob Wilson1c3ef902011-02-07 17:43:21 +000024 %A = load i16** %ptr
25 %tmp0 = bitcast i16* %A to i8*
26 %tmp1 = call <4 x i16> @llvm.arm.neon.vld1.v4i16(i8* %tmp0, i32 1)
27 %tmp2 = getelementptr i16* %A, i32 4
28 store i16* %tmp2, i16** %ptr
29 ret <4 x i16> %tmp1
30}
31
Bob Wilson205a5ca2009-07-08 18:11:30 +000032define <2 x i32> @vld1i32(i32* %A) nounwind {
Bob Wilson3765d0f2009-08-05 23:51:20 +000033;CHECK: vld1i32:
34;CHECK: vld1.32
Bob Wilson02170c02010-04-20 00:17:16 +000035 %tmp0 = bitcast i32* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +000036 %tmp1 = call <2 x i32> @llvm.arm.neon.vld1.v2i32(i8* %tmp0, i32 1)
Bob Wilson205a5ca2009-07-08 18:11:30 +000037 ret <2 x i32> %tmp1
38}
39
Bob Wilson1c3ef902011-02-07 17:43:21 +000040;Check for a post-increment updating load with register increment.
41define <2 x i32> @vld1i32_update(i32** %ptr, i32 %inc) nounwind {
42;CHECK: vld1i32_update:
Jakob Stoklund Olesenca6fd002011-03-31 22:14:03 +000043;CHECK: vld1.32 {d16}, [{{r[0-9]+}}], {{r[0-9]+}}
Bob Wilson1c3ef902011-02-07 17:43:21 +000044 %A = load i32** %ptr
45 %tmp0 = bitcast i32* %A to i8*
46 %tmp1 = call <2 x i32> @llvm.arm.neon.vld1.v2i32(i8* %tmp0, i32 1)
47 %tmp2 = getelementptr i32* %A, i32 %inc
48 store i32* %tmp2, i32** %ptr
49 ret <2 x i32> %tmp1
50}
51
Bob Wilson205a5ca2009-07-08 18:11:30 +000052define <2 x float> @vld1f(float* %A) nounwind {
Bob Wilson3765d0f2009-08-05 23:51:20 +000053;CHECK: vld1f:
54;CHECK: vld1.32
Bob Wilson02170c02010-04-20 00:17:16 +000055 %tmp0 = bitcast float* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +000056 %tmp1 = call <2 x float> @llvm.arm.neon.vld1.v2f32(i8* %tmp0, i32 1)
Bob Wilson205a5ca2009-07-08 18:11:30 +000057 ret <2 x float> %tmp1
58}
59
60define <1 x i64> @vld1i64(i64* %A) nounwind {
Bob Wilson3765d0f2009-08-05 23:51:20 +000061;CHECK: vld1i64:
62;CHECK: vld1.64
Bob Wilson02170c02010-04-20 00:17:16 +000063 %tmp0 = bitcast i64* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +000064 %tmp1 = call <1 x i64> @llvm.arm.neon.vld1.v1i64(i8* %tmp0, i32 1)
Bob Wilson205a5ca2009-07-08 18:11:30 +000065 ret <1 x i64> %tmp1
66}
67
68define <16 x i8> @vld1Qi8(i8* %A) nounwind {
Bob Wilson3765d0f2009-08-05 23:51:20 +000069;CHECK: vld1Qi8:
Bob Wilson40ff01a2010-09-23 21:43:54 +000070;Check the alignment value. Max for this instruction is 128 bits:
Bob Wilson7d247052010-10-08 06:15:13 +000071;CHECK: vld1.8 {d16, d17}, [r0, :64]
Bob Wilson2a6e6162010-09-23 23:42:37 +000072 %tmp1 = call <16 x i8> @llvm.arm.neon.vld1.v16i8(i8* %A, i32 8)
Bob Wilson205a5ca2009-07-08 18:11:30 +000073 ret <16 x i8> %tmp1
74}
75
Bob Wilson1c3ef902011-02-07 17:43:21 +000076;Check for a post-increment updating load.
77define <16 x i8> @vld1Qi8_update(i8** %ptr) nounwind {
78;CHECK: vld1Qi8_update:
Jakob Stoklund Olesenca6fd002011-03-31 22:14:03 +000079;CHECK: vld1.8 {d16, d17}, [{{r[0-9]+}}, :64]!
Bob Wilson1c3ef902011-02-07 17:43:21 +000080 %A = load i8** %ptr
81 %tmp1 = call <16 x i8> @llvm.arm.neon.vld1.v16i8(i8* %A, i32 8)
82 %tmp2 = getelementptr i8* %A, i32 16
83 store i8* %tmp2, i8** %ptr
84 ret <16 x i8> %tmp1
85}
86
Bob Wilson205a5ca2009-07-08 18:11:30 +000087define <8 x i16> @vld1Qi16(i16* %A) nounwind {
Bob Wilson3765d0f2009-08-05 23:51:20 +000088;CHECK: vld1Qi16:
Bob Wilson2a6e6162010-09-23 23:42:37 +000089;Check the alignment value. Max for this instruction is 128 bits:
Bob Wilson7d247052010-10-08 06:15:13 +000090;CHECK: vld1.16 {d16, d17}, [r0, :128]
Bob Wilson02170c02010-04-20 00:17:16 +000091 %tmp0 = bitcast i16* %A to i8*
Bob Wilson2a6e6162010-09-23 23:42:37 +000092 %tmp1 = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %tmp0, i32 32)
Bob Wilson205a5ca2009-07-08 18:11:30 +000093 ret <8 x i16> %tmp1
94}
95
96define <4 x i32> @vld1Qi32(i32* %A) nounwind {
Bob Wilson3765d0f2009-08-05 23:51:20 +000097;CHECK: vld1Qi32:
98;CHECK: vld1.32
Bob Wilson02170c02010-04-20 00:17:16 +000099 %tmp0 = bitcast i32* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +0000100 %tmp1 = call <4 x i32> @llvm.arm.neon.vld1.v4i32(i8* %tmp0, i32 1)
Bob Wilson205a5ca2009-07-08 18:11:30 +0000101 ret <4 x i32> %tmp1
102}
103
104define <4 x float> @vld1Qf(float* %A) nounwind {
Bob Wilson3765d0f2009-08-05 23:51:20 +0000105;CHECK: vld1Qf:
106;CHECK: vld1.32
Bob Wilson02170c02010-04-20 00:17:16 +0000107 %tmp0 = bitcast float* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +0000108 %tmp1 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* %tmp0, i32 1)
Bob Wilson205a5ca2009-07-08 18:11:30 +0000109 ret <4 x float> %tmp1
110}
111
112define <2 x i64> @vld1Qi64(i64* %A) nounwind {
Bob Wilson3765d0f2009-08-05 23:51:20 +0000113;CHECK: vld1Qi64:
114;CHECK: vld1.64
Bob Wilson02170c02010-04-20 00:17:16 +0000115 %tmp0 = bitcast i64* %A to i8*
Bob Wilson7a9ef442010-08-27 17:13:24 +0000116 %tmp1 = call <2 x i64> @llvm.arm.neon.vld1.v2i64(i8* %tmp0, i32 1)
Bob Wilson205a5ca2009-07-08 18:11:30 +0000117 ret <2 x i64> %tmp1
118}
119
Bob Wilson7a9ef442010-08-27 17:13:24 +0000120declare <8 x i8> @llvm.arm.neon.vld1.v8i8(i8*, i32) nounwind readonly
121declare <4 x i16> @llvm.arm.neon.vld1.v4i16(i8*, i32) nounwind readonly
122declare <2 x i32> @llvm.arm.neon.vld1.v2i32(i8*, i32) nounwind readonly
123declare <2 x float> @llvm.arm.neon.vld1.v2f32(i8*, i32) nounwind readonly
124declare <1 x i64> @llvm.arm.neon.vld1.v1i64(i8*, i32) nounwind readonly
Bob Wilson205a5ca2009-07-08 18:11:30 +0000125
Bob Wilson7a9ef442010-08-27 17:13:24 +0000126declare <16 x i8> @llvm.arm.neon.vld1.v16i8(i8*, i32) nounwind readonly
127declare <8 x i16> @llvm.arm.neon.vld1.v8i16(i8*, i32) nounwind readonly
128declare <4 x i32> @llvm.arm.neon.vld1.v4i32(i8*, i32) nounwind readonly
129declare <4 x float> @llvm.arm.neon.vld1.v4f32(i8*, i32) nounwind readonly
130declare <2 x i64> @llvm.arm.neon.vld1.v2i64(i8*, i32) nounwind readonly
Bob Wilson2ac124c2010-08-26 00:13:36 +0000131
132; Radar 8355607
133; Do not crash if the vld1 result is not used.
134define void @unused_vld1_result() {
135entry:
Bob Wilson7a9ef442010-08-27 17:13:24 +0000136 %0 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* undef, i32 1)
Bob Wilson2ac124c2010-08-26 00:13:36 +0000137 call void @llvm.trap()
138 unreachable
139}
140
141declare void @llvm.trap() nounwind