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 strictfp {
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)
20 ; X64-LABEL: fneg_strict_fsub_to_strict_fadd:
22 ; X64-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
23 ; X64-NEXT: subss %xmm1, %xmm0
26 %sub = call float @llvm.experimental.constrained.fsub.f32(float %x, float %neg, metadata!"round.dynamic", metadata!"fpexcept.strict")
30 ; FIXME: Missing fsub(x,fneg(y)) -> fadd(x,y) fold
31 define double @fneg_strict_fsub_to_strict_fadd_d(double %x, double %y) nounwind strictfp {
32 ; X86-LABEL: fneg_strict_fsub_to_strict_fadd_d:
34 ; X86-NEXT: pushl %ebp
35 ; X86-NEXT: movl %esp, %ebp
36 ; X86-NEXT: andl $-8, %esp
37 ; X86-NEXT: subl $8, %esp
38 ; X86-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
39 ; X86-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
40 ; X86-NEXT: xorpd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
41 ; X86-NEXT: subsd %xmm1, %xmm0
42 ; X86-NEXT: movsd %xmm0, (%esp)
43 ; X86-NEXT: fldl (%esp)
45 ; X86-NEXT: movl %ebp, %esp
49 ; X64-LABEL: fneg_strict_fsub_to_strict_fadd_d:
51 ; X64-NEXT: xorpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
52 ; X64-NEXT: subsd %xmm1, %xmm0
55 %sub = call double @llvm.experimental.constrained.fsub.f64(double %x, double %neg, metadata!"round.dynamic", metadata!"fpexcept.strict")
59 ; FIXME: Missing fneg(fsub(x,y)) -> fsub(y,x) fold
60 define float @strict_fsub_fneg_to_strict_fsub(float %x, float %y) nounwind strictfp {
61 ; X86-LABEL: strict_fsub_fneg_to_strict_fsub:
63 ; X86-NEXT: pushl %eax
64 ; X86-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
65 ; X86-NEXT: subss {{[0-9]+}}(%esp), %xmm0
66 ; X86-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
67 ; X86-NEXT: movss %xmm0, (%esp)
68 ; X86-NEXT: flds (%esp)
73 ; X64-LABEL: strict_fsub_fneg_to_strict_fsub:
75 ; X64-NEXT: subss %xmm1, %xmm0
76 ; X64-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
78 %sub = call float @llvm.experimental.constrained.fsub.f32(float %x, float %y, metadata!"round.dynamic", metadata!"fpexcept.strict")
79 %neg = fneg float %sub
83 ; FIXME: Missing fneg(fsub(x,y)) -> fsub(y,x) fold
84 define double @strict_fsub_fneg_to_strict_fsub_d(double %x, double %y) nounwind strictfp {
85 ; X86-LABEL: strict_fsub_fneg_to_strict_fsub_d:
87 ; X86-NEXT: pushl %ebp
88 ; X86-NEXT: movl %esp, %ebp
89 ; X86-NEXT: andl $-8, %esp
90 ; X86-NEXT: subl $8, %esp
91 ; X86-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
92 ; X86-NEXT: subsd 16(%ebp), %xmm0
93 ; X86-NEXT: xorpd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
94 ; X86-NEXT: movlpd %xmm0, (%esp)
95 ; X86-NEXT: fldl (%esp)
97 ; X86-NEXT: movl %ebp, %esp
101 ; X64-LABEL: strict_fsub_fneg_to_strict_fsub_d:
103 ; X64-NEXT: subsd %xmm1, %xmm0
104 ; X64-NEXT: xorpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
106 %sub = call double @llvm.experimental.constrained.fsub.f64(double %x, double %y, metadata!"round.dynamic", metadata!"fpexcept.strict")
107 %neg = fneg double %sub
112 declare float @llvm.experimental.constrained.fsub.f32(float, float, metadata, metadata)
113 declare double @llvm.experimental.constrained.fsub.f64(double, double, metadata, metadata)