diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-02-01 21:34:47 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-02-01 21:34:47 +0000 |
| commit | 823f87a1f80708ce9ba318cc0b07632e76b74d43 (patch) | |
| tree | 400cc7e5d4548d5f3829f7feea7f7942b4e62dd4 /test/CodeGen | |
| parent | aac4ca60bc813a35242145a1f92f325303d5df6e (diff) | |
Notes
Diffstat (limited to 'test/CodeGen')
| -rw-r--r-- | test/CodeGen/AArch64/aarch64-interleaved-accesses-extract-user.ll | 86 | ||||
| -rw-r--r-- | test/CodeGen/AArch64/aarch64-interleaved-accesses.ll | 393 | ||||
| -rw-r--r-- | test/CodeGen/ARM/arm-interleaved-accesses-extract-user.ll | 86 | ||||
| -rw-r--r-- | test/CodeGen/ARM/arm-interleaved-accesses.ll | 462 | ||||
| -rw-r--r-- | test/CodeGen/SystemZ/pr31710.ll | 39 |
5 files changed, 39 insertions, 1027 deletions
diff --git a/test/CodeGen/AArch64/aarch64-interleaved-accesses-extract-user.ll b/test/CodeGen/AArch64/aarch64-interleaved-accesses-extract-user.ll deleted file mode 100644 index 8628c4288c69..000000000000 --- a/test/CodeGen/AArch64/aarch64-interleaved-accesses-extract-user.ll +++ /dev/null @@ -1,86 +0,0 @@ -; RUN: opt < %s -mtriple=aarch64 -interleaved-access -S | FileCheck %s - -; CHECK-LABEL: @extract_user_basic( -; CHECK: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32 -; CHECK: %[[R:.+]] = extractvalue { <4 x i32>, <4 x i32> } %ldN, 0 -; CHECK: extractelement <4 x i32> %[[R]], i64 1 -define void @extract_user_basic(<8 x i32>* %A, i1 %C) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - br i1 %C, label %if.then, label %if.merge - -if.then: - %E = extractelement <8 x i32> %L, i32 2 - br label %if.merge - -if.merge: - ret void -} - -; CHECK-LABEL: @extract_user_multi( -; CHECK: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32 -; CHECK: %[[R:.+]] = extractvalue { <4 x i32>, <4 x i32> } %ldN, 0 -; CHECK: extractelement <4 x i32> %[[R]], i64 0 -; CHECK: extractelement <4 x i32> %[[R]], i64 1 -define void @extract_user_multi(<8 x i32>* %A, i1 %C) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - br i1 %C, label %if.then, label %if.merge - -if.then: - %E1 = extractelement <8 x i32> %L, i32 0 - br label %if.merge - -if.merge: - %E2 = extractelement <8 x i32> %L, i32 2 - ret void -} - -; CHECK-LABEL: @extract_user_multi_no_dom( -; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32 -define void @extract_user_multi_no_dom(<8 x i32>* %A, i1 %C) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %E1 = extractelement <8 x i32> %L, i32 0 - br i1 %C, label %if.then, label %if.merge - -if.then: - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - %E2 = extractelement <8 x i32> %L, i32 2 - br label %if.merge - -if.merge: - ret void -} - -; CHECK-LABEL: @extract_user_wrong_const_index( -; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32 -define void @extract_user_wrong_const_index(<8 x i32>* %A) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - %E = extractelement <8 x i32> %L, i32 1 - ret void -} - -; CHECK-LABEL: @extract_user_undef_index( -; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32 -define void @extract_user_undef_index(<8 x i32>* %A) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - %E = extractelement <8 x i32> %L, i32 undef - ret void -} - -; CHECK-LABEL: @extract_user_var_index( -; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32 -define void @extract_user_var_index(<8 x i32>* %A, i32 %I) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - %E = extractelement <8 x i32> %L, i32 %I - ret void -} diff --git a/test/CodeGen/AArch64/aarch64-interleaved-accesses.ll b/test/CodeGen/AArch64/aarch64-interleaved-accesses.ll deleted file mode 100644 index 347305abb67a..000000000000 --- a/test/CodeGen/AArch64/aarch64-interleaved-accesses.ll +++ /dev/null @@ -1,393 +0,0 @@ -; RUN: llc -mtriple=aarch64 -lower-interleaved-accesses=true < %s | FileCheck %s -check-prefix=NEON -; RUN: llc -mtriple=aarch64 -lower-interleaved-accesses=true -mattr=-neon < %s | FileCheck %s -check-prefix=NONEON - -; NEON-LABEL: load_factor2: -; NEON: ld2 { v0.8b, v1.8b }, [x0] -; NONEON-LABEL: load_factor2: -; NONEON-NOT: ld2 -define <8 x i8> @load_factor2(<16 x i8>* %ptr) { - %wide.vec = load <16 x i8>, <16 x i8>* %ptr, align 4 - %strided.v0 = shufflevector <16 x i8> %wide.vec, <16 x i8> undef, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14> - %strided.v1 = shufflevector <16 x i8> %wide.vec, <16 x i8> undef, <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15> - %add = add nsw <8 x i8> %strided.v0, %strided.v1 - ret <8 x i8> %add -} - -; NEON-LABEL: load_factor3: -; NEON: ld3 { v0.4s, v1.4s, v2.4s }, [x0] -; NONEON-LABEL: load_factor3: -; NONEON-NOT: ld3 -define <4 x i32> @load_factor3(i32* %ptr) { - %base = bitcast i32* %ptr to <12 x i32>* - %wide.vec = load <12 x i32>, <12 x i32>* %base, align 4 - %strided.v2 = shufflevector <12 x i32> %wide.vec, <12 x i32> undef, <4 x i32> <i32 2, i32 5, i32 8, i32 11> - %strided.v1 = shufflevector <12 x i32> %wide.vec, <12 x i32> undef, <4 x i32> <i32 1, i32 4, i32 7, i32 10> - %add = add nsw <4 x i32> %strided.v2, %strided.v1 - ret <4 x i32> %add -} - -; NEON-LABEL: load_factor4: -; NEON: ld4 { v0.4s, v1.4s, v2.4s, v3.4s }, [x0] -; NONEON-LABEL: load_factor4: -; NONEON-NOT: ld4 -define <4 x i32> @load_factor4(i32* %ptr) { - %base = bitcast i32* %ptr to <16 x i32>* - %wide.vec = load <16 x i32>, <16 x i32>* %base, align 4 - %strided.v0 = shufflevector <16 x i32> %wide.vec, <16 x i32> undef, <4 x i32> <i32 0, i32 4, i32 8, i32 12> - %strided.v2 = shufflevector <16 x i32> %wide.vec, <16 x i32> undef, <4 x i32> <i32 2, i32 6, i32 10, i32 14> - %add = add nsw <4 x i32> %strided.v0, %strided.v2 - ret <4 x i32> %add -} - -; NEON-LABEL: store_factor2: -; NEON: st2 { v0.8b, v1.8b }, [x0] -; NONEON-LABEL: store_factor2: -; NONEON-NOT: st2 -define void @store_factor2(<16 x i8>* %ptr, <8 x i8> %v0, <8 x i8> %v1) { - %interleaved.vec = shufflevector <8 x i8> %v0, <8 x i8> %v1, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15> - store <16 x i8> %interleaved.vec, <16 x i8>* %ptr, align 4 - ret void -} - -; NEON-LABEL: store_factor3: -; NEON: st3 { v0.4s, v1.4s, v2.4s }, [x0] -; NONEON-LABEL: store_factor3: -; NONEON-NOT: st3 -define void @store_factor3(i32* %ptr, <4 x i32> %v0, <4 x i32> %v1, <4 x i32> %v2) { - %base = bitcast i32* %ptr to <12 x i32>* - %v0_v1 = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %v2_u = shufflevector <4 x i32> %v2, <4 x i32> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef> - %interleaved.vec = shufflevector <8 x i32> %v0_v1, <8 x i32> %v2_u, <12 x i32> <i32 0, i32 4, i32 8, i32 1, i32 5, i32 9, i32 2, i32 6, i32 10, i32 3, i32 7, i32 11> - store <12 x i32> %interleaved.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_factor4: -; NEON: st4 { v0.4s, v1.4s, v2.4s, v3.4s }, [x0] -; NONEON-LABEL: store_factor4: -; NONEON-NOT: st4 -define void @store_factor4(i32* %ptr, <4 x i32> %v0, <4 x i32> %v1, <4 x i32> %v2, <4 x i32> %v3) { - %base = bitcast i32* %ptr to <16 x i32>* - %v0_v1 = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %v2_v3 = shufflevector <4 x i32> %v2, <4 x i32> %v3, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %interleaved.vec = shufflevector <8 x i32> %v0_v1, <8 x i32> %v2_v3, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 1, i32 5, i32 9, i32 13, i32 2, i32 6, i32 10, i32 14, i32 3, i32 7, i32 11, i32 15> - store <16 x i32> %interleaved.vec, <16 x i32>* %base, align 4 - ret void -} - -; The following cases test that interleaved access of pointer vectors can be -; matched to ldN/stN instruction. - -; NEON-LABEL: load_ptrvec_factor2: -; NEON: ld2 { v0.2d, v1.2d }, [x0] -; NONEON-LABEL: load_ptrvec_factor2: -; NONEON-NOT: ld2 -define <2 x i32*> @load_ptrvec_factor2(i32** %ptr) { - %base = bitcast i32** %ptr to <4 x i32*>* - %wide.vec = load <4 x i32*>, <4 x i32*>* %base, align 4 - %strided.v0 = shufflevector <4 x i32*> %wide.vec, <4 x i32*> undef, <2 x i32> <i32 0, i32 2> - ret <2 x i32*> %strided.v0 -} - -; NEON-LABEL: load_ptrvec_factor3: -; NEON: ld3 { v0.2d, v1.2d, v2.2d }, [x0] -; NONEON-LABEL: load_ptrvec_factor3: -; NONEON-NOT: ld3 -define void @load_ptrvec_factor3(i32** %ptr, <2 x i32*>* %ptr1, <2 x i32*>* %ptr2) { - %base = bitcast i32** %ptr to <6 x i32*>* - %wide.vec = load <6 x i32*>, <6 x i32*>* %base, align 4 - %strided.v2 = shufflevector <6 x i32*> %wide.vec, <6 x i32*> undef, <2 x i32> <i32 2, i32 5> - store <2 x i32*> %strided.v2, <2 x i32*>* %ptr1 - %strided.v1 = shufflevector <6 x i32*> %wide.vec, <6 x i32*> undef, <2 x i32> <i32 1, i32 4> - store <2 x i32*> %strided.v1, <2 x i32*>* %ptr2 - ret void -} - -; NEON-LABEL: load_ptrvec_factor4: -; NEON: ld4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0] -; NONEON-LABEL: load_ptrvec_factor4: -; NONEON-NOT: ld4 -define void @load_ptrvec_factor4(i32** %ptr, <2 x i32*>* %ptr1, <2 x i32*>* %ptr2) { - %base = bitcast i32** %ptr to <8 x i32*>* - %wide.vec = load <8 x i32*>, <8 x i32*>* %base, align 4 - %strided.v1 = shufflevector <8 x i32*> %wide.vec, <8 x i32*> undef, <2 x i32> <i32 1, i32 5> - %strided.v3 = shufflevector <8 x i32*> %wide.vec, <8 x i32*> undef, <2 x i32> <i32 3, i32 7> - store <2 x i32*> %strided.v1, <2 x i32*>* %ptr1 - store <2 x i32*> %strided.v3, <2 x i32*>* %ptr2 - ret void -} - -; NEON-LABEL: store_ptrvec_factor2: -; NEON: st2 { v0.2d, v1.2d }, [x0] -; NONEON-LABEL: store_ptrvec_factor2: -; NONEON-NOT: st2 -define void @store_ptrvec_factor2(i32** %ptr, <2 x i32*> %v0, <2 x i32*> %v1) { - %base = bitcast i32** %ptr to <4 x i32*>* - %interleaved.vec = shufflevector <2 x i32*> %v0, <2 x i32*> %v1, <4 x i32> <i32 0, i32 2, i32 1, i32 3> - store <4 x i32*> %interleaved.vec, <4 x i32*>* %base, align 4 - ret void -} - -; NEON-LABEL: store_ptrvec_factor3: -; NEON: st3 { v0.2d, v1.2d, v2.2d }, [x0] -; NONEON-LABEL: store_ptrvec_factor3: -; NONEON-NOT: st3 -define void @store_ptrvec_factor3(i32** %ptr, <2 x i32*> %v0, <2 x i32*> %v1, <2 x i32*> %v2) { - %base = bitcast i32** %ptr to <6 x i32*>* - %v0_v1 = shufflevector <2 x i32*> %v0, <2 x i32*> %v1, <4 x i32> <i32 0, i32 1, i32 2, i32 3> - %v2_u = shufflevector <2 x i32*> %v2, <2 x i32*> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> - %interleaved.vec = shufflevector <4 x i32*> %v0_v1, <4 x i32*> %v2_u, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5> - store <6 x i32*> %interleaved.vec, <6 x i32*>* %base, align 4 - ret void -} - -; NEON-LABEL: store_ptrvec_factor4: -; NEON: st4 { v0.2d, v1.2d, v2.2d, v3.2d }, [x0] -; NONEON-LABEL: store_ptrvec_factor4: -; NONEON-NOT: st4 -define void @store_ptrvec_factor4(i32* %ptr, <2 x i32*> %v0, <2 x i32*> %v1, <2 x i32*> %v2, <2 x i32*> %v3) { - %base = bitcast i32* %ptr to <8 x i32*>* - %v0_v1 = shufflevector <2 x i32*> %v0, <2 x i32*> %v1, <4 x i32> <i32 0, i32 1, i32 2, i32 3> - %v2_v3 = shufflevector <2 x i32*> %v2, <2 x i32*> %v3, <4 x i32> <i32 0, i32 1, i32 2, i32 3> - %interleaved.vec = shufflevector <4 x i32*> %v0_v1, <4 x i32*> %v2_v3, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 1, i32 3, i32 5, i32 7> - store <8 x i32*> %interleaved.vec, <8 x i32*>* %base, align 4 - ret void -} - -; Following cases check that shuffle maskes with undef indices can be matched -; into ldN/stN instruction. - -; NEON-LABEL: load_undef_mask_factor2: -; NEON: ld2 { v0.4s, v1.4s }, [x0] -; NONEON-LABEL: load_undef_mask_factor2: -; NONEON-NOT: ld2 -define <4 x i32> @load_undef_mask_factor2(i32* %ptr) { - %base = bitcast i32* %ptr to <8 x i32>* - %wide.vec = load <8 x i32>, <8 x i32>* %base, align 4 - %strided.v0 = shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 undef, i32 2, i32 undef, i32 6> - %strided.v1 = shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 undef, i32 3, i32 undef, i32 7> - %add = add nsw <4 x i32> %strided.v0, %strided.v1 - ret <4 x i32> %add -} - -; NEON-LABEL: load_undef_mask_factor3: -; NEON: ld3 { v0.4s, v1.4s, v2.4s }, [x0] -; NONEON-LABEL: load_undef_mask_factor3: -; NONEON-NOT: ld3 -define <4 x i32> @load_undef_mask_factor3(i32* %ptr) { - %base = bitcast i32* %ptr to <12 x i32>* - %wide.vec = load <12 x i32>, <12 x i32>* %base, align 4 - %strided.v2 = shufflevector <12 x i32> %wide.vec, <12 x i32> undef, <4 x i32> <i32 2, i32 undef, i32 undef, i32 undef> - %strided.v1 = shufflevector <12 x i32> %wide.vec, <12 x i32> undef, <4 x i32> <i32 1, i32 4, i32 7, i32 10> - %add = add nsw <4 x i32> %strided.v2, %strided.v1 - ret <4 x i32> %add -} - -; NEON-LABEL: load_undef_mask_factor4: -; NEON: ld4 { v0.4s, v1.4s, v2.4s, v3.4s }, [x0] -; NONEON-LABEL: load_undef_mask_factor4: -; NONEON-NOT: ld4 -define <4 x i32> @load_undef_mask_factor4(i32* %ptr) { - %base = bitcast i32* %ptr to <16 x i32>* - %wide.vec = load <16 x i32>, <16 x i32>* %base, align 4 - %strided.v0 = shufflevector <16 x i32> %wide.vec, <16 x i32> undef, <4 x i32> <i32 0, i32 4, i32 undef, i32 undef> - %strided.v2 = shufflevector <16 x i32> %wide.vec, <16 x i32> undef, <4 x i32> <i32 2, i32 6, i32 undef, i32 undef> - %add = add nsw <4 x i32> %strided.v0, %strided.v2 - ret <4 x i32> %add -} - -; NEON-LABEL: store_undef_mask_factor2: -; NEON: st2 { v0.4s, v1.4s }, [x0] -; NONEON-LABEL: store_undef_mask_factor2: -; NONEON-NOT: st2 -define void @store_undef_mask_factor2(i32* %ptr, <4 x i32> %v0, <4 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %interleaved.vec = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 undef, i32 2, i32 6, i32 3, i32 7> - store <8 x i32> %interleaved.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_undef_mask_factor3: -; NEON: st3 { v0.4s, v1.4s, v2.4s }, [x0] -; NONEON-LABEL: store_undef_mask_factor3: -; NONEON-NOT: st3 -define void @store_undef_mask_factor3(i32* %ptr, <4 x i32> %v0, <4 x i32> %v1, <4 x i32> %v2) { - %base = bitcast i32* %ptr to <12 x i32>* - %v0_v1 = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %v2_u = shufflevector <4 x i32> %v2, <4 x i32> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef> - %interleaved.vec = shufflevector <8 x i32> %v0_v1, <8 x i32> %v2_u, <12 x i32> <i32 0, i32 4, i32 undef, i32 1, i32 undef, i32 9, i32 2, i32 6, i32 10, i32 3, i32 7, i32 11> - store <12 x i32> %interleaved.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_undef_mask_factor4: -; NEON: st4 { v0.4s, v1.4s, v2.4s, v3.4s }, [x0] -; NONEON-LABEL: store_undef_mask_factor4: -; NONEON-NOT: st4 -define void @store_undef_mask_factor4(i32* %ptr, <4 x i32> %v0, <4 x i32> %v1, <4 x i32> %v2, <4 x i32> %v3) { - %base = bitcast i32* %ptr to <16 x i32>* - %v0_v1 = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %v2_v3 = shufflevector <4 x i32> %v2, <4 x i32> %v3, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %interleaved.vec = shufflevector <8 x i32> %v0_v1, <8 x i32> %v2_v3, <16 x i32> <i32 0, i32 4, i32 8, i32 undef, i32 undef, i32 5, i32 9, i32 13, i32 2, i32 6, i32 10, i32 14, i32 3, i32 7, i32 11, i32 15> - store <16 x i32> %interleaved.vec, <16 x i32>* %base, align 4 - ret void -} - -; Check that we do something sane with illegal types. - -; NEON-LABEL: load_illegal_factor2: -; NEON: BB#0: -; NEON-NEXT: ldr q[[V:[0-9]+]], [x0] -; NEON-NEXT: uzp1 v0.4s, v[[V]].4s, v{{.*}}.4s -; NEON-NEXT: ret -; NONEON-LABEL: load_illegal_factor2: -; NONEON: BB#0: -; NONEON-NEXT: ldr s0, [x0] -; NONEON-NEXT: ldr s1, [x0, #8] -; NONEON-NEXT: ret -define <3 x float> @load_illegal_factor2(<3 x float>* %p) nounwind { - %tmp1 = load <3 x float>, <3 x float>* %p, align 16 - %tmp2 = shufflevector <3 x float> %tmp1, <3 x float> undef, <3 x i32> <i32 0, i32 2, i32 undef> - ret <3 x float> %tmp2 -} - -; NEON-LABEL: store_illegal_factor2: -; NEON: BB#0: -; NEON-NEXT: uzp1 v0.4s, v0.4s, v{{.*}}.4s -; NEON-NEXT: st1 { v0.d }[0], [x0] -; NEON-NEXT: ret -; NONEON-LABEL: store_illegal_factor2: -; NONEON: BB#0: -; NONEON-NEXT: fmov w[[ELT2:[0-9]+]], s2 -; NONEON-NEXT: fmov w[[RES:[0-9]+]], s0 -; NONEON-NEXT: bfi x[[RES]], x[[ELT2]], #32, #32 -; NONEON-NEXT: str x[[RES]], [x0] -; NONEON-NEXT: ret -define void @store_illegal_factor2(<3 x float>* %p, <3 x float> %v) nounwind { - %tmp1 = shufflevector <3 x float> %v, <3 x float> undef, <3 x i32> <i32 0, i32 2, i32 undef> - store <3 x float> %tmp1, <3 x float>* %p, align 16 - ret void -} - -; NEON-LABEL: load_factor2_with_extract_user: -; NEON: ld2 { v0.4s, v1.4s }, [x0] -; NEON: mov w0, v0.s[1] -; NONEON-LABEL: load_factor2_with_extract_user: -; NONEON-NOT: ld2 -define i32 @load_factor2_with_extract_user(<8 x i32>* %a) { - %1 = load <8 x i32>, <8 x i32>* %a, align 8 - %2 = shufflevector <8 x i32> %1, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - %3 = extractelement <8 x i32> %1, i32 2 - ret i32 %3 -} - -; NEON-LABEL: store_general_mask_factor4: -; NEON: st4 { v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s }, [x0] -; NONEON-LABEL: store_general_mask_factor4: -; NONEON-NOT: st4 -define void @store_general_mask_factor4(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <8 x i32> <i32 4, i32 16, i32 32, i32 8, i32 5, i32 17, i32 33, i32 9> - store <8 x i32> %i.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor4_undefbeg: -; NEON: st4 { v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s }, [x0] -; NONEON-LABEL: store_general_mask_factor4_undefbeg: -; NONEON-NOT: st4 -define void @store_general_mask_factor4_undefbeg(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <8 x i32> <i32 undef, i32 16, i32 32, i32 8, i32 5, i32 17, i32 33, i32 9> - store <8 x i32> %i.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor4_undefend: -; NEON: st4 { v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s }, [x0] -; NONEON-LABEL: store_general_mask_factor4_undefend: -; NONEON-NOT: st4 -define void @store_general_mask_factor4_undefend(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <8 x i32> <i32 4, i32 16, i32 32, i32 8, i32 5, i32 17, i32 33, i32 undef> - store <8 x i32> %i.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor4_undefmid: -; NEON: st4 { v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s }, [x0] -; NONEON-LABEL: store_general_mask_factor4_undefmid: -; NONEON-NOT: st4 -define void @store_general_mask_factor4_undefmid(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <8 x i32> <i32 4, i32 undef, i32 32, i32 8, i32 5, i32 17, i32 undef, i32 9> - store <8 x i32> %i.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor4_undefmulti: -; NEON: st4 { v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s }, [x0] -; NONEON-LABEL: store_general_mask_factor4_undefmulti: -; NONEON-NOT: st4 -define void @store_general_mask_factor4_undefmulti(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <8 x i32> <i32 4, i32 undef, i32 undef, i32 8, i32 undef, i32 undef, i32 undef, i32 9> - store <8 x i32> %i.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3: -; NEON: st3 { v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s }, [x0] -; NONEON-LABEL: store_general_mask_factor3: -; NONEON-NOT: st3 -define void @store_general_mask_factor3(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 4, i32 32, i32 16, i32 5, i32 33, i32 17, i32 6, i32 34, i32 18, i32 7, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_undefmultimid: -; NEON: st3 { v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s }, [x0] -; NONEON-LABEL: store_general_mask_factor3_undefmultimid: -; NONEON-NOT: st3 -define void @store_general_mask_factor3_undefmultimid(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 4, i32 32, i32 16, i32 undef, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 7, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_undef_fail: -; NEON-NOT: st3 -; NONEON-LABEL: store_general_mask_factor3_undef_fail: -; NONEON-NOT: st3 -define void @store_general_mask_factor3_undef_fail(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 4, i32 32, i32 16, i32 undef, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 8, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_undeflane: -; NEON: st3 { v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s, v{{[0-9]+}}.{{[0-9]+}}s }, [x0] -; NONEON-LABEL: store_general_mask_factor3_undeflane: -; NONEON-NOT: st3 -define void @store_general_mask_factor3_undeflane(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 undef, i32 32, i32 16, i32 undef, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 undef, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_negativestart: -; NEON-NOT: st3 -; NONEON-LABEL: store_general_mask_factor3_negativestart: -; NONEON-NOT: st3 -define void @store_general_mask_factor3_negativestart(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 undef, i32 32, i32 16, i32 undef, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 2, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - diff --git a/test/CodeGen/ARM/arm-interleaved-accesses-extract-user.ll b/test/CodeGen/ARM/arm-interleaved-accesses-extract-user.ll deleted file mode 100644 index 620cb6356411..000000000000 --- a/test/CodeGen/ARM/arm-interleaved-accesses-extract-user.ll +++ /dev/null @@ -1,86 +0,0 @@ -; RUN: opt < %s -mtriple=arm-eabi -mattr=+neon -interleaved-access -S | FileCheck %s - -; CHECK-LABEL: @extract_user_basic( -; CHECK: %vldN = call { <4 x i32>, <4 x i32> } @llvm.arm.neon.vld2.v4i32.p0i8 -; CHECK: %[[R:.+]] = extractvalue { <4 x i32>, <4 x i32> } %vldN, 0 -; CHECK: extractelement <4 x i32> %[[R]], i64 1 -define void @extract_user_basic(<8 x i32>* %A, i1 %C) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - br i1 %C, label %if.then, label %if.merge - -if.then: - %E = extractelement <8 x i32> %L, i32 2 - br label %if.merge - -if.merge: - ret void -} - -; CHECK-LABEL: @extract_user_multi( -; CHECK: %vldN = call { <4 x i32>, <4 x i32> } @llvm.arm.neon.vld2.v4i32.p0i8 -; CHECK: %[[R:.+]] = extractvalue { <4 x i32>, <4 x i32> } %vldN, 0 -; CHECK: extractelement <4 x i32> %[[R]], i64 0 -; CHECK: extractelement <4 x i32> %[[R]], i64 1 -define void @extract_user_multi(<8 x i32>* %A, i1 %C) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - br i1 %C, label %if.then, label %if.merge - -if.then: - %E1 = extractelement <8 x i32> %L, i32 0 - br label %if.merge - -if.merge: - %E2 = extractelement <8 x i32> %L, i32 2 - ret void -} - -; CHECK-LABEL: @extract_user_multi_no_dom( -; CHECK-NOT: %vldN = call { <4 x i32>, <4 x i32> } @llvm.arm.neon.vld2.v4i32.p0i8 -define void @extract_user_multi_no_dom(<8 x i32>* %A, i1 %C) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %E1 = extractelement <8 x i32> %L, i32 0 - br i1 %C, label %if.then, label %if.merge - -if.then: - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - %E2 = extractelement <8 x i32> %L, i32 2 - br label %if.merge - -if.merge: - ret void -} - -; CHECK-LABEL: @extract_user_wrong_const_index( -; CHECK-NOT: %vldN = call { <4 x i32>, <4 x i32> } @llvm.arm.neon.vld2.v4i32.p0i8 -define void @extract_user_wrong_const_index(<8 x i32>* %A) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - %E = extractelement <8 x i32> %L, i32 1 - ret void -} - -; CHECK-LABEL: @extract_user_undef_index( -; CHECK-NOT: %vldN = call { <4 x i32>, <4 x i32> } @llvm.arm.neon.vld2.v4i32.p0i8 -define void @extract_user_undef_index(<8 x i32>* %A) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - %E = extractelement <8 x i32> %L, i32 undef - ret void -} - -; CHECK-LABEL: @extract_user_var_index( -; CHECK-NOT: %vldN = call { <4 x i32>, <4 x i32> } @llvm.arm.neon.vld2.v4i32.p0i8 -define void @extract_user_var_index(<8 x i32>* %A, i32 %I) { -entry: - %L = load <8 x i32>, <8 x i32>* %A, align 8 - %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - %E = extractelement <8 x i32> %L, i32 %I - ret void -} diff --git a/test/CodeGen/ARM/arm-interleaved-accesses.ll b/test/CodeGen/ARM/arm-interleaved-accesses.ll deleted file mode 100644 index 4bd60bc19cf5..000000000000 --- a/test/CodeGen/ARM/arm-interleaved-accesses.ll +++ /dev/null @@ -1,462 +0,0 @@ -; RUN: llc -mtriple=arm-eabi -mattr=+neon -lower-interleaved-accesses=true < %s | FileCheck %s -check-prefix=NEON -; RUN: llc -mtriple=arm-eabi -mattr=-neon -lower-interleaved-accesses=true < %s | FileCheck %s -check-prefix=NONEON - -; NEON-LABEL: load_factor2: -; NEON: vld2.8 {d16, d17}, [r0] -; NONEON-LABEL: load_factor2: -; NONEON-NOT: vld2 -define <8 x i8> @load_factor2(<16 x i8>* %ptr) { - %wide.vec = load <16 x i8>, <16 x i8>* %ptr, align 4 - %strided.v0 = shufflevector <16 x i8> %wide.vec, <16 x i8> undef, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14> - %strided.v1 = shufflevector <16 x i8> %wide.vec, <16 x i8> undef, <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15> - %add = add nsw <8 x i8> %strided.v0, %strided.v1 - ret <8 x i8> %add -} - -; NEON-LABEL: load_factor3: -; NEON: vld3.32 {d16, d17, d18}, [r0] -; NONEON-LABEL: load_factor3: -; NONEON-NOT: vld3 -define <2 x i32> @load_factor3(i32* %ptr) { - %base = bitcast i32* %ptr to <6 x i32>* - %wide.vec = load <6 x i32>, <6 x i32>* %base, align 4 - %strided.v2 = shufflevector <6 x i32> %wide.vec, <6 x i32> undef, <2 x i32> <i32 2, i32 5> - %strided.v1 = shufflevector <6 x i32> %wide.vec, <6 x i32> undef, <2 x i32> <i32 1, i32 4> - %add = add nsw <2 x i32> %strided.v2, %strided.v1 - ret <2 x i32> %add -} - -; NEON-LABEL: load_factor4: -; NEON: vld4.32 {d16, d18, d20, d22}, [r0]! -; NEON: vld4.32 {d17, d19, d21, d23}, [r0] -; NONEON-LABEL: load_factor4: -; NONEON-NOT: vld4 -define <4 x i32> @load_factor4(i32* %ptr) { - %base = bitcast i32* %ptr to <16 x i32>* - %wide.vec = load <16 x i32>, <16 x i32>* %base, align 4 - %strided.v0 = shufflevector <16 x i32> %wide.vec, <16 x i32> undef, <4 x i32> <i32 0, i32 4, i32 8, i32 12> - %strided.v2 = shufflevector <16 x i32> %wide.vec, <16 x i32> undef, <4 x i32> <i32 2, i32 6, i32 10, i32 14> - %add = add nsw <4 x i32> %strided.v0, %strided.v2 - ret <4 x i32> %add -} - -; NEON-LABEL: store_factor2: -; NEON: vst2.8 {d16, d17}, [r0] -; NONEON-LABEL: store_factor2: -; NONEON-NOT: vst2 -define void @store_factor2(<16 x i8>* %ptr, <8 x i8> %v0, <8 x i8> %v1) { - %interleaved.vec = shufflevector <8 x i8> %v0, <8 x i8> %v1, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15> - store <16 x i8> %interleaved.vec, <16 x i8>* %ptr, align 4 - ret void -} - -; NEON-LABEL: store_factor3: -; NEON: vst3.32 {d16, d18, d20}, [r0]! -; NEON: vst3.32 {d17, d19, d21}, [r0] -; NONEON-LABEL: store_factor3: -; NONEON-NOT: vst3.32 -define void @store_factor3(i32* %ptr, <4 x i32> %v0, <4 x i32> %v1, <4 x i32> %v2) { - %base = bitcast i32* %ptr to <12 x i32>* - %v0_v1 = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %v2_u = shufflevector <4 x i32> %v2, <4 x i32> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef> - %interleaved.vec = shufflevector <8 x i32> %v0_v1, <8 x i32> %v2_u, <12 x i32> <i32 0, i32 4, i32 8, i32 1, i32 5, i32 9, i32 2, i32 6, i32 10, i32 3, i32 7, i32 11> - store <12 x i32> %interleaved.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_factor4: -; NEON: vst4.32 {d16, d18, d20, d22}, [r0]! -; NEON: vst4.32 {d17, d19, d21, d23}, [r0] -; NONEON-LABEL: store_factor4: -; NONEON-NOT: vst4 -define void @store_factor4(i32* %ptr, <4 x i32> %v0, <4 x i32> %v1, <4 x i32> %v2, <4 x i32> %v3) { - %base = bitcast i32* %ptr to <16 x i32>* - %v0_v1 = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %v2_v3 = shufflevector <4 x i32> %v2, <4 x i32> %v3, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %interleaved.vec = shufflevector <8 x i32> %v0_v1, <8 x i32> %v2_v3, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 1, i32 5, i32 9, i32 13, i32 2, i32 6, i32 10, i32 14, i32 3, i32 7, i32 11, i32 15> - store <16 x i32> %interleaved.vec, <16 x i32>* %base, align 4 - ret void -} - -; The following cases test that interleaved access of pointer vectors can be -; matched to ldN/stN instruction. - -; NEON-LABEL: load_ptrvec_factor2: -; NEON: vld2.32 {d16, d17}, [r0] -; NONEON-LABEL: load_ptrvec_factor2: -; NONEON-NOT: vld2 -define <2 x i32*> @load_ptrvec_factor2(i32** %ptr) { - %base = bitcast i32** %ptr to <4 x i32*>* - %wide.vec = load <4 x i32*>, <4 x i32*>* %base, align 4 - %strided.v0 = shufflevector <4 x i32*> %wide.vec, <4 x i32*> undef, <2 x i32> <i32 0, i32 2> - ret <2 x i32*> %strided.v0 -} - -; NEON-LABEL: load_ptrvec_factor3: -; NEON: vld3.32 {d16, d17, d18}, [r0] -; NONEON-LABEL: load_ptrvec_factor3: -; NONEON-NOT: vld3 -define void @load_ptrvec_factor3(i32** %ptr, <2 x i32*>* %ptr1, <2 x i32*>* %ptr2) { - %base = bitcast i32** %ptr to <6 x i32*>* - %wide.vec = load <6 x i32*>, <6 x i32*>* %base, align 4 - %strided.v2 = shufflevector <6 x i32*> %wide.vec, <6 x i32*> undef, <2 x i32> <i32 2, i32 5> - store <2 x i32*> %strided.v2, <2 x i32*>* %ptr1 - %strided.v1 = shufflevector <6 x i32*> %wide.vec, <6 x i32*> undef, <2 x i32> <i32 1, i32 4> - store <2 x i32*> %strided.v1, <2 x i32*>* %ptr2 - ret void -} - -; NEON-LABEL: load_ptrvec_factor4: -; NEON: vld4.32 {d16, d17, d18, d19}, [r0] -; NONEON-LABEL: load_ptrvec_factor4: -; NONEON-NOT: vld4 -define void @load_ptrvec_factor4(i32** %ptr, <2 x i32*>* %ptr1, <2 x i32*>* %ptr2) { - %base = bitcast i32** %ptr to <8 x i32*>* - %wide.vec = load <8 x i32*>, <8 x i32*>* %base, align 4 - %strided.v1 = shufflevector <8 x i32*> %wide.vec, <8 x i32*> undef, <2 x i32> <i32 1, i32 5> - %strided.v3 = shufflevector <8 x i32*> %wide.vec, <8 x i32*> undef, <2 x i32> <i32 3, i32 7> - store <2 x i32*> %strided.v1, <2 x i32*>* %ptr1 - store <2 x i32*> %strided.v3, <2 x i32*>* %ptr2 - ret void -} - -; NEON-LABEL: store_ptrvec_factor2: -; NEON: vst2.32 {d16, d17}, [r0] -; NONEON-LABEL: store_ptrvec_factor2: -; NONEON-NOT: vst2 -define void @store_ptrvec_factor2(i32** %ptr, <2 x i32*> %v0, <2 x i32*> %v1) { - %base = bitcast i32** %ptr to <4 x i32*>* - %interleaved.vec = shufflevector <2 x i32*> %v0, <2 x i32*> %v1, <4 x i32> <i32 0, i32 2, i32 1, i32 3> - store <4 x i32*> %interleaved.vec, <4 x i32*>* %base, align 4 - ret void -} - -; NEON-LABEL: store_ptrvec_factor3: -; NEON: vst3.32 {d16, d17, d18}, [r0] -; NONEON-LABEL: store_ptrvec_factor3: -; NONEON-NOT: vst3 -define void @store_ptrvec_factor3(i32** %ptr, <2 x i32*> %v0, <2 x i32*> %v1, <2 x i32*> %v2) { - %base = bitcast i32** %ptr to <6 x i32*>* - %v0_v1 = shufflevector <2 x i32*> %v0, <2 x i32*> %v1, <4 x i32> <i32 0, i32 1, i32 2, i32 3> - %v2_u = shufflevector <2 x i32*> %v2, <2 x i32*> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> - %interleaved.vec = shufflevector <4 x i32*> %v0_v1, <4 x i32*> %v2_u, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5> - store <6 x i32*> %interleaved.vec, <6 x i32*>* %base, align 4 - ret void -} - -; NEON-LABEL: store_ptrvec_factor4: -; NEON: vst4.32 {d16, d17, d18, d19}, [r0] -; NONEON-LABEL: store_ptrvec_factor4: -; NONEON-NOT: vst4 -define void @store_ptrvec_factor4(i32* %ptr, <2 x i32*> %v0, <2 x i32*> %v1, <2 x i32*> %v2, <2 x i32*> %v3) { - %base = bitcast i32* %ptr to <8 x i32*>* - %v0_v1 = shufflevector <2 x i32*> %v0, <2 x i32*> %v1, <4 x i32> <i32 0, i32 1, i32 2, i32 3> - %v2_v3 = shufflevector <2 x i32*> %v2, <2 x i32*> %v3, <4 x i32> <i32 0, i32 1, i32 2, i32 3> - %interleaved.vec = shufflevector <4 x i32*> %v0_v1, <4 x i32*> %v2_v3, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 1, i32 3, i32 5, i32 7> - store <8 x i32*> %interleaved.vec, <8 x i32*>* %base, align 4 - ret void -} - -; Following cases check that shuffle maskes with undef indices can be matched -; into ldN/stN instruction. - -; NEON-LABEL: load_undef_mask_factor2: -; NEON: vld2.32 {d16, d17, d18, d19}, [r0] -; NONEON-LABEL: load_undef_mask_factor2: -; NONEON-NOT: vld2 -define <4 x i32> @load_undef_mask_factor2(i32* %ptr) { - %base = bitcast i32* %ptr to <8 x i32>* - %wide.vec = load <8 x i32>, <8 x i32>* %base, align 4 - %strided.v0 = shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 undef, i32 2, i32 undef, i32 6> - %strided.v1 = shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 undef, i32 3, i32 undef, i32 7> - %add = add nsw <4 x i32> %strided.v0, %strided.v1 - ret <4 x i32> %add -} - -; NEON-LABEL: load_undef_mask_factor3: -; NEON: vld3.32 {d16, d18, d20}, [r0]! -; NEON: vld3.32 {d17, d19, d21}, [r0] -; NONEON-LABEL: load_undef_mask_factor3: -; NONEON-NOT: vld3 -define <4 x i32> @load_undef_mask_factor3(i32* %ptr) { - %base = bitcast i32* %ptr to <12 x i32>* - %wide.vec = load <12 x i32>, <12 x i32>* %base, align 4 - %strided.v2 = shufflevector <12 x i32> %wide.vec, <12 x i32> undef, <4 x i32> <i32 2, i32 undef, i32 undef, i32 undef> - %strided.v1 = shufflevector <12 x i32> %wide.vec, <12 x i32> undef, <4 x i32> <i32 1, i32 4, i32 7, i32 10> - %add = add nsw <4 x i32> %strided.v2, %strided.v1 - ret <4 x i32> %add -} - -; NEON-LABEL: load_undef_mask_factor4: -; NEON: vld4.32 {d16, d18, d20, d22}, [r0]! -; NEON: vld4.32 {d17, d19, d21, d23}, [r0] -; NONEON-LABEL: load_undef_mask_factor4: -; NONEON-NOT: vld4 -define <4 x i32> @load_undef_mask_factor4(i32* %ptr) { - %base = bitcast i32* %ptr to <16 x i32>* - %wide.vec = load <16 x i32>, <16 x i32>* %base, align 4 - %strided.v0 = shufflevector <16 x i32> %wide.vec, <16 x i32> undef, <4 x i32> <i32 0, i32 4, i32 undef, i32 undef> - %strided.v2 = shufflevector <16 x i32> %wide.vec, <16 x i32> undef, <4 x i32> <i32 2, i32 6, i32 undef, i32 undef> - %add = add nsw <4 x i32> %strided.v0, %strided.v2 - ret <4 x i32> %add -} - -; NEON-LABEL: store_undef_mask_factor2: -; NEON: vst2.32 {d16, d17, d18, d19}, [r0] -; NONEON-LABEL: store_undef_mask_factor2: -; NONEON-NOT: vst2 -define void @store_undef_mask_factor2(i32* %ptr, <4 x i32> %v0, <4 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %interleaved.vec = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 undef, i32 2, i32 6, i32 3, i32 7> - store <8 x i32> %interleaved.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_undef_mask_factor3: -; NEON: vst3.32 {d16, d18, d20}, [r0]! -; NEON: vst3.32 {d17, d19, d21}, [r0] -; NONEON-LABEL: store_undef_mask_factor3: -; NONEON-NOT: vst3 -define void @store_undef_mask_factor3(i32* %ptr, <4 x i32> %v0, <4 x i32> %v1, <4 x i32> %v2) { - %base = bitcast i32* %ptr to <12 x i32>* - %v0_v1 = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %v2_u = shufflevector <4 x i32> %v2, <4 x i32> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef> - %interleaved.vec = shufflevector <8 x i32> %v0_v1, <8 x i32> %v2_u, <12 x i32> <i32 0, i32 4, i32 undef, i32 1, i32 undef, i32 9, i32 2, i32 6, i32 10, i32 3, i32 7, i32 11> - store <12 x i32> %interleaved.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_undef_mask_factor4: -; NEON: vst4.32 {d16, d18, d20, d22}, [r0]! -; NEON: vst4.32 {d17, d19, d21, d23}, [r0] -; NONEON-LABEL: store_undef_mask_factor4: -; NONEON-NOT: vst4 -define void @store_undef_mask_factor4(i32* %ptr, <4 x i32> %v0, <4 x i32> %v1, <4 x i32> %v2, <4 x i32> %v3) { - %base = bitcast i32* %ptr to <16 x i32>* - %v0_v1 = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %v2_v3 = shufflevector <4 x i32> %v2, <4 x i32> %v3, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> - %interleaved.vec = shufflevector <8 x i32> %v0_v1, <8 x i32> %v2_v3, <16 x i32> <i32 0, i32 4, i32 8, i32 undef, i32 undef, i32 5, i32 9, i32 13, i32 2, i32 6, i32 10, i32 14, i32 3, i32 7, i32 11, i32 15> - store <16 x i32> %interleaved.vec, <16 x i32>* %base, align 4 - ret void -} - -; The following test cases check that address spaces are properly handled - -; NEON-LABEL: load_address_space -; NEON: vld3.32 -; NONEON-LABEL: load_address_space -; NONEON-NOT: vld3 -define void @load_address_space(<4 x i32> addrspace(1)* %A, <2 x i32>* %B) { - %tmp = load <4 x i32>, <4 x i32> addrspace(1)* %A - %interleaved = shufflevector <4 x i32> %tmp, <4 x i32> undef, <2 x i32> <i32 0, i32 3> - store <2 x i32> %interleaved, <2 x i32>* %B - ret void -} - -; NEON-LABEL: store_address_space -; NEON: vst2.32 -; NONEON-LABEL: store_address_space -; NONEON-NOT: vst2 -define void @store_address_space(<2 x i32>* %A, <2 x i32>* %B, <4 x i32> addrspace(1)* %C) { - %tmp0 = load <2 x i32>, <2 x i32>* %A - %tmp1 = load <2 x i32>, <2 x i32>* %B - %interleaved = shufflevector <2 x i32> %tmp0, <2 x i32> %tmp1, <4 x i32> <i32 0, i32 2, i32 1, i32 3> - store <4 x i32> %interleaved, <4 x i32> addrspace(1)* %C - ret void -} - -; Check that we do something sane with illegal types. - -; NEON-LABEL: load_illegal_factor2: -; NEON: BB#0: -; NEON-NEXT: vld1.64 {d16, d17}, [r0:128] -; NEON-NEXT: vuzp.32 q8, {{.*}} -; NEON-NEXT: vmov r0, r1, d16 -; NEON-NEXT: vmov r2, r3, {{.*}} -; NEON-NEXT: mov pc, lr -; NONEON-LABEL: load_illegal_factor2: -; NONEON: BB#0: -; NONEON-NEXT: ldr [[ELT0:r[0-9]+]], [r0] -; NONEON-NEXT: ldr r1, [r0, #8] -; NONEON-NEXT: mov r0, [[ELT0]] -; NONEON-NEXT: mov pc, lr -define <3 x float> @load_illegal_factor2(<3 x float>* %p) nounwind { - %tmp1 = load <3 x float>, <3 x float>* %p, align 16 - %tmp2 = shufflevector <3 x float> %tmp1, <3 x float> undef, <3 x i32> <i32 0, i32 2, i32 undef> - ret <3 x float> %tmp2 -} - -; This lowering isn't great, but it's at least correct. - -; NEON-LABEL: store_illegal_factor2: -; NEON: BB#0: -; NEON-NEXT: vldr d17, [sp] -; NEON-NEXT: vmov d16, r2, r3 -; NEON-NEXT: vuzp.32 q8, {{.*}} -; NEON-NEXT: vstr d16, [r0] -; NEON-NEXT: mov pc, lr -; NONEON-LABEL: store_illegal_factor2: -; NONEON: BB#0: -; NONEON-NEXT: stm r0, {r1, r3} -; NONEON-NEXT: mov pc, lr -define void @store_illegal_factor2(<3 x float>* %p, <3 x float> %v) nounwind { - %tmp1 = shufflevector <3 x float> %v, <3 x float> undef, <3 x i32> <i32 0, i32 2, i32 undef> - store <3 x float> %tmp1, <3 x float>* %p, align 16 - ret void -} - -; NEON-LABEL: load_factor2_with_extract_user: -; NEON: vld2.32 {d16, d17, d18, d19}, [r0:64] -; NEON: vmov.32 r0, d16[1] -; NONEON-LABEL: load_factor2_with_extract_user: -; NONEON-NOT: vld2 -define i32 @load_factor2_with_extract_user(<8 x i32>* %a) { - %1 = load <8 x i32>, <8 x i32>* %a, align 8 - %2 = shufflevector <8 x i32> %1, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6> - %3 = extractelement <8 x i32> %1, i32 2 - ret i32 %3 -} - -; NEON-LABEL: store_general_mask_factor4: -; NEON: vst4.32 {d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}}, [r0] -; NONEON-LABEL: store_general_mask_factor4: -; NONEON-NOT: vst4.32 -define void @store_general_mask_factor4(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <8 x i32> <i32 4, i32 16, i32 32, i32 8, i32 5, i32 17, i32 33, i32 9> - store <8 x i32> %i.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor4_undefbeg: -; NEON: vst4.32 {d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}}, [r0] -; NONEON-LABEL: store_general_mask_factor4_undefbeg: -; NONEON-NOT: vst4.32 -define void @store_general_mask_factor4_undefbeg(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <8 x i32> <i32 undef, i32 16, i32 32, i32 8, i32 5, i32 17, i32 33, i32 9> - store <8 x i32> %i.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor4_undefend: -; NEON: vst4.32 {d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}}, [r0] -; NONEON-LABEL: store_general_mask_factor4_undefend: -; NONEON-NOT: vst4.32 -define void @store_general_mask_factor4_undefend(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <8 x i32> <i32 4, i32 16, i32 32, i32 8, i32 5, i32 17, i32 33, i32 undef> - store <8 x i32> %i.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor4_undefmid: -; NEON: vst4.32 {d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}}, [r0] -; NONEON-LABEL: store_general_mask_factor4_undefmid: -; NONEON-NOT: vst4.32 -define void @store_general_mask_factor4_undefmid(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <8 x i32> <i32 4, i32 undef, i32 32, i32 8, i32 5, i32 17, i32 undef, i32 9> - store <8 x i32> %i.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor4_undefmulti: -; NEON: vst4.32 {d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}}, [r0] -; NONEON-LABEL: store_general_mask_factor4_undefmulti: -; NONEON-NOT: vst4.32 -define void @store_general_mask_factor4_undefmulti(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <8 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <8 x i32> <i32 4, i32 undef, i32 undef, i32 8, i32 undef, i32 undef, i32 undef, i32 9> - store <8 x i32> %i.vec, <8 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3: -; NEON: vst3.32 {d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}}, [r0] -; NONEON-LABEL: store_general_mask_factor3: -; NONEON-NOT: vst3.32 -define void @store_general_mask_factor3(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 4, i32 32, i32 16, i32 5, i32 33, i32 17, i32 6, i32 34, i32 18, i32 7, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_undefmultimid: -; NEON: vst3.32 {d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}}, [r0] -; NONEON-LABEL: store_general_mask_factor3_undefmultimid: -; NONEON-NOT: vst3.32 -define void @store_general_mask_factor3_undefmultimid(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 4, i32 32, i32 16, i32 undef, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 7, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_undef_fail: -; NEON-NOT: vst3.32 -; NONEON-LABEL: store_general_mask_factor3_undef_fail: -; NONEON-NOT: vst3.32 -define void @store_general_mask_factor3_undef_fail(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 4, i32 32, i32 16, i32 undef, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 8, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_undeflane: -; NEON: vst3.32 {d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}}, [r0] -; NONEON-LABEL: store_general_mask_factor3_undeflane: -; NONEON-NOT: vst3.32 -define void @store_general_mask_factor3_undeflane(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 undef, i32 32, i32 16, i32 undef, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 undef, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_endstart_fail: -; NEON-NOT: vst3.32 -; NONEON-LABEL: store_general_mask_factor3_endstart_fail: -; NONEON-NOT: vst3.32 -define void @store_general_mask_factor3_endstart_fail(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 undef, i32 32, i32 16, i32 undef, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 2, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_endstart_pass: -; NEON: vst3.32 {d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}}, [r0] -; NONEON-LABEL: store_general_mask_factor3_endstart_pass: -; NONEON-NOT: vst3.32 -define void @store_general_mask_factor3_endstart_pass(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 undef, i32 32, i32 16, i32 undef, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 7, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_midstart_fail: -; NEON-NOT: vst3.32 -; NONEON-LABEL: store_general_mask_factor3_midstart_fail: -; NONEON-NOT: vst3.32 -define void @store_general_mask_factor3_midstart_fail(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 undef, i32 32, i32 16, i32 0, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 undef, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - -; NEON-LABEL: store_general_mask_factor3_midstart_pass: -; NEON: vst3.32 {d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}}, [r0] -; NONEON-LABEL: store_general_mask_factor3_midstart_pass: -; NONEON-NOT: vst3.32 -define void @store_general_mask_factor3_midstart_pass(i32* %ptr, <32 x i32> %v0, <32 x i32> %v1) { - %base = bitcast i32* %ptr to <12 x i32>* - %i.vec = shufflevector <32 x i32> %v0, <32 x i32> %v1, <12 x i32> <i32 undef, i32 32, i32 16, i32 1, i32 33, i32 17, i32 undef, i32 34, i32 18, i32 undef, i32 35, i32 19> - store <12 x i32> %i.vec, <12 x i32>* %base, align 4 - ret void -} - diff --git a/test/CodeGen/SystemZ/pr31710.ll b/test/CodeGen/SystemZ/pr31710.ll new file mode 100644 index 000000000000..1123827fd939 --- /dev/null +++ b/test/CodeGen/SystemZ/pr31710.ll @@ -0,0 +1,39 @@ +; RUN: llc < %s -mtriple=s390x-redhat-linux | FileCheck %s +; +; Triggers a path in SelectionDAG's UpdateChains where a node is +; deleted but we try to read it later (pr31710), invoking UB in +; release mode or hitting an assert if they're enabled. + +; CHECK: btldata: +define void @btldata(i64* %u0, i32** %p0, i32** %p1, i32** %p3, i32** %p5, i32** %p7) { +entry: + %x0 = load i32*, i32** %p0, align 8, !tbaa !0 + store i64 0, i64* %u0, align 8, !tbaa !4 + %x1 = load i32*, i32** %p1, align 8, !tbaa !0 + %x2 = load i32, i32* %x1, align 4, !tbaa !6 + %x2ext = sext i32 %x2 to i64 + store i32 %x2, i32* %x1, align 4, !tbaa !6 + %x3 = load i32*, i32** %p3, align 8, !tbaa !0 + %ptr = getelementptr inbounds i32, i32* %x3, i64 %x2ext + %x4 = load i32, i32* %ptr, align 4, !tbaa !6 + %x4inc = add nsw i32 %x4, 1 + store i32 %x4inc, i32* %ptr, align 4, !tbaa !6 + store i64 undef, i64* %u0, align 8, !tbaa !4 + %x5 = load i32*, i32** %p5, align 8, !tbaa !0 + %x6 = load i32, i32* %x5, align 4, !tbaa !6 + store i32 %x6, i32* %x5, align 4, !tbaa !6 + %x7 = load i32*, i32** %p7, align 8, !tbaa !0 + %x8 = load i32, i32* %x7, align 4, !tbaa !6 + %x8inc = add nsw i32 %x8, 1 + store i32 %x8inc, i32* %x7, align 4, !tbaa !6 + ret void +} + +!0 = !{!1, !1, i64 0} +!1 = !{!"any pointer", !2, i64 0} +!2 = !{!"omnipotent char", !3, i64 0} +!3 = !{!"Simple C/C++ TBAA"} +!4 = !{!5, !5, i64 0} +!5 = !{!"long", !2, i64 0} +!6 = !{!7, !7, i64 0} +!7 = !{!"int", !2, i64 0} |
