xref: /llvm-project/llvm/test/Verifier/element-wise-atomic-memory-intrinsics.ll (revision c820f2a43eaba02db97c4ff60c58a58e6bdd391d)
1; RUN: not opt -passes=verify < %s 2>&1 | FileCheck %s
2
3define void @test_memcpy(ptr %P, ptr %Q, i32 %A, i32 %E) {
4  ; CHECK: immarg operand has non-immediate parameter
5  ; CHECK: i32 %E
6  ; CHECK-NEXT: call void @llvm.memcpy.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr align 4 %Q, i32 1, i32 %E)
7  call void @llvm.memcpy.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr align 4 %Q, i32 1, i32 %E)
8
9  ; CHECK: element size of the element-wise atomic memory intrinsic must be a power of 2
10  call void @llvm.memcpy.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr align 4 %Q, i32 1, i32 3)
11
12  call void @llvm.memcpy.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr align 4 %Q, i32 7, i32 4)
13
14  ; CHECK: incorrect alignment of the destination argument
15  call void @llvm.memcpy.element.unordered.atomic.p0.p0.i32(ptr %P, ptr align 4 %Q, i32 1, i32 1)
16  ; CHECK: incorrect alignment of the destination argument
17  call void @llvm.memcpy.element.unordered.atomic.p0.p0.i32(ptr align 1 %P, ptr align 4 %Q, i32 4, i32 4)
18
19  ; CHECK: incorrect alignment of the source argument
20  call void @llvm.memcpy.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr %Q, i32 1, i32 1)
21  ; CHECK: incorrect alignment of the source argument
22  call void @llvm.memcpy.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr align 1 %Q, i32 4, i32 4)
23
24  ret void
25}
26
27declare void @llvm.memcpy.element.unordered.atomic.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i32) nounwind
28
29define void @test_memmove(ptr %P, ptr %Q, i32 %A, i32 %E) {
30  ; CHECK: immarg operand has non-immediate parameter
31  ; CHECK-NEXT: i32 %E
32  ; CHECK-NEXT: call void @llvm.memmove.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr align 4 %Q, i32 1, i32 %E)
33  call void @llvm.memmove.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr align 4 %Q, i32 1, i32 %E)
34
35  ; CHECK: element size of the element-wise atomic memory intrinsic must be a power of 2
36  call void @llvm.memmove.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr align 4 %Q, i32 1, i32 3)
37
38  call void @llvm.memmove.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr align 4 %Q, i32 7, i32 4)
39
40  ; CHECK: incorrect alignment of the destination argument
41  call void @llvm.memmove.element.unordered.atomic.p0.p0.i32(ptr %P, ptr align 4 %Q, i32 1, i32 1)
42  ; CHECK: incorrect alignment of the destination argument
43  call void @llvm.memmove.element.unordered.atomic.p0.p0.i32(ptr align 1 %P, ptr align 4 %Q, i32 4, i32 4)
44
45  ; CHECK: incorrect alignment of the source argument
46  call void @llvm.memmove.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr %Q, i32 1, i32 1)
47  ; CHECK: incorrect alignment of the source argument
48  call void @llvm.memmove.element.unordered.atomic.p0.p0.i32(ptr align 4 %P, ptr align 1 %Q, i32 4, i32 4)
49
50  ret void
51}
52
53declare void @llvm.memmove.element.unordered.atomic.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i32) nounwind
54
55define void @test_memset(ptr %P, i8 %V, i32 %A, i32 %E) {
56  ; CHECK: immarg operand has non-immediate parameter
57  ; CHECK: i32 %E
58  ; CHECK: call void @llvm.memset.element.unordered.atomic.p0.i32(ptr align 4 %P, i8 %V, i32 1, i32 %E)
59  call void @llvm.memset.element.unordered.atomic.p0.i32(ptr align 4 %P, i8 %V, i32 1, i32 %E)
60
61  ; CHECK: element size of the element-wise atomic memory intrinsic must be a power of 2
62  call void @llvm.memset.element.unordered.atomic.p0.i32(ptr align 4 %P, i8 %V, i32 1, i32 3)
63
64  call void @llvm.memset.element.unordered.atomic.p0.i32(ptr align 4 %P, i8 %V, i32 7, i32 4)
65
66  ; CHECK: incorrect alignment of the destination argument
67  call void @llvm.memset.element.unordered.atomic.p0.i32(ptr %P, i8 %V, i32 1, i32 1)
68  ; CHECK: incorrect alignment of the destination argument
69  call void @llvm.memset.element.unordered.atomic.p0.i32(ptr align 1 %P, i8 %V, i32 4, i32 4)
70
71  ret void
72}
73declare void @llvm.memset.element.unordered.atomic.p0.i32(ptr nocapture, i8, i32, i32) nounwind
74
75; CHECK: input module is broken!
76