blob: f12740a11b549780115ad33b4f88f7f2c1f020c1 [file] [log] [blame]
Jatin Bhateja1a86c382017-09-21 09:53:21 +00001; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s -check-prefix=X64
3; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s -check-prefix=X86
4
5declare float @llvm.sqrt.f32(float %x);
6
7define float @fast_recip_sqrt(float %x) {
8; X64-LABEL: fast_recip_sqrt:
9; X64: # BB#0:
10; X64-NEXT: sqrtss %xmm0, %xmm1
11; X64-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
12; X64-NEXT: divss %xmm1, %xmm0
13; X64-NEXT: retq
14;
15; X86-LABEL: fast_recip_sqrt:
16; X86: # BB#0:
17; X86-NEXT: flds {{[0-9]+}}(%esp)
18; X86-NEXT: fsqrt
19; X86-NEXT: fld1
20; X86-NEXT: fdivp %st(1)
21; X86-NEXT: retl
22 %y = call fast float @llvm.sqrt.f32(float %x)
23 %z = fdiv fast float 1.0, %y
24 ret float %z
25}
26
27declare float @llvm.fmuladd.f32(float %a, float %b, float %c);
28
29define float @fast_fmuladd_opts(float %a , float %b , float %c) {
30; X64-LABEL: fast_fmuladd_opts:
31; X64: # BB#0:
32; X64-NEXT: movaps %xmm0, %xmm1
33; X64-NEXT: addss %xmm1, %xmm1
34; X64-NEXT: addss %xmm0, %xmm1
35; X64-NEXT: movaps %xmm1, %xmm0
36; X64-NEXT: retq
37;
38; X86-LABEL: fast_fmuladd_opts:
39; X86: # BB#0:
40; X86-NEXT: flds {{[0-9]+}}(%esp)
41; X86-NEXT: fld %st(0)
42; X86-NEXT: fadd %st(1)
43; X86-NEXT: faddp %st(1)
44; X86-NEXT: retl
45 %res = call fast float @llvm.fmuladd.f32(float %a, float 2.0, float %a)
46 ret float %res
47}