[llvm-bugs] [Bug 48816] New: Failure to simplify	trunc(abs(sext(x))) -> abs(x)
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Wed Jan 20 07:07:28 PST 2021
    
    
  
https://bugs.llvm.org/show_bug.cgi?id=48816
            Bug ID: 48816
           Summary: Failure to simplify trunc(abs(sext(x))) -> abs(x)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: lebedev.ri at gmail.com, llvm-bugs at lists.llvm.org,
                    nikita.ppv at gmail.com, nunoplopes at sapo.pt,
                    spatel+llvm at rotateright.com
Noticed while investigating the quality of vectorization for:
https://github.com/WojciechMula/toys/blob/master/autovectorization-tests/transform_abs.cpp
(see http://0x80.pl/notesen/2021-01-18-autovectorization-gcc-clang.html for the
full list).
Due to promotions in the c code, for the "transform_abs_epi8" pattern we end up
with this:
  %20 = load <32 x i8>, <32 x i8>* %19
  %21 = sext <32 x i8> %20 to <32 x i32>
  %22 = call <32 x i32> @llvm.abs.v32i32(<32 x i32> %21, i1 true)
  %23 = trunc <32 x i32> %22 to <32 x i8>
https://gcc.godbolt.org/z/qoYv6s
AFAICT we should be able to remove the sext/trunc and use a v32i8 abs as long
as we clear the "is_int_min_poison" flag:
https://alive2.llvm.org/ce/z/Fvwhka
  %23 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %20, i1 false)
What are the implications of clearing the poison flag as part of such a fold?
-- 
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/20210120/c46d4128/attachment.html>
    
    
More information about the llvm-bugs
mailing list