1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
3 ; Anything more than one division using a single divisor operand
4 ; should be converted into a reciprocal and multiplication.
6 define float @div1_arcp(float %x, float %y, float %z) #0 {
7 ; CHECK-LABEL: div1_arcp:
9 ; CHECK-NEXT: divss %xmm1, %xmm0
11 %div1 = fdiv arcp float %x, %y
15 define float @div2_arcp(float %x, float %y, float %z) #0 {
16 ; CHECK-LABEL: div2_arcp:
18 ; CHECK-NEXT: movss {{.*#+}} xmm3 = mem[0],zero,zero,zero
19 ; CHECK-NEXT: divss %xmm2, %xmm3
20 ; CHECK-NEXT: mulss %xmm3, %xmm0
21 ; CHECK-NEXT: mulss %xmm1, %xmm0
22 ; CHECK-NEXT: mulss %xmm3, %xmm0
24 %div1 = fdiv arcp float %x, %z
25 %mul = fmul arcp float %div1, %y
26 %div2 = fdiv arcp float %mul, %z
30 ; FIXME: If the backend understands 'arcp', then this attribute is unnecessary.
31 attributes #0 = { "unsafe-fp-math"="true" }