[llvm-bugs] [Bug 45065] New: [X86] Extra move instructons after fma3 instructions in sqrt and reciprocal tests.

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Feb 29 12:56:18 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=45065

            Bug ID: 45065
           Summary: [X86] Extra move instructons after fma3 instructions
                    in sqrt and reciprocal tests.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: craig.topper at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

For example this case from recip-fastmath.ll 

; HASWELL-LABEL: f32_one_step_variables:
; HASWELL:       # %bb.0:
; HASWELL-NEXT:    vrcpss %xmm1, %xmm1, %xmm2
; HASWELL-NEXT:    vmulss %xmm2, %xmm0, %xmm3
; HASWELL-NEXT:    vfmsub213ss {{.*#+}} xmm1 = (xmm3 * xmm1) - xmm0
; HASWELL-NEXT:    vfnmadd213ss {{.*#+}} xmm2 = -(xmm1 * xmm2) + xmm3
; HASWELL-NEXT:    vmovaps %xmm2, %xmm0
; HASWELL-NEXT:    retq

If the vfmsub213ss was commuted to overwrite xmm0 we could use it as the input
to vfnmadd213ss instead of xmm1. Then we could write xmm0 as the result and
avoid the vmovaps.

Probably requires a more advanced heuristic in TwoAddressInstructionPass

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200229/f180c30f/attachment.html>


More information about the llvm-bugs mailing list