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

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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>
%b)
  %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
    retq

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to