1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx2,fma -stop-after=finalize-isel 2>&1 | FileCheck %s
3 declare float @llvm.sqrt.f32(float) #0
5 define float @foo(float %f) #0 {
6 ; CHECK: {{name: *foo}}
8 ; CHECK: %0:fr32 = COPY $xmm0
9 ; CHECK: %1:fr32 = VRSQRTSSr killed %2, %0
10 ; CHECK: %3:fr32 = VMULSSrr %0, %1
11 ; CHECK: %4:fr32 = VMOVSSrm
12 ; CHECK: %5:fr32 = VFMADD213SSr %1, killed %3, %4
13 ; CHECK: %6:fr32 = VMOVSSrm
14 ; CHECK: %7:fr32 = VMULSSrr %1, %6
15 ; CHECK: %8:fr32 = VMULSSrr killed %7, killed %5
16 ; CHECK: %9:fr32 = VMULSSrr %0, %8
17 ; CHECK: %10:fr32 = VFMADD213SSr %8, %9, %4
18 ; CHECK: %11:fr32 = VMULSSrr %9, %6
19 ; CHECK: %12:fr32 = VMULSSrr killed %11, killed %10
20 ; CHECK: %14:fr32 = FsFLD0SS
21 ; CHECK: %15:fr32 = VCMPSSrr %0, killed %14, 0
22 ; CHECK: %17:vr128 = VPANDNrr killed %16, killed %13
23 ; CHECK: $xmm0 = COPY %18
25 %call = tail call float @llvm.sqrt.f32(float %f) #1
29 define float @rfoo(float %f) #0 {
30 ; CHECK: {{name: *rfoo}}
32 ; CHECK: %0:fr32 = COPY $xmm0
33 ; CHECK: %1:fr32 = VRSQRTSSr killed %2, %0
34 ; CHECK: %3:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr %0, %1
35 ; CHECK: %4:fr32 = VMOVSSrm
36 ; CHECK: %5:fr32 = nnan ninf nsz arcp contract afn reassoc VFMADD213SSr %1, killed %3, %4
37 ; CHECK: %6:fr32 = VMOVSSrm
38 ; CHECK: %7:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr %1, %6
39 ; CHECK: %8:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr killed %7, killed %5
40 ; CHECK: %9:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr %0, %8
41 ; CHECK: %10:fr32 = nnan ninf nsz arcp contract afn reassoc VFMADD213SSr %8, killed %9, %4
42 ; CHECK: %11:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr %8, %6
43 ; CHECK: %12:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr killed %11, killed %10
44 ; CHECK: $xmm0 = COPY %12
46 %sqrt = tail call float @llvm.sqrt.f32(float %f)
47 %div = fdiv fast float 1.0, %sqrt
51 attributes #0 = { "unsafe-fp-math"="true" "reciprocal-estimates"="sqrt:2" }
52 attributes #1 = { nounwind readnone }