brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · a68e561 Raw
140 lines · plain
1; RUN: llc < %s -mtriple=ve | FileCheck %s2 3;;; Test ‘llvm.fabs.*’ Intrinsic4;;;5;;; Syntax:6;;;   This is an overloaded intrinsic. You can use llvm.fabs on any7;;;   floating-point or vector of floating-point type. Not all targets8;;;   support all types however.9;;;10;;; declare float     @llvm.fabs.f32(float  %Val)11;;; declare double    @llvm.fabs.f64(double %Val)12;;; declare x86_fp80  @llvm.fabs.f80(x86_fp80 %Val)13;;; declare fp128     @llvm.fabs.f128(fp128 %Val)14;;; declare ppc_fp128 @llvm.fabs.ppcf128(ppc_fp128 %Val)15;;;16;;; Overview:17;;;   The ‘llvm.fabs.*’ intrinsics return the absolute value of the operand.18;;;19;;; Arguments:20;;;   The argument and return value are floating-point numbers of the same21;;;   type.22;;;23;;; Semantics:24;;;   This function returns the same values as the libm fabs functions would,25;;;   and handles error conditions in the same way.26;;;27;;; Note:28;;;   We test only float/double/fp128.29 30; Function Attrs: nounwind readnone31define float @fabs_float_var(float %0) {32; CHECK-LABEL: fabs_float_var:33; CHECK:       # %bb.0:34; CHECK-NEXT:    sra.l %s0, %s0, 3235; CHECK-NEXT:    and %s0, %s0, (33)036; CHECK-NEXT:    sll %s0, %s0, 3237; CHECK-NEXT:    b.l.t (, %s10)38  %2 = tail call fast float @llvm.fabs.f32(float %0)39  ret float %240}41 42; Function Attrs: nounwind readnone speculatable willreturn43declare float @llvm.fabs.f32(float)44 45; Function Attrs: nounwind readnone46define double @fabs_double_var(double %0) {47; CHECK-LABEL: fabs_double_var:48; CHECK:       # %bb.0:49; CHECK-NEXT:    and %s0, %s0, (1)050; CHECK-NEXT:    b.l.t (, %s10)51  %2 = tail call fast double @llvm.fabs.f64(double %0)52  ret double %253}54 55; Function Attrs: nounwind readnone speculatable willreturn56declare double @llvm.fabs.f64(double)57 58; Function Attrs: nounwind readnone59define fp128 @fabs_quad_var(fp128 %0) {60; CHECK-LABEL: fabs_quad_var:61; CHECK:       .LBB{{[0-9]+}}_2:62; CHECK-NEXT:    st %s1, (, %s11)63; CHECK-NEXT:    st %s0, 8(, %s11)64; CHECK-NEXT:    ld1b.zx %s0, 15(, %s11)65; CHECK-NEXT:    and %s0, %s0, (57)066; CHECK-NEXT:    st1b %s0, 15(, %s11)67; CHECK-NEXT:    ld %s1, (, %s11)68; CHECK-NEXT:    ld %s0, 8(, %s11)69; CHECK-NEXT:    adds.l %s11, 16, %s1170; CHECK-NEXT:    b.l.t (, %s10)71  %2 = tail call fast fp128 @llvm.fabs.f128(fp128 %0)72  ret fp128 %273}74 75; Function Attrs: nounwind readnone speculatable willreturn76declare fp128 @llvm.fabs.f128(fp128)77 78; Function Attrs: norecurse nounwind readnone79define float @fabs_float_zero() {80; CHECK-LABEL: fabs_float_zero:81; CHECK:       # %bb.0:82; CHECK-NEXT:    lea.sl %s0, 083; CHECK-NEXT:    b.l.t (, %s10)84  ret float 0.000000e+0085}86 87; Function Attrs: norecurse nounwind readnone88define double @fabs_double_zero() {89; CHECK-LABEL: fabs_double_zero:90; CHECK:       # %bb.0:91; CHECK-NEXT:    lea.sl %s0, 092; CHECK-NEXT:    b.l.t (, %s10)93  ret double 0.000000e+0094}95 96; Function Attrs: norecurse nounwind readnone97define fp128 @fabs_quad_zero() {98; CHECK-LABEL: fabs_quad_zero:99; CHECK:       # %bb.0:100; CHECK-NEXT:    lea %s0, .LCPI{{[0-9]+}}_0@lo101; CHECK-NEXT:    and %s0, %s0, (32)0102; CHECK-NEXT:    lea.sl %s2, .LCPI{{[0-9]+}}_0@hi(, %s0)103; CHECK-NEXT:    ld %s0, 8(, %s2)104; CHECK-NEXT:    ld %s1, (, %s2)105; CHECK-NEXT:    b.l.t (, %s10)106  ret fp128 0xL00000000000000000000000000000000107}108 109; Function Attrs: norecurse nounwind readnone110define float @fabs_float_const() {111; CHECK-LABEL: fabs_float_const:112; CHECK:       # %bb.0:113; CHECK-NEXT:    lea.sl %s0, 1073741824114; CHECK-NEXT:    b.l.t (, %s10)115  ret float 2.000000e+00116}117 118; Function Attrs: norecurse nounwind readnone119define double @fabs_double_const() {120; CHECK-LABEL: fabs_double_const:121; CHECK:       # %bb.0:122; CHECK-NEXT:    lea.sl %s0, 1073741824123; CHECK-NEXT:    b.l.t (, %s10)124  ret double 2.000000e+00125}126 127; Function Attrs: nounwind readnone128define fp128 @fabs_quad_const() {129; CHECK-LABEL: fabs_quad_const:130; CHECK:       # %bb.0:131; CHECK-NEXT:    lea %s0, .LCPI{{[0-9]+}}_0@lo132; CHECK-NEXT:    and %s0, %s0, (32)0133; CHECK-NEXT:    lea.sl %s2, .LCPI{{[0-9]+}}_0@hi(, %s0)134; CHECK-NEXT:    ld %s0, 8(, %s2)135; CHECK-NEXT:    ld %s1, (, %s2)136; CHECK-NEXT:    b.l.t (, %s10)137  %1 = tail call fast fp128 @llvm.fabs.f128(fp128 0xL0000000000000000C000000000000000)138  ret fp128 %1139}140