1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -enable-unsafe-fp-math | FileCheck %s
4 define double @exact(double %x) {
5 ; Exact division by a constant converted to multiplication.
8 ; CHECK-NEXT: mulsd {{.*}}(%rip), %xmm0
10 %div = fdiv double %x, 2.0
14 define double @inexact(double %x) {
15 ; Inexact division by a constant converted to multiplication.
16 ; CHECK-LABEL: inexact:
18 ; CHECK-NEXT: mulsd {{.*}}(%rip), %xmm0
20 %div = fdiv double %x, 0x41DFFFFFFFC00000
24 define double @funky(double %x) {
25 ; No conversion to multiplication if too funky.
28 ; CHECK-NEXT: xorpd %xmm1, %xmm1
29 ; CHECK-NEXT: divsd %xmm1, %xmm0
31 %div = fdiv double %x, 0.0
35 define double @denormal1(double %x) {
36 ; Don't generate multiplication by a denormal.
37 ; CHECK-LABEL: denormal1:
39 ; CHECK-NEXT: divsd {{.*}}(%rip), %xmm0
41 %div = fdiv double %x, 0x7FD0000000000001
45 define double @denormal2(double %x) {
46 ; Don't generate multiplication by a denormal.
47 ; CHECK-LABEL: denormal2:
49 ; CHECK-NEXT: divsd {{.*}}(%rip), %xmm0
51 %div = fdiv double %x, 0x7FEFFFFFFFFFFFFF
55 ; Deleting the negates does not require unsafe-fp-math.
57 define float @double_negative(float %x, float %y) #0 {
58 ; CHECK-LABEL: double_negative:
60 ; CHECK-NEXT: divss %xmm1, %xmm0
62 %neg1 = fsub float -0.0, %x
63 %neg2 = fsub float -0.0, %y
64 %div = fdiv float %neg1, %neg2
68 define <4 x float> @double_negative_vector(<4 x float> %x, <4 x float> %y) #0 {
69 ; CHECK-LABEL: double_negative_vector:
71 ; CHECK-NEXT: divps %xmm1, %xmm0
73 %neg1 = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %x
74 %neg2 = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %y
75 %div = fdiv <4 x float> %neg1, %neg2
79 attributes #0 = { "unsafe-fp-math"="false" }