The `masked.load`, `masked.store`, `masked.gather` and `masked.scatter` intrinsics currently accept a separate alignment immarg. Replace this with an `align` attribute on the pointer / vector of pointers argument. This is the standard representation for alignment information on intrinsics, and is already used by all other memory intrinsics. This means the signatures now match llvm.expandload, llvm.vp.load, etc. (Things like llvm.memcpy used to have a separate alignment argument as well, but were already migrated a long time ago.) It's worth noting that the masked.gather and masked.scatter intrinsics previously accepted a zero alignment to indicate the ABI type alignment of the element type. This special case is gone now: If the align attribute is omitted, the implied alignment is 1, as usual. If ABI alignment is desired, it needs to be explicitly emitted (which the IRBuilder API already requires anyway).
152 lines
9.0 KiB
LLVM
152 lines
9.0 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
|
|
; RUN: opt -S < %s | FileCheck %s
|
|
define <4 x i32> @load(ptr nocapture readonly %a0) !dbg !8 {
|
|
; CHECK-LABEL: define <4 x i32> @load(
|
|
; CHECK-SAME: ptr readonly captures(none) [[A0:%.*]]) !dbg [[DBG8:![0-9]+]] {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[V0:%.*]] = call <4 x i32> @llvm.masked.load.v4i32.p0(ptr align 16 [[A0]], <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i32> undef), !dbg [[DBG19:![0-9]+]], !tbaa [[CHAR_TBAA20:![0-9]+]]
|
|
; CHECK-NEXT: ret <4 x i32> [[V0]], !dbg [[DBG23:![0-9]+]]
|
|
;
|
|
entry:
|
|
%v0 = call <4 x i32> @llvm.masked.load.v4i32.p0(ptr %a0, i32 16, <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i32> undef), !dbg !19, !tbaa !20
|
|
ret <4 x i32> %v0, !dbg !23
|
|
}
|
|
|
|
define void @store(<4 x i32> %a0, ptr nocapture %a1) !dbg !24 {
|
|
; CHECK-LABEL: define void @store(
|
|
; CHECK-SAME: <4 x i32> [[A0:%.*]], ptr captures(none) [[A1:%.*]]) !dbg [[DBG24:![0-9]+]] {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: call void @llvm.masked.store.v4i32.p0(<4 x i32> [[A0]], ptr align 16 [[A1]], <4 x i1> <i1 false, i1 true, i1 false, i1 true>), !dbg [[DBG30:![0-9]+]], !tbaa [[CHAR_TBAA20]]
|
|
; CHECK-NEXT: ret void, !dbg [[DBG31:![0-9]+]]
|
|
;
|
|
entry:
|
|
call void @llvm.masked.store.v4i32.p0(<4 x i32> %a0, ptr %a1, i32 16, <4 x i1> <i1 false, i1 true, i1 false, i1 true>), !dbg !30, !tbaa !20
|
|
ret void, !dbg !31
|
|
}
|
|
|
|
define <4 x i32> @gather(<4 x ptr> %a0) !dbg !32 {
|
|
; CHECK-LABEL: define <4 x i32> @gather(
|
|
; CHECK-SAME: <4 x ptr> [[A0:%.*]]) !dbg [[DBG32:![0-9]+]] {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[V0:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> align 16 [[A0]], <4 x i1> <i1 true, i1 true, i1 true, i1 false>, <4 x i32> undef), !dbg [[DBG35:![0-9]+]], !tbaa [[CHAR_TBAA20]]
|
|
; CHECK-NEXT: ret <4 x i32> [[V0]], !dbg [[DBG36:![0-9]+]]
|
|
;
|
|
entry:
|
|
%v0 = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> %a0, i32 16, <4 x i1> <i1 true, i1 true, i1 true, i1 false>, <4 x i32> undef), !dbg !35, !tbaa !20
|
|
ret <4 x i32> %v0, !dbg !36
|
|
}
|
|
|
|
define void @scatter(<4 x i32> %a0, <4 x ptr> %a1) !dbg !37 {
|
|
; CHECK-LABEL: define void @scatter(
|
|
; CHECK-SAME: <4 x i32> [[A0:%.*]], <4 x ptr> [[A1:%.*]]) !dbg [[DBG37:![0-9]+]] {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> [[A0]], <4 x ptr> align 16 [[A1]], <4 x i1> <i1 false, i1 true, i1 true, i1 true>), !dbg [[DBG41:![0-9]+]], !tbaa [[CHAR_TBAA20]]
|
|
; CHECK-NEXT: ret void, !dbg [[DBG42:![0-9]+]]
|
|
;
|
|
entry:
|
|
call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> %a0, <4 x ptr> %a1, i32 16, <4 x i1> <i1 false, i1 true, i1 true, i1 true>), !dbg !41, !tbaa !20
|
|
ret void, !dbg !42
|
|
}
|
|
|
|
define <4 x i32> @expandload(ptr nocapture readonly %a0) !dbg !43 {
|
|
; CHECK-LABEL: define <4 x i32> @expandload(
|
|
; CHECK-SAME: ptr readonly captures(none) [[A0:%.*]]) !dbg [[DBG43:![0-9]+]] {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[V0:%.*]] = call <4 x i32> @llvm.masked.expandload.v4i32(ptr [[A0]], <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef), !dbg [[DBG49:![0-9]+]], !tbaa [[INT_TBAA50:![0-9]+]]
|
|
; CHECK-NEXT: ret <4 x i32> [[V0]], !dbg [[DBG52:![0-9]+]]
|
|
;
|
|
entry:
|
|
%v0 = call <4 x i32> @llvm.masked.expandload.v4i32(ptr %a0, <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef), !dbg !49, !tbaa !50
|
|
ret <4 x i32> %v0, !dbg !52
|
|
}
|
|
|
|
define void @compressstore(<4 x i32> %a0, ptr nocapture %a1) !dbg !53 {
|
|
; CHECK-LABEL: define void @compressstore(
|
|
; CHECK-SAME: <4 x i32> [[A0:%.*]], ptr captures(none) [[A1:%.*]]) !dbg [[DBG53:![0-9]+]] {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: call void @llvm.masked.compressstore.v4i32(<4 x i32> [[A0]], ptr [[A1]], <4 x i1> <i1 false, i1 false, i1 true, i1 true>), !dbg [[DBG59:![0-9]+]], !tbaa [[INT_TBAA50]]
|
|
; CHECK-NEXT: ret void, !dbg [[DBG60:![0-9]+]]
|
|
;
|
|
entry:
|
|
call void @llvm.masked.compressstore.v4i32(<4 x i32> %a0, ptr %a1, <4 x i1> <i1 false, i1 false, i1 true, i1 true>), !dbg !59, !tbaa !50
|
|
ret void, !dbg !60
|
|
}
|
|
|
|
declare <4 x i32> @llvm.masked.load.v4i32.p0(ptr, i32 immarg, <4 x i1>, <4 x i32>) #0
|
|
declare void @llvm.masked.store.v4i32.p0(<4 x i32>, ptr, i32 immarg, <4 x i1>) #1
|
|
declare <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr>, i32 immarg, <4 x i1>, <4 x i32>) #2
|
|
declare void @llvm.masked.scatter.v4i32.v4p0(<4 x i32>, <4 x ptr>, i32 immarg, <4 x i1>) #3
|
|
declare <4 x i32> @llvm.masked.expandload.v4i32(ptr, <4 x i1>, <4 x i32>) #2
|
|
declare void @llvm.masked.compressstore.v4i32(<4 x i32>, ptr, <4 x i1>) #1
|
|
|
|
attributes #0 = { argmemonly nofree nosync nounwind readonly willreturn }
|
|
attributes #1 = { argmemonly nofree nosync nounwind willreturn writeonly }
|
|
attributes #2 = { nofree nosync nounwind readonly willreturn }
|
|
attributes #3 = { nofree nosync nounwind willreturn writeonly }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!3, !4, !5, !6}
|
|
!llvm.ident = !{!7}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project 985ab6e1fa575fc41ebfdafbba401e5787661584)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
|
|
!1 = !DIFile(filename: "test.c", directory: "/test")
|
|
!2 = !{}
|
|
!3 = !{i32 7, !"Dwarf Version", i32 4}
|
|
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!5 = !{i32 1, !"wchar_size", i32 4}
|
|
!6 = !{i32 7, !"uwtable", i32 1}
|
|
!7 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project 985ab6e1fa575fc41ebfdafbba401e5787661584)"}
|
|
!8 = distinct !DISubprogram(name: "load", scope: !1, file: !1, line: 3, type: !9, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17)
|
|
!9 = !DISubroutineType(types: !10)
|
|
!10 = !{!11, !16}
|
|
!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "v4i32", file: !1, line: 1, baseType: !12)
|
|
!12 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 128, flags: DIFlagVector, elements: !14)
|
|
!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
!14 = !{!15}
|
|
!15 = !DISubrange(count: 4)
|
|
!16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
|
|
!17 = !{!18}
|
|
!18 = !DILocalVariable(name: "a0", arg: 1, scope: !8, file: !1, line: 3, type: !16)
|
|
!19 = !DILocation(line: 4, column: 10, scope: !8)
|
|
!20 = !{!21, !21, i64 0}
|
|
!21 = !{!"omnipotent char", !22, i64 0}
|
|
!22 = !{!"Simple C/C++ TBAA"}
|
|
!23 = !DILocation(line: 4, column: 3, scope: !8)
|
|
!24 = distinct !DISubprogram(name: "store", scope: !1, file: !1, line: 7, type: !25, scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !27)
|
|
!25 = !DISubroutineType(types: !26)
|
|
!26 = !{null, !11, !16}
|
|
!27 = !{!28, !29}
|
|
!28 = !DILocalVariable(name: "a0", arg: 1, scope: !24, file: !1, line: 7, type: !11)
|
|
!29 = !DILocalVariable(name: "a1", arg: 2, scope: !24, file: !1, line: 7, type: !16)
|
|
!30 = !DILocation(line: 8, column: 7, scope: !24)
|
|
!31 = !DILocation(line: 9, column: 1, scope: !24)
|
|
!32 = distinct !DISubprogram(name: "gather", scope: !1, file: !1, line: 11, type: !9, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !33)
|
|
!33 = !{!34}
|
|
!34 = !DILocalVariable(name: "a0", arg: 1, scope: !32, file: !1, line: 11, type: !16)
|
|
!35 = !DILocation(line: 12, column: 10, scope: !32)
|
|
!36 = !DILocation(line: 12, column: 3, scope: !32)
|
|
!37 = distinct !DISubprogram(name: "scatter", scope: !1, file: !1, line: 15, type: !25, scopeLine: 15, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !38)
|
|
!38 = !{!39, !40}
|
|
!39 = !DILocalVariable(name: "a0", arg: 1, scope: !37, file: !1, line: 15, type: !11)
|
|
!40 = !DILocalVariable(name: "a1", arg: 2, scope: !37, file: !1, line: 15, type: !16)
|
|
!41 = !DILocation(line: 16, column: 7, scope: !37)
|
|
!42 = !DILocation(line: 17, column: 1, scope: !37)
|
|
!43 = distinct !DISubprogram(name: "expandload", scope: !1, file: !1, line: 19, type: !44, scopeLine: 19, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !47)
|
|
!44 = !DISubroutineType(types: !45)
|
|
!45 = !{!11, !46}
|
|
!46 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64)
|
|
!47 = !{!48}
|
|
!48 = !DILocalVariable(name: "a0", arg: 1, scope: !43, file: !1, line: 19, type: !46)
|
|
!49 = !DILocation(line: 19, column: 40, scope: !43)
|
|
!50 = !{!51, !51, i64 0}
|
|
!51 = !{!"int", !21, i64 0}
|
|
!52 = !DILocation(line: 20, column: 3, scope: !43)
|
|
!53 = distinct !DISubprogram(name: "compressstore", scope: !1, file: !1, line: 23, type: !54, scopeLine: 23, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !56)
|
|
!54 = !DISubroutineType(types: !55)
|
|
!55 = !{null, !11, !46}
|
|
!56 = !{!57, !58}
|
|
!57 = !DILocalVariable(name: "a0", arg: 1, scope: !53, file: !1, line: 23, type: !11)
|
|
!58 = !DILocalVariable(name: "a1", arg: 2, scope: !53, file: !1, line: 23, type: !46)
|
|
!59 = !DILocation(line: 24, column: 7, scope: !53)
|
|
!60 = !DILocation(line: 25, column: 1, scope: !53)
|