You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[TTI] Return a more sensible cost for histogram intrinsic. (#97397)
This is just an initial cost, making it invalid for any target which
doesn't specifically return a cost for now. Also adds an AArch64
specific cost check.
We will need to improve that later, e.g. by returning a scalarization
cost for generic targets and possibly introducing a new TTI method, at
least once LoopVectorize has changed it's cost model. The reason is
that the histogram intrinsic also effectively contains a gather and
scatter, and we will need details of the addressing to determine an
appropriate cost for that.
Copy file name to clipboardExpand all lines: llvm/test/Analysis/CostModel/AArch64/sve-intrinsics.ll
+118Lines changed: 118 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -909,6 +909,123 @@ define void @masked_scatter_v1i128(<1 x i128> %data, <1 x ptr> %ptrs, <1 x i1> %
909
909
retvoid
910
910
}
911
911
912
+
definevoid@histogram_nxv2i64(<vscale x 2 x ptr> %buckets, <vscale x 2 x i1> %mask) #3 {
913
+
; CHECK-LABEL: 'histogram_nxv2i64'
914
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.experimental.vector.histogram.add.nxv2p0.i64(<vscale x 2 x ptr> %buckets, i64 1, <vscale x 2 x i1> %mask)
915
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
916
+
;
917
+
; TYPE_BASED_ONLY-LABEL: 'histogram_nxv2i64'
918
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.experimental.vector.histogram.add.nxv2p0.i64(<vscale x 2 x ptr> %buckets, i64 1, <vscale x 2 x i1> %mask)
919
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
920
+
;
921
+
callvoid@llvm.experimental.vector.histogram.add.nxv2p0.i64(<vscale x 2 x ptr> %buckets, i641, <vscale x 2 x i1> %mask)
922
+
retvoid
923
+
}
924
+
925
+
definevoid@histogram_nxv4i32(<vscale x 4 x ptr> %buckets, <vscale x 4 x i1> %mask) #3 {
926
+
; CHECK-LABEL: 'histogram_nxv4i32'
927
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.experimental.vector.histogram.add.nxv4p0.i32(<vscale x 4 x ptr> %buckets, i32 1, <vscale x 4 x i1> %mask)
928
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
929
+
;
930
+
; TYPE_BASED_ONLY-LABEL: 'histogram_nxv4i32'
931
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 8 for instruction: call void @llvm.experimental.vector.histogram.add.nxv4p0.i32(<vscale x 4 x ptr> %buckets, i32 1, <vscale x 4 x i1> %mask)
932
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
933
+
;
934
+
callvoid@llvm.experimental.vector.histogram.add.nxv4p0.i32(<vscale x 4 x ptr> %buckets, i321, <vscale x 4 x i1> %mask)
935
+
retvoid
936
+
}
937
+
938
+
definevoid@histogram_nxv8i16(<vscale x 8 x ptr> %buckets, <vscale x 8 x i1> %mask) {
939
+
; CHECK-LABEL: 'histogram_nxv8i16'
940
+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.nxv8p0.i16(<vscale x 8 x ptr> %buckets, i16 1, <vscale x 8 x i1> %mask)
941
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
942
+
;
943
+
; TYPE_BASED_ONLY-LABEL: 'histogram_nxv8i16'
944
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.nxv8p0.i16(<vscale x 8 x ptr> %buckets, i16 1, <vscale x 8 x i1> %mask)
945
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
946
+
;
947
+
callvoid@llvm.experimental.vector.histogram.add.nxv8p0.i16(<vscale x 8 x ptr> %buckets, i161, <vscale x 8 x i1> %mask)
948
+
retvoid
949
+
}
950
+
951
+
definevoid@histogram_nxv16i8(<vscale x 16 x ptr> %buckets, <vscale x 16 x i1> %mask) {
952
+
; CHECK-LABEL: 'histogram_nxv16i8'
953
+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.nxv16p0.i8(<vscale x 16 x ptr> %buckets, i8 1, <vscale x 16 x i1> %mask)
954
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
955
+
;
956
+
; TYPE_BASED_ONLY-LABEL: 'histogram_nxv16i8'
957
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.nxv16p0.i8(<vscale x 16 x ptr> %buckets, i8 1, <vscale x 16 x i1> %mask)
958
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
959
+
;
960
+
callvoid@llvm.experimental.vector.histogram.add.nxv16p0.i64(<vscale x 16 x ptr> %buckets, i81, <vscale x 16 x i1> %mask)
961
+
retvoid
962
+
}
963
+
964
+
definevoid@histogram_v2i64(<2 x ptr> %buckets, <2 x i1> %mask) {
965
+
; CHECK-LABEL: 'histogram_v2i64'
966
+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.v2p0.i64(<2 x ptr> %buckets, i64 1, <2 x i1> %mask)
967
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
968
+
;
969
+
; TYPE_BASED_ONLY-LABEL: 'histogram_v2i64'
970
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.v2p0.i64(<2 x ptr> %buckets, i64 1, <2 x i1> %mask)
971
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
972
+
;
973
+
callvoid@llvm.experimental.vector.histogram.add.v2p0.i64(<2 x ptr> %buckets, i641, <2 x i1> %mask)
974
+
retvoid
975
+
}
976
+
977
+
definevoid@histogram_v4i32(<4 x ptr> %buckets, <4 x i1> %mask) {
978
+
; CHECK-LABEL: 'histogram_v4i32'
979
+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.v4p0.i32(<4 x ptr> %buckets, i32 1, <4 x i1> %mask)
980
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
981
+
;
982
+
; TYPE_BASED_ONLY-LABEL: 'histogram_v4i32'
983
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.v4p0.i32(<4 x ptr> %buckets, i32 1, <4 x i1> %mask)
984
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
985
+
;
986
+
callvoid@llvm.experimental.vector.histogram.add.v4p0.i32(<4 x ptr> %buckets, i321, <4 x i1> %mask)
987
+
retvoid
988
+
}
989
+
990
+
definevoid@histogram_v8i16(<8 x ptr> %buckets, <8 x i1> %mask) {
991
+
; CHECK-LABEL: 'histogram_v8i16'
992
+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.v8p0.i16(<8 x ptr> %buckets, i16 1, <8 x i1> %mask)
993
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
994
+
;
995
+
; TYPE_BASED_ONLY-LABEL: 'histogram_v8i16'
996
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.v8p0.i16(<8 x ptr> %buckets, i16 1, <8 x i1> %mask)
997
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
998
+
;
999
+
callvoid@llvm.experimental.vector.histogram.add.v8p0.i16(<8 x ptr> %buckets, i161, <8 x i1> %mask)
1000
+
retvoid
1001
+
}
1002
+
1003
+
definevoid@histogram_v16i8(<16 x ptr> %buckets, <16 x i1> %mask) {
1004
+
; CHECK-LABEL: 'histogram_v16i8'
1005
+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.v16p0.i8(<16 x ptr> %buckets, i8 1, <16 x i1> %mask)
1006
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
1007
+
;
1008
+
; TYPE_BASED_ONLY-LABEL: 'histogram_v16i8'
1009
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.v16p0.i8(<16 x ptr> %buckets, i8 1, <16 x i1> %mask)
1010
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
1011
+
;
1012
+
callvoid@llvm.experimental.vector.histogram.add.v16p0.i64(<16 x ptr> %buckets, i81, <16 x i1> %mask)
1013
+
retvoid
1014
+
}
1015
+
1016
+
definevoid@histogram_nxv4i64(<vscale x 4 x ptr> %buckets, <vscale x 4 x i1> %mask) {
1017
+
; CHECK-LABEL: 'histogram_nxv4i64'
1018
+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.nxv4p0.i64(<vscale x 4 x ptr> %buckets, i64 1, <vscale x 4 x i1> %mask)
1019
+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
1020
+
;
1021
+
; TYPE_BASED_ONLY-LABEL: 'histogram_nxv4i64'
1022
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: call void @llvm.experimental.vector.histogram.add.nxv4p0.i64(<vscale x 4 x ptr> %buckets, i64 1, <vscale x 4 x i1> %mask)
1023
+
; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
1024
+
;
1025
+
callvoid@llvm.experimental.vector.histogram.add.nxv4p0.i64(<vscale x 4 x ptr> %buckets, i641, <vscale x 4 x i1> %mask)
1026
+
retvoid
1027
+
}
1028
+
912
1029
declare <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i64(i64, i64)
913
1030
declare <vscale x 8 x i1> @llvm.get.active.lane.mask.nxv8i1.i64(i64, i64)
914
1031
declare <vscale x 4 x i1> @llvm.get.active.lane.mask.nxv4i1.i64(i64, i64)
@@ -949,3 +1066,4 @@ declare void @llvm.masked.scatter.v1i128.v1p0(<1 x i128> %data, <1 x ptr> %ptrs,
0 commit comments