1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=instsimplify < %s -S | FileCheck %s
4 define <4 x i1> @vector_reverse_fpclass(<4 x double> nofpclass(nzero nan) %x) {
5 ; CHECK-LABEL: @vector_reverse_fpclass(
6 ; CHECK-NEXT: ret <4 x i1> splat (i1 true)
8 %x.abs = call <4 x double> @llvm.fabs.v4f64(<4 x double> %x)
9 %op = call <4 x double> @llvm.vector.reverse(<4 x double> %x.abs)
10 %cmp = fcmp oge <4 x double> %op, <double 0.0, double 0.0, double 0.0, double 0.0>
14 define <4 x i1> @vector_reverse_fpclass2(<4 x double> nofpclass(nzero) %x) {
15 ; CHECK-LABEL: @vector_reverse_fpclass2(
16 ; CHECK-NEXT: [[X_ABS:%.*]] = call <4 x double> @llvm.fabs.v4f64(<4 x double> [[X:%.*]])
17 ; CHECK-NEXT: [[OP:%.*]] = call <4 x double> @llvm.vector.reverse.v4f64(<4 x double> [[X_ABS]])
18 ; CHECK-NEXT: [[CMP:%.*]] = fcmp oge <4 x double> [[OP]], zeroinitializer
19 ; CHECK-NEXT: ret <4 x i1> [[CMP]]
21 %x.abs = call <4 x double> @llvm.fabs.v4f64(<4 x double> %x)
22 %op = call <4 x double> @llvm.vector.reverse(<4 x double> %x.abs)
23 %cmp = fcmp oge <4 x double> %op, <double 0.0, double 0.0, double 0.0, double 0.0>
27 define i1 @vector_reverse_fpclass_demanded(<4 x double> %vec, double nofpclass(nzero nan) %x) {
28 ; CHECK-LABEL: @vector_reverse_fpclass_demanded(
29 ; CHECK-NEXT: ret i1 true
32 %x.abs = call double @llvm.fabs.f64(double %x)
33 %vec.x = insertelement <4 x double> %vec, double %x.abs, i64 1
34 %rev = call <4 x double> @llvm.vector.reverse(<4 x double> %vec.x)
35 %ele = extractelement <4 x double> %rev, i64 2
36 %cmp = fcmp oge double %ele, 0.0
40 define i1 @vector_reverse_fpclass_demanded_fail(<4 x double> %vec, double nofpclass(nzero nan) %x) {
41 ; CHECK-LABEL: @vector_reverse_fpclass_demanded_fail(
42 ; CHECK-NEXT: [[X_ABS:%.*]] = call double @llvm.fabs.f64(double [[X:%.*]])
43 ; CHECK-NEXT: [[VEC_X:%.*]] = insertelement <4 x double> [[VEC:%.*]], double [[X_ABS]], i64 1
44 ; CHECK-NEXT: [[REV:%.*]] = call <4 x double> @llvm.vector.reverse.v4f64(<4 x double> [[VEC_X]])
45 ; CHECK-NEXT: [[ELE:%.*]] = extractelement <4 x double> [[REV]], i64 1
46 ; CHECK-NEXT: [[CMP:%.*]] = fcmp oge double [[ELE]], 0.000000e+00
47 ; CHECK-NEXT: ret i1 [[CMP]]
50 %x.abs = call double @llvm.fabs.f64(double %x)
51 %vec.x = insertelement <4 x double> %vec, double %x.abs, i64 1
52 %rev = call <4 x double> @llvm.vector.reverse(<4 x double> %vec.x)
53 %ele = extractelement <4 x double> %rev, i64 1
54 %cmp = fcmp oge double %ele, 0.0