Skip to content

Commit 0832b85

Browse files
committed
ValueTracking: Add baseline tests for vector fpclass handling
1 parent a4c84d6 commit 0832b85

File tree

1 file changed

+67
-4
lines changed

1 file changed

+67
-4
lines changed

llvm/test/Transforms/Attributor/nofpclass.ll

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,24 @@ define <2 x double> @returned_strange_constant_vector_elt() {
100100
ret <2 x double> <double -0.0, double bitcast (i64 ptrtoint (ptr @unknown to i64) to double)>
101101
}
102102

103-
; Test a vector element that's an undef/poison
103+
; Test a vector element that's undef
104104
define <3 x double> @returned_undef_constant_vector_elt() {
105-
; CHECK-LABEL: define nofpclass(nan inf pzero sub norm) <3 x double> @returned_undef_constant_vector_elt() {
105+
; CHECK-LABEL: define nofpclass(nan inf sub norm) <3 x double> @returned_undef_constant_vector_elt() {
106106
; CHECK-NEXT: call void @unknown()
107-
; CHECK-NEXT: ret <3 x double> <double -0.000000e+00, double poison, double undef>
107+
; CHECK-NEXT: ret <3 x double> <double -0.000000e+00, double 0.000000e+00, double undef>
108108
;
109109
call void @unknown()
110-
ret <3 x double> <double -0.0, double poison, double undef>
110+
ret <3 x double> <double -0.0, double 0.0, double undef>
111+
}
112+
113+
; Test a vector element that's poison
114+
define <3 x double> @returned_poison_constant_vector_elt() {
115+
; CHECK-LABEL: define nofpclass(nan inf sub norm) <3 x double> @returned_poison_constant_vector_elt() {
116+
; CHECK-NEXT: call void @unknown()
117+
; CHECK-NEXT: ret <3 x double> <double -0.000000e+00, double 0.000000e+00, double poison>
118+
;
119+
call void @unknown()
120+
ret <3 x double> <double -0.0, double 0.0, double poison>
111121
}
112122

113123
define <2 x double> @returned_qnan_zero_vector() {
@@ -1790,6 +1800,32 @@ define float @shufflevector_extractelt3(<2 x float> %arg0, <2 x float> nofpclass
17901800
ret float %extract
17911801
}
17921802

1803+
define float @shufflevector_constantdatavector_demanded0() {
1804+
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1805+
; CHECK-LABEL: define nofpclass(snan inf nzero sub nnorm) float @shufflevector_constantdatavector_demanded0
1806+
; CHECK-SAME: () #[[ATTR3]] {
1807+
; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <3 x float> <float 1.000000e+00, float 0x7FF8000000000000, float 0.000000e+00>, <3 x float> poison, <2 x i32> <i32 0, i32 2>
1808+
; CHECK-NEXT: [[EXTRACT:%.*]] = extractelement <2 x float> [[SHUFFLE]], i32 0
1809+
; CHECK-NEXT: ret float [[EXTRACT]]
1810+
;
1811+
%shuffle = shufflevector <3 x float> <float 1.0, float 0x7FF8000000000000, float 0.0>, <3 x float> poison, <2 x i32> <i32 0, i32 2>
1812+
%extract = extractelement <2 x float> %shuffle, i32 0
1813+
ret float %extract
1814+
}
1815+
1816+
define float @shufflevector_constantdatavector_demanded1() {
1817+
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1818+
; CHECK-LABEL: define nofpclass(snan inf nzero sub nnorm) float @shufflevector_constantdatavector_demanded1
1819+
; CHECK-SAME: () #[[ATTR3]] {
1820+
; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <3 x float> <float 1.000000e+00, float 0x7FF8000000000000, float 0.000000e+00>, <3 x float> poison, <2 x i32> <i32 0, i32 2>
1821+
; CHECK-NEXT: [[EXTRACT:%.*]] = extractelement <2 x float> [[SHUFFLE]], i32 1
1822+
; CHECK-NEXT: ret float [[EXTRACT]]
1823+
;
1824+
%shuffle = shufflevector <3 x float> <float 1.0, float 0x7FF8000000000000, float 0.0>, <3 x float> poison, <2 x i32> <i32 0, i32 2>
1825+
%extract = extractelement <2 x float> %shuffle, i32 1
1826+
ret float %extract
1827+
}
1828+
17931829
define i32 @fptosi(float nofpclass(inf nan) %arg) {
17941830
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
17951831
; CHECK-LABEL: define i32 @fptosi
@@ -2606,6 +2642,33 @@ bb:
26062642
ret float %implement.pow
26072643
}
26082644

2645+
define [4 x float] @constant_aggregate_zero() {
2646+
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2647+
; CHECK-LABEL: define [4 x float] @constant_aggregate_zero
2648+
; CHECK-SAME: () #[[ATTR3]] {
2649+
; CHECK-NEXT: ret [4 x float] zeroinitializer
2650+
;
2651+
ret [4 x float] zeroinitializer
2652+
}
2653+
2654+
define <vscale x 4 x float> @scalable_splat_pnorm() {
2655+
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2656+
; CHECK-LABEL: define <vscale x 4 x float> @scalable_splat_pnorm
2657+
; CHECK-SAME: () #[[ATTR3]] {
2658+
; CHECK-NEXT: ret <vscale x 4 x float> shufflevector (<vscale x 4 x float> insertelement (<vscale x 4 x float> poison, float 1.000000e+00, i64 0), <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer)
2659+
;
2660+
ret <vscale x 4 x float> splat (float 1.0)
2661+
}
2662+
2663+
define <vscale x 4 x float> @scalable_splat_zero() {
2664+
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2665+
; CHECK-LABEL: define noundef <vscale x 4 x float> @scalable_splat_zero
2666+
; CHECK-SAME: () #[[ATTR3]] {
2667+
; CHECK-NEXT: ret <vscale x 4 x float> zeroinitializer
2668+
;
2669+
ret <vscale x 4 x float> zeroinitializer
2670+
}
2671+
26092672
declare i64 @_Z13get_global_idj(i32 noundef)
26102673

26112674
attributes #0 = { "denormal-fp-math"="preserve-sign,preserve-sign" }

0 commit comments

Comments
 (0)