| 1 |
; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s |
| 2 |
|
| 3 |
; This code causes an assertion failure if dereferenceable flag is not properly set in the load generated for memcpy |
| 4 |
|
| 5 |
; CHECK-LABEL: @func |
| 6 |
; CHECK: lxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}} |
| 7 |
; CHECK-NOT: lxvd2x |
| 8 |
; CHECK: stxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}} |
| 9 |
; CHECK: stxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}} |
| 10 |
; CHECK: blr |
| 11 |
|
| 12 |
define void @func(i1 %flag) { |
| 13 |
entry: |
| 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 |
| 18 |
|
| 19 |
end: |
| 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 |
| 25 |
ret void |
| 26 |
|
| 27 |
dummy: |
| 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) |
| 30 |
br label %end |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
; CHECK-LABEL: @func2 |
| 35 |
; CHECK: lxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}} |
| 36 |
; CHECK-NOT: lxvd2x |
| 37 |
; CHECK: stxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}} |
| 38 |
; CHECK: stxvd2x [[VREG:[0-9]+]], {{[0-9]+}}, {{[0-9]+}} |
| 39 |
; CHECK: blr |
| 40 |
|
| 41 |
define void @func2(i1 %flag) { |
| 42 |
entry: |
| 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 |
| 47 |
|
| 48 |
end: |
| 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 |
| 54 |
ret void |
| 55 |
|
| 56 |
dummy: |
| 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) |
| 59 |
br label %end |
| 60 |
} |
| 61 |
|
| 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 |
| 65 |
|
| 66 |
attributes #1 = { argmemonly nounwind } |