[llvm-bugs] [Bug 34149] New: Suboptimal codegen for "fast" minnum and maxnum

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 10 21:13:09 PDT 2017


            Bug ID: 34149
           Summary: Suboptimal codegen for "fast" minnum and maxnum
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: sanjoy at playingwithpointers.com
                CC: llvm-bugs at lists.llvm.org

On trunk, llc -O3 -mcpu=haswell on this program:

define <4 x double> @via_minnum(<4 x double> %x, <4 x double> %y) {
  %z = call fast <4 x double> @llvm.minnum.v4f64(<4 x double> %x, <4 x double>
%y) readnone
  ret <4 x double> %z

define <4 x double> @via_fcmp(<4 x double> %x, <4 x double> %y) {
  %c = fcmp ule <4 x double> %x, %y
  %z = select <4 x i1> %c, <4 x double> %x, <4 x double> %y
  ret <4 x double> %z

declare <4 x double> @llvm.minnum.v4f64(<4 x double>, <4 x double>)


        .file   "fast-min.ll"
        .globl  via_minnum              # -- Begin function via_minnum
        .p2align        4, 0x90
        .type   via_minnum, at function
via_minnum:                             # @via_minnum
# BB#0:
        vminpd  %ymm0, %ymm1, %ymm2
        vcmpunordpd     %ymm0, %ymm0, %ymm0
        vblendvpd       %ymm0, %ymm1, %ymm2, %ymm0
        .size   via_minnum, .Lfunc_end0-via_minnum
                                        # -- End function
        .globl  via_fcmp                # -- Begin function via_fcmp
        .p2align        4, 0x90
        .type   via_fcmp, at function
via_fcmp:                               # @via_fcmp
# BB#0:
        vminpd  %ymm0, %ymm1, %ymm0
        .size   via_fcmp, .Lfunc_end1-via_fcmp
                                        # -- End function

        .section        ".note.GNU-stack","", at progbits

Ideally we should be able to exploit the "fast" attribute on the minnum call to
generate the same assembly for @via_minnum as we do for @via_fcmp

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/20170811/2c8387bc/attachment.html>

More information about the llvm-bugs mailing list