xref: /llvm-project/llvm/test/Analysis/ValueTracking/known-fpclass.ll (revision 38fffa630ee80163dc65e759392ad29798905679)
141b876dbSNoah Goldstein; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
241b876dbSNoah Goldstein; RUN: opt -passes=instsimplify < %s -S | FileCheck %s
341b876dbSNoah Goldstein
441b876dbSNoah Goldsteindefine <4 x i1> @vector_reverse_fpclass(<4 x double> nofpclass(nzero nan) %x) {
541b876dbSNoah Goldstein; CHECK-LABEL: @vector_reverse_fpclass(
6*38fffa63SPaul Walker; CHECK-NEXT:    ret <4 x i1> splat (i1 true)
741b876dbSNoah Goldstein;
841b876dbSNoah Goldstein  %x.abs = call <4 x double> @llvm.fabs.v4f64(<4 x double> %x)
941b876dbSNoah Goldstein  %op = call <4 x double> @llvm.vector.reverse(<4 x double> %x.abs)
1041b876dbSNoah Goldstein  %cmp = fcmp oge <4 x double> %op, <double 0.0, double 0.0, double 0.0, double 0.0>
1141b876dbSNoah Goldstein  ret <4 x i1> %cmp
1241b876dbSNoah Goldstein}
1341b876dbSNoah Goldstein
1441b876dbSNoah Goldsteindefine <4 x i1> @vector_reverse_fpclass2(<4 x double> nofpclass(nzero) %x) {
1541b876dbSNoah Goldstein; CHECK-LABEL: @vector_reverse_fpclass2(
1641b876dbSNoah Goldstein; CHECK-NEXT:    [[X_ABS:%.*]] = call <4 x double> @llvm.fabs.v4f64(<4 x double> [[X:%.*]])
1741b876dbSNoah Goldstein; CHECK-NEXT:    [[OP:%.*]] = call <4 x double> @llvm.vector.reverse.v4f64(<4 x double> [[X_ABS]])
1841b876dbSNoah Goldstein; CHECK-NEXT:    [[CMP:%.*]] = fcmp oge <4 x double> [[OP]], zeroinitializer
1941b876dbSNoah Goldstein; CHECK-NEXT:    ret <4 x i1> [[CMP]]
2041b876dbSNoah Goldstein;
2141b876dbSNoah Goldstein  %x.abs = call <4 x double> @llvm.fabs.v4f64(<4 x double> %x)
2241b876dbSNoah Goldstein  %op = call <4 x double> @llvm.vector.reverse(<4 x double> %x.abs)
2341b876dbSNoah Goldstein  %cmp = fcmp oge <4 x double> %op, <double 0.0, double 0.0, double 0.0, double 0.0>
2441b876dbSNoah Goldstein  ret <4 x i1> %cmp
2541b876dbSNoah Goldstein}
2641b876dbSNoah Goldstein
271dfbd072SNoah Goldsteindefine i1 @vector_reverse_fpclass_demanded(<4 x double> %vec, double nofpclass(nzero nan) %x) {
281dfbd072SNoah Goldstein; CHECK-LABEL: @vector_reverse_fpclass_demanded(
290589762eSNoah Goldstein; CHECK-NEXT:    ret i1 true
301dfbd072SNoah Goldstein;
311dfbd072SNoah Goldstein
321dfbd072SNoah Goldstein  %x.abs = call double @llvm.fabs.f64(double %x)
331dfbd072SNoah Goldstein  %vec.x = insertelement <4 x double> %vec, double %x.abs, i64 1
341dfbd072SNoah Goldstein  %rev = call <4 x double> @llvm.vector.reverse(<4 x double> %vec.x)
351dfbd072SNoah Goldstein  %ele = extractelement <4 x double> %rev, i64 2
361dfbd072SNoah Goldstein  %cmp = fcmp oge double %ele, 0.0
371dfbd072SNoah Goldstein  ret i1 %cmp
381dfbd072SNoah Goldstein}
391dfbd072SNoah Goldstein
401dfbd072SNoah Goldsteindefine i1 @vector_reverse_fpclass_demanded_fail(<4 x double> %vec, double nofpclass(nzero nan) %x) {
411dfbd072SNoah Goldstein; CHECK-LABEL: @vector_reverse_fpclass_demanded_fail(
421dfbd072SNoah Goldstein; CHECK-NEXT:    [[X_ABS:%.*]] = call double @llvm.fabs.f64(double [[X:%.*]])
431dfbd072SNoah Goldstein; CHECK-NEXT:    [[VEC_X:%.*]] = insertelement <4 x double> [[VEC:%.*]], double [[X_ABS]], i64 1
441dfbd072SNoah Goldstein; CHECK-NEXT:    [[REV:%.*]] = call <4 x double> @llvm.vector.reverse.v4f64(<4 x double> [[VEC_X]])
451dfbd072SNoah Goldstein; CHECK-NEXT:    [[ELE:%.*]] = extractelement <4 x double> [[REV]], i64 1
461dfbd072SNoah Goldstein; CHECK-NEXT:    [[CMP:%.*]] = fcmp oge double [[ELE]], 0.000000e+00
471dfbd072SNoah Goldstein; CHECK-NEXT:    ret i1 [[CMP]]
481dfbd072SNoah Goldstein;
491dfbd072SNoah Goldstein
501dfbd072SNoah Goldstein  %x.abs = call double @llvm.fabs.f64(double %x)
511dfbd072SNoah Goldstein  %vec.x = insertelement <4 x double> %vec, double %x.abs, i64 1
521dfbd072SNoah Goldstein  %rev = call <4 x double> @llvm.vector.reverse(<4 x double> %vec.x)
531dfbd072SNoah Goldstein  %ele = extractelement <4 x double> %rev, i64 1
541dfbd072SNoah Goldstein  %cmp = fcmp oge double %ele, 0.0
551dfbd072SNoah Goldstein  ret i1 %cmp
561dfbd072SNoah Goldstein}
57