brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 16ebf70 Raw
141 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=x86_64-- -mcpu=x86-64 | FileCheck %s -check-prefix=X643; RUN: llc < %s -mtriple=i686-unknown   | FileCheck %s -check-prefix=X864 5declare float @llvm.sqrt.f32(float %x);6 7define dso_local float @fast_recip_sqrt(float %x) {8; X64-LABEL: fast_recip_sqrt:9; X64:       # %bb.0:10; X64-NEXT:    rsqrtss %xmm0, %xmm111; X64-NEXT:    mulss %xmm1, %xmm012; X64-NEXT:    mulss %xmm1, %xmm013; X64-NEXT:    addss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm014; X64-NEXT:    mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm115; X64-NEXT:    mulss %xmm1, %xmm016; X64-NEXT:    retq17;18; X86-LABEL: fast_recip_sqrt:19; X86:       # %bb.0:20; X86-NEXT:    flds {{[0-9]+}}(%esp)21; X86-NEXT:    fsqrt22; X86-NEXT:    fld123; X86-NEXT:    fdivp %st, %st(1)24; X86-NEXT:    retl25  %y = call fast float @llvm.sqrt.f32(float %x)26  %z = fdiv fast float 1.0,  %y27  ret float %z28}29 30declare float @llvm.fmuladd.f32(float %a, float %b, float %c);31 32define dso_local float @fast_fmuladd_opts(float %a , float %b , float %c) {33; X64-LABEL: fast_fmuladd_opts:34; X64:       # %bb.0:35; X64-NEXT:    mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm036; X64-NEXT:    retq37;38; X86-LABEL: fast_fmuladd_opts:39; X86:       # %bb.0:40; X86-NEXT:    flds {{[0-9]+}}(%esp)41; X86-NEXT:    fmuls {{\.?LCPI[0-9]+_[0-9]+}}42; X86-NEXT:    retl43  %res = call fast float @llvm.fmuladd.f32(float %a, float 2.0, float %a)44  ret float %res45}46 47; The multiply is strict.48 49@mul1 = common dso_local global double 0.000000e+00, align 450 51define dso_local double @not_so_fast_mul_add(double %x) {52; X64-LABEL: not_so_fast_mul_add:53; X64:       # %bb.0:54; X64-NEXT:    movsd {{.*#+}} xmm1 = [4.2000000000000002E+0,0.0E+0]55; X64-NEXT:    mulsd %xmm0, %xmm156; X64-NEXT:    mulsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm057; X64-NEXT:    movsd %xmm1, mul1(%rip)58; X64-NEXT:    retq59;60; X86-LABEL: not_so_fast_mul_add:61; X86:       # %bb.0:62; X86-NEXT:    fldl {{[0-9]+}}(%esp)63; X86-NEXT:    fld %st(0)64; X86-NEXT:    fmull {{\.?LCPI[0-9]+_[0-9]+}}65; X86-NEXT:    fxch %st(1)66; X86-NEXT:    fmull {{\.?LCPI[0-9]+_[0-9]+}}67; X86-NEXT:    fxch %st(1)68; X86-NEXT:    fstpl mul169; X86-NEXT:    retl70  %m = fmul double %x, 4.271  %a = fadd fast double %m, %x72  store double %m, ptr @mul1, align 473  ret double %a74}75 76; The sqrt is strict.77 78@sqrt1 = common dso_local global float 0.000000e+00, align 479 80define dso_local float @not_so_fast_recip_sqrt(float %x) {81; X64-LABEL: not_so_fast_recip_sqrt:82; X64:       # %bb.0:83; X64-NEXT:    rsqrtss %xmm0, %xmm184; X64-NEXT:    sqrtss %xmm0, %xmm285; X64-NEXT:    mulss %xmm1, %xmm086; X64-NEXT:    mulss %xmm1, %xmm087; X64-NEXT:    addss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm088; X64-NEXT:    mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm189; X64-NEXT:    mulss %xmm1, %xmm090; X64-NEXT:    movss %xmm2, sqrt1(%rip)91; X64-NEXT:    retq92;93; X86-LABEL: not_so_fast_recip_sqrt:94; X86:       # %bb.0:95; X86-NEXT:    flds {{[0-9]+}}(%esp)96; X86-NEXT:    fsqrt97; X86-NEXT:    fld198; X86-NEXT:    fdiv %st(1), %st99; X86-NEXT:    fxch %st(1)100; X86-NEXT:    fstps sqrt1101; X86-NEXT:    retl102  %y = call float @llvm.sqrt.f32(float %x)103  %z = fdiv fast float 1.0, %y104  store float %y, ptr @sqrt1, align 4105  %ret = fadd float %z , 14.5106  ret float %z107}108 109define dso_local float @div_arcp_by_const(half %x) {110; X64-LABEL: div_arcp_by_const:111; X64:       # %bb.0:112; X64-NEXT:    pushq %rax113; X64-NEXT:    .cfi_def_cfa_offset 16114; X64-NEXT:    callq __extendhfsf2@PLT115; X64-NEXT:    mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0116; X64-NEXT:    callq __truncsfhf2@PLT117; X64-NEXT:    popq %rax118; X64-NEXT:    .cfi_def_cfa_offset 8119; X64-NEXT:    jmp __extendhfsf2@PLT # TAILCALL120;121; X86-LABEL: div_arcp_by_const:122; X86:       # %bb.0:123; X86-NEXT:    pushl %eax124; X86-NEXT:    .cfi_def_cfa_offset 8125; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax126; X86-NEXT:    movl %eax, (%esp)127; X86-NEXT:    calll __extendhfsf2128; X86-NEXT:    fmuls {{\.?LCPI[0-9]+_[0-9]+}}129; X86-NEXT:    fstps (%esp)130; X86-NEXT:    calll __truncsfhf2131; X86-NEXT:    movzwl %ax, %eax132; X86-NEXT:    movl %eax, (%esp)133; X86-NEXT:    calll __extendhfsf2134; X86-NEXT:    popl %eax135; X86-NEXT:    .cfi_def_cfa_offset 4136; X86-NEXT:    retl137  %rcp = fdiv arcp half %x, 10.0138  %z = fpext half %rcp to float139  ret float %z140}141