2016-12-29 22:31:07 +08:00
|
|
|
; RUN: not opt -verify < %s 2>&1 | FileCheck %s
|
|
|
|
|
2017-06-16 22:43:59 +08:00
|
|
|
define void @test_memcpy(i8* %P, i8* %Q, i32 %A, i32 %E) {
|
|
|
|
; CHECK: element size of the element-wise unordered atomic memory intrinsic must be a constant int
|
|
|
|
call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i32(i8* align 4 %P, i8* align 4 %Q, i32 1, i32 %E)
|
2016-12-29 22:31:07 +08:00
|
|
|
; CHECK: element size of the element-wise atomic memory intrinsic must be a power of 2
|
2017-06-16 22:43:59 +08:00
|
|
|
call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i32(i8* align 4 %P, i8* align 4 %Q, i32 1, i32 3)
|
2016-12-29 22:31:07 +08:00
|
|
|
|
2017-06-16 22:43:59 +08:00
|
|
|
; CHECK: constant length must be a multiple of the element size in the element-wise atomic memory intrinsic
|
|
|
|
call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i32(i8* align 4 %P, i8* align 4 %Q, i32 7, i32 4)
|
|
|
|
|
|
|
|
; CHECK: incorrect alignment of the destination argument
|
|
|
|
call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i32(i8* %P, i8* align 4 %Q, i32 1, i32 1)
|
2016-12-29 22:31:07 +08:00
|
|
|
; CHECK: incorrect alignment of the destination argument
|
2017-06-16 22:43:59 +08:00
|
|
|
call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i32(i8* align 1 %P, i8* align 4 %Q, i32 4, i32 4)
|
2016-12-29 22:31:07 +08:00
|
|
|
|
|
|
|
; CHECK: incorrect alignment of the source argument
|
2017-06-16 22:43:59 +08:00
|
|
|
call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i32(i8* align 4 %P, i8* %Q, i32 1, i32 1)
|
|
|
|
; CHECK: incorrect alignment of the source argument
|
|
|
|
call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i32(i8* align 4 %P, i8* align 1 %Q, i32 4, i32 4)
|
2016-12-29 22:31:07 +08:00
|
|
|
|
|
|
|
ret void
|
|
|
|
}
|
2017-06-16 22:43:59 +08:00
|
|
|
declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind
|
2017-07-12 23:25:26 +08:00
|
|
|
|
|
|
|
define void @test_memmove(i8* %P, i8* %Q, i32 %A, i32 %E) {
|
|
|
|
; CHECK: element size of the element-wise unordered atomic memory intrinsic must be a constant int
|
|
|
|
call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i32(i8* align 4 %P, i8* align 4 %Q, i32 1, i32 %E)
|
|
|
|
; CHECK: element size of the element-wise atomic memory intrinsic must be a power of 2
|
|
|
|
call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i32(i8* align 4 %P, i8* align 4 %Q, i32 1, i32 3)
|
|
|
|
|
|
|
|
; CHECK: constant length must be a multiple of the element size in the element-wise atomic memory intrinsic
|
|
|
|
call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i32(i8* align 4 %P, i8* align 4 %Q, i32 7, i32 4)
|
|
|
|
|
|
|
|
; CHECK: incorrect alignment of the destination argument
|
|
|
|
call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i32(i8* %P, i8* align 4 %Q, i32 1, i32 1)
|
|
|
|
; CHECK: incorrect alignment of the destination argument
|
|
|
|
call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i32(i8* align 1 %P, i8* align 4 %Q, i32 4, i32 4)
|
|
|
|
|
|
|
|
; CHECK: incorrect alignment of the source argument
|
|
|
|
call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i32(i8* align 4 %P, i8* %Q, i32 1, i32 1)
|
|
|
|
; CHECK: incorrect alignment of the source argument
|
|
|
|
call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i32(i8* align 4 %P, i8* align 1 %Q, i32 4, i32 4)
|
|
|
|
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
declare void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind
|
|
|
|
|
Add element atomic memset intrinsic
Summary: Continuing the work from https://reviews.llvm.org/D33240, this change introduces an element unordered-atomic memset intrinsic. This intrinsic is essentially memset with the implementation requirement that all stores used for the assignment are done with unordered-atomic stores of a given element size.
Reviewers: eli.friedman, reames, mkazantsev, skatkov
Reviewed By: reames
Subscribers: jfb, dschuff, sbc100, jgravelle-google, aheejin, efriedma, llvm-commits
Differential Revision: https://reviews.llvm.org/D34885
llvm-svn: 307854
2017-07-13 05:57:23 +08:00
|
|
|
define void @test_memset(i8* %P, i8 %V, i32 %A, i32 %E) {
|
|
|
|
; CHECK: element size of the element-wise unordered atomic memory intrinsic must be a constant int
|
|
|
|
call void @llvm.memset.element.unordered.atomic.p0i8.i32(i8* align 4 %P, i8 %V, i32 1, i32 %E)
|
|
|
|
; CHECK: element size of the element-wise atomic memory intrinsic must be a power of 2
|
|
|
|
call void @llvm.memset.element.unordered.atomic.p0i8.i32(i8* align 4 %P, i8 %V, i32 1, i32 3)
|
|
|
|
|
|
|
|
; CHECK: constant length must be a multiple of the element size in the element-wise atomic memory intrinsic
|
|
|
|
call void @llvm.memset.element.unordered.atomic.p0i8.i32(i8* align 4 %P, i8 %V, i32 7, i32 4)
|
|
|
|
|
|
|
|
; CHECK: incorrect alignment of the destination argument
|
|
|
|
call void @llvm.memset.element.unordered.atomic.p0i8.i32(i8* %P, i8 %V, i32 1, i32 1)
|
|
|
|
; CHECK: incorrect alignment of the destination argument
|
|
|
|
call void @llvm.memset.element.unordered.atomic.p0i8.i32(i8* align 1 %P, i8 %V, i32 4, i32 4)
|
|
|
|
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
declare void @llvm.memset.element.unordered.atomic.p0i8.i32(i8* nocapture, i8, i32, i32) nounwind
|
|
|
|
|
2016-12-29 22:31:07 +08:00
|
|
|
; CHECK: input module is broken!
|