[llvm-bugs] [Bug 27924] New: [x86, SSE] failed to eliminate unused instruction

via llvm-bugs llvm-bugs at lists.llvm.org
Sat May 28 12:46:25 PDT 2016


            Bug ID: 27924
           Summary: [x86, SSE] failed to eliminate unused instruction
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

declare <4 x i32> @llvm.x86.sse41.pmaxsd(<4 x i32>, <4 x i32>) #3

define <4 x i32> @maxmax(<4 x i32> %a, <4 x i32> %b) {
  %cmp = icmp sgt <4 x i32> %a, %b
  %max = select <4 x i1> %cmp, <4 x i32> %a, <4 x i32> %b
  %sse_max = tail call <4 x i32> @llvm.x86.sse41.pmaxsd(<4 x i32> %a, <4 x i32>
  %truth = icmp eq <4 x i32> %max, %sse_max
  %ret = sext <4 x i1> %truth to <4 x i32>
  ret <4 x i32> %ret

We match the compare+select as an 'smax', and we lower the SSE intrinsic to the
same 'smax' node, so we should know that the final comparison is all ones, but
the max instruction remains:

$ ./llc -o - smaxnode.ll -mattr=avx 
        vpmaxsd    %xmm1, %xmm0, %xmm0
    vpcmpeqd    %xmm0, %xmm0, %xmm0

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/20160528/19a584f8/attachment.html>

More information about the llvm-bugs mailing list