brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · 3fb6b08 Raw
163 lines · plain
1; RUN: llc < %s -mtriple=ve | FileCheck %s2 3;;; Test ‘llvm.minnum.*’ intrinsic4;;;5;;; Syntax:6;;;   This is an overloaded intrinsic. You can use llvm.minnum on any7;;;   floating-point or vector of floating-point type. Not all targets8;;;   support all types however.9;;;10;;; declare float     @llvm.minnum.f32(float %Val0, float %Val1)11;;; declare double    @llvm.minnum.f64(double %Val0, double %Val1)12;;; declare x86_fp80  @llvm.minnum.f80(x86_fp80 %Val0, x86_fp80 %Val1)13;;; declare fp128     @llvm.minnum.f128(fp128 %Val0, fp128 %Val1)14;;; declare ppc_fp128 @llvm.minnum.ppcf128(ppc_fp128 %Val0, ppc_fp128 %Val1)15;;;16;;; Overview:17;;;   The ‘llvm.minnum.*’ intrinsics return the minimum of the two arguments.18;;;19;;; Arguments:20;;;   The arguments and return value are floating-point numbers of the same21;;;   type.22;;;23;;; Semantics:24;;;   Follows the IEEE-754 semantics for minNum, except for handling of25;;;   signaling NaNs. This match’s the behavior of libm’s fmin.26;;;27;;;   If either operand is a NaN, returns the other non-NaN operand.28;;;   Returns NaN only if both operands are NaN. The returned NaN is29;;;   always quiet. If the operands compare equal, returns a value30;;;   that compares equal to both operands. This means that31;;;   fmin(+/-0.0, +/-0.0) could return either -0.0 or 0.0.32;;;33;;;   Unlike the IEEE-754 2008 behavior, this does not distinguish between34;;;   signaling and quiet NaN inputs. If a target’s implementation follows35;;;   the standard and returns a quiet NaN if either input is a signaling36;;;   NaN, the intrinsic lowering is responsible for quieting the inputs37;;;   to correctly return the non-NaN input (e.g. by using the equivalent38;;;   of llvm.canonicalize).39;;;40;;; Note:41;;;   We test only float/double/fp128.42 43; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn44define float @func_fp_fmin_var_float(float noundef %0, float noundef %1) {45; CHECK-LABEL: func_fp_fmin_var_float:46; CHECK:       # %bb.0:47; CHECK-NEXT:    fmin.s %s0, %s0, %s148; CHECK-NEXT:    b.l.t (, %s10)49  %3 = tail call fast float @llvm.minnum.f32(float %0, float %1)50  ret float %351}52 53; Function Attrs: mustprogress nocallback nofree nosync nounwind readnone speculatable willreturn54declare float @llvm.minnum.f32(float, float)55 56; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn57define double @func_fp_fmin_var_double(double noundef %0, double noundef %1) {58; CHECK-LABEL: func_fp_fmin_var_double:59; CHECK:       # %bb.0:60; CHECK-NEXT:    fmin.d %s0, %s0, %s161; CHECK-NEXT:    b.l.t (, %s10)62  %3 = tail call fast double @llvm.minnum.f64(double %0, double %1)63  ret double %364}65 66; Function Attrs: mustprogress nocallback nofree nosync nounwind readnone speculatable willreturn67declare double @llvm.minnum.f64(double, double)68 69; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn70define fp128 @func_fp_fmin_var_quad(fp128 noundef %0, fp128 noundef %1) {71; CHECK-LABEL: func_fp_fmin_var_quad:72; CHECK:       # %bb.0:73; CHECK-NEXT:    fcmp.q %s4, %s0, %s274; CHECK-NEXT:    cmov.d.lt %s2, %s0, %s475; CHECK-NEXT:    cmov.d.lt %s3, %s1, %s476; CHECK-NEXT:    or %s0, 0, %s277; CHECK-NEXT:    or %s1, 0, %s378; CHECK-NEXT:    b.l.t (, %s10)79  %3 = tail call fast fp128 @llvm.minnum.f128(fp128 %0, fp128 %1)80  ret fp128 %381}82 83; Function Attrs: mustprogress nocallback nofree nosync nounwind readnone speculatable willreturn84declare fp128 @llvm.minnum.f128(fp128, fp128)85 86; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn87define float @func_fp_fmin_zero_float(float noundef %0) {88; CHECK-LABEL: func_fp_fmin_zero_float:89; CHECK:       # %bb.0:90; CHECK-NEXT:    fmin.s %s0, %s0, (0)191; CHECK-NEXT:    b.l.t (, %s10)92  %2 = tail call fast float @llvm.minnum.f32(float %0, float 0.000000e+00)93  ret float %294}95 96; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn97define double @func_fp_fmin_zero_double(double noundef %0) {98; CHECK-LABEL: func_fp_fmin_zero_double:99; CHECK:       # %bb.0:100; CHECK-NEXT:    fmin.d %s0, %s0, (0)1101; CHECK-NEXT:    b.l.t (, %s10)102  %2 = tail call fast double @llvm.minnum.f64(double %0, double 0.000000e+00)103  ret double %2104}105 106; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn107define fp128 @func_fp_fmin_zero_quad(fp128 noundef %0) {108; CHECK-LABEL: func_fp_fmin_zero_quad:109; CHECK:       # %bb.0:110; CHECK-NEXT:    lea %s2, .LCPI{{[0-9]+}}_0@lo111; CHECK-NEXT:    and %s2, %s2, (32)0112; CHECK-NEXT:    lea.sl %s4, .LCPI{{[0-9]+}}_0@hi(, %s2)113; CHECK-NEXT:    ld %s2, 8(, %s4)114; CHECK-NEXT:    ld %s3, (, %s4)115; CHECK-NEXT:    fcmp.q %s4, %s0, %s2116; CHECK-NEXT:    cmov.d.lt %s2, %s0, %s4117; CHECK-NEXT:    cmov.d.lt %s3, %s1, %s4118; CHECK-NEXT:    or %s0, 0, %s2119; CHECK-NEXT:    or %s1, 0, %s3120; CHECK-NEXT:    b.l.t (, %s10)121  %2 = tail call fast fp128 @llvm.minnum.f128(fp128 %0, fp128 0xL00000000000000000000000000000000)122  ret fp128 %2123}124 125; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn126define float @func_fp_fmin_const_float(float noundef %0) {127; CHECK-LABEL: func_fp_fmin_const_float:128; CHECK:       # %bb.0:129; CHECK-NEXT:    fmin.s %s0, %s0, (2)1130; CHECK-NEXT:    b.l.t (, %s10)131  %2 = tail call fast float @llvm.minnum.f32(float %0, float -2.000000e+00)132  ret float %2133}134 135; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn136define double @func_fp_fmin_const_double(double noundef %0) {137; CHECK-LABEL: func_fp_fmin_const_double:138; CHECK:       # %bb.0:139; CHECK-NEXT:    fmin.d %s0, %s0, (2)1140; CHECK-NEXT:    b.l.t (, %s10)141  %2 = tail call fast double @llvm.minnum.f64(double %0, double -2.000000e+00)142  ret double %2143}144 145; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn146define fp128 @func_fp_fmin_const_quad(fp128 noundef %0) {147; CHECK-LABEL: func_fp_fmin_const_quad:148; CHECK:       # %bb.0:149; CHECK-NEXT:    lea %s2, .LCPI{{[0-9]+}}_0@lo150; CHECK-NEXT:    and %s2, %s2, (32)0151; CHECK-NEXT:    lea.sl %s4, .LCPI{{[0-9]+}}_0@hi(, %s2)152; CHECK-NEXT:    ld %s2, 8(, %s4)153; CHECK-NEXT:    ld %s3, (, %s4)154; CHECK-NEXT:    fcmp.q %s4, %s0, %s2155; CHECK-NEXT:    cmov.d.lt %s2, %s0, %s4156; CHECK-NEXT:    cmov.d.lt %s3, %s1, %s4157; CHECK-NEXT:    or %s0, 0, %s2158; CHECK-NEXT:    or %s1, 0, %s3159; CHECK-NEXT:    b.l.t (, %s10)160  %2 = tail call fast fp128 @llvm.minnum.f128(fp128 %0, fp128 0xL0000000000000000C000000000000000)161  ret fp128 %2162}163