[llvm-bugs] [Bug 27780] New: Inverted masks can be used for better	codegen
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Mon May 16 11:41:42 PDT 2016
    
    
  
https://llvm.org/bugs/show_bug.cgi?id=27780
            Bug ID: 27780
           Summary: Inverted masks can be used for better codegen
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: mkuper at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified
Given this IR:
define <32 x i8> @constant_pblendvb_avx2(<32 x i8> %xyzw, <32 x i8> %abcd) {
entry:
  %select = select <32 x i1> <i1 false, i1 false, i1 true, i1 false, i1 true,
i1 true, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 true, i1
true, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 true, i1
true, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 true, i1
true, i1 true, i1 false>, <32 x i8> %xyzw, <32 x i8> %abcd
  ret <32 x i8> %select
}
Up until r269676, with SSH4.1, we used to lower to:
movdqa %xmm0, %xmm4
movaps {{.*#+}} xmm0 = [255,255,0,255,0,0,0,255,255,255,0,255,0,0,0,255]
pblendvb %xmm2, %xmm4
pblendvb %xmm3, %xmm1
movdqa %xmm4, %xmm0
Now, we lower it to:
movdqa %xmm0, %xmm4
movaps {{.*#+}} xmm0 = [0,0,255,0,255,255,255,0,0,0,255,0,255,255,255,0]
pblendvb %xmm4, %xmm2
pblendvb %xmm1, %xmm3
movdqa %xmm2, %xmm0
movdqa %xmm3, %xmm1
This isn't directly related to r269676, it's just that the CG got lucky before.
The underlying issue is that when the output of the blend is constrained (in
this  case, because the function's return value must live in xmm0 and xmm1) we
could invert the mask to avoid a copy.
-- 
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/20160516/374310d8/attachment-0001.html>
    
    
More information about the llvm-bugs
mailing list