1 ; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s
3 ; This code causes an assertion failure if dereferenceable flag is not properly set in the load generated for memcpy
6 ; CHECK: lxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}}
8 ; CHECK: stxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}}
9 ; CHECK: stxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}}
12 define void @func(i1 %flag) {
14 %pairs = alloca [4 x <2 x i64>], align 8
15 %pair1 = getelementptr inbounds [4 x <2 x i64>], ptr %pairs, i64 0, i64 1
16 %pair2 = getelementptr inbounds [4 x <2 x i64>], ptr %pairs, i64 0, i64 2
17 br i1 %flag, label %end, label %dummy
20 ; copy third element into first element by memcpy
21 call void @llvm.memcpy.p0.p0.i64(ptr align 8 nonnull %pairs, ptr align 8 %pair2, i64 16, i1 false)
22 ; copy third element into second element by LD/ST
23 %vec2 = load <2 x i64>, ptr %pair2, align 8
24 store <2 x i64> %vec2, ptr %pair1, align 8
28 ; to make use of %pair2 in another BB
29 call void @llvm.memcpy.p0.p0.i64(ptr %pair2, ptr %pair2, i64 0, i1 false)
35 ; CHECK: lxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}}
37 ; CHECK: stxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}}
38 ; CHECK: stxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}}
41 define void @func2(i1 %flag) {
43 %pairs = alloca [4 x <2 x i64>], align 8
44 %pair1 = getelementptr inbounds [4 x <2 x i64>], ptr %pairs, i64 0, i64 1
45 %pair2 = getelementptr inbounds [4 x <2 x i64>], ptr %pairs, i64 0, i64 2
46 br i1 %flag, label %end, label %dummy
49 ; copy third element into first element by memcpy
50 call void @llvm.memmove.p0.p0.i64(ptr align 8 nonnull %pairs, ptr align 8 %pair2, i64 16, i1 false)
51 ; copy third element into second element by LD/ST
52 %vec2 = load <2 x i64>, ptr %pair2, align 8
53 store <2 x i64> %vec2, ptr %pair1, align 8
57 ; to make use of %pair2 in another BB
58 call void @llvm.memcpy.p0.p0.i64(ptr %pair2, ptr %pair2, i64 0, i1 false)
62 ; Function Attrs: argmemonly nounwind
63 declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1) #1
64 declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1) #1
66 attributes #1 = { argmemonly nounwind }