1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=X64
5 ; FIXME: Missing fsub(x,fneg(y)) -> fadd(x,y) fold
6 define float @fneg_strict_fsub_to_strict_fadd(float %x, float %y) nounwind {
7 ; X86-LABEL: fneg_strict_fsub_to_strict_fadd:
10 ; X86-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
11 ; X86-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
12 ; X86-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
13 ; X86-NEXT: subss %xmm1, %xmm0
14 ; X86-NEXT: movss %xmm0, (%esp)
15 ; X86-NEXT: flds (%esp)
19 ; X64-LABEL: fneg_strict_fsub_to_strict_fadd:
21 ; X64-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
22 ; X64-NEXT: subss %xmm1, %xmm0
25 %sub = call float @llvm.experimental.constrained.fsub.f32(float %x, float %neg, metadata!"round.dynamic", metadata!"fpexcept.strict")
29 ; FIXME: Missing fsub(x,fneg(y)) -> fadd(x,y) fold
30 define double @fneg_strict_fsub_to_strict_fadd_d(double %x, double %y) nounwind {
31 ; X86-LABEL: fneg_strict_fsub_to_strict_fadd_d:
33 ; X86-NEXT: pushl %ebp
34 ; X86-NEXT: movl %esp, %ebp
35 ; X86-NEXT: andl $-8, %esp
36 ; X86-NEXT: subl $8, %esp
37 ; X86-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
38 ; X86-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
39 ; X86-NEXT: xorpd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
40 ; X86-NEXT: subsd %xmm1, %xmm0
41 ; X86-NEXT: movsd %xmm0, (%esp)
42 ; X86-NEXT: fldl (%esp)
43 ; X86-NEXT: movl %ebp, %esp
47 ; X64-LABEL: fneg_strict_fsub_to_strict_fadd_d:
49 ; X64-NEXT: xorpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
50 ; X64-NEXT: subsd %xmm1, %xmm0
53 %sub = call double @llvm.experimental.constrained.fsub.f64(double %x, double %neg, metadata!"round.dynamic", metadata!"fpexcept.strict")
57 ; FIXME: Missing fneg(fsub(x,y)) -> fsub(y,x) fold
58 define float @strict_fsub_fneg_to_strict_fsub(float %x, float %y) nounwind {
59 ; X86-LABEL: strict_fsub_fneg_to_strict_fsub:
61 ; X86-NEXT: pushl %eax
62 ; X86-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
63 ; X86-NEXT: subss {{[0-9]+}}(%esp), %xmm0
64 ; X86-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
65 ; X86-NEXT: movss %xmm0, (%esp)
66 ; X86-NEXT: flds (%esp)
70 ; X64-LABEL: strict_fsub_fneg_to_strict_fsub:
72 ; X64-NEXT: subss %xmm1, %xmm0
73 ; X64-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
75 %sub = call float @llvm.experimental.constrained.fsub.f32(float %x, float %y, metadata!"round.dynamic", metadata!"fpexcept.strict")
76 %neg = fneg float %sub
80 ; FIXME: Missing fneg(fsub(x,y)) -> fsub(y,x) fold
81 define double @strict_fsub_fneg_to_strict_fsub_d(double %x, double %y) nounwind {
82 ; X86-LABEL: strict_fsub_fneg_to_strict_fsub_d:
84 ; X86-NEXT: pushl %ebp
85 ; X86-NEXT: movl %esp, %ebp
86 ; X86-NEXT: andl $-8, %esp
87 ; X86-NEXT: subl $8, %esp
88 ; X86-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
89 ; X86-NEXT: subsd 16(%ebp), %xmm0
90 ; X86-NEXT: xorpd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
91 ; X86-NEXT: movlpd %xmm0, (%esp)
92 ; X86-NEXT: fldl (%esp)
93 ; X86-NEXT: movl %ebp, %esp
97 ; X64-LABEL: strict_fsub_fneg_to_strict_fsub_d:
99 ; X64-NEXT: subsd %xmm1, %xmm0
100 ; X64-NEXT: xorpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
102 %sub = call double @llvm.experimental.constrained.fsub.f64(double %x, double %y, metadata!"round.dynamic", metadata!"fpexcept.strict")
103 %neg = fneg double %sub
108 declare float @llvm.experimental.constrained.fsub.f32(float, float, metadata, metadata)
109 declare double @llvm.experimental.constrained.fsub.f64(double, double, metadata, metadata)