[llvm-bugs] [Bug 46138] Failure to avoid emitting a useless instruction when doing combined shits and rotates with a smaller result

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 10 13:22:51 PDT 2020


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

Simon Pilgrim <llvm-dev at redking.me.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
 Fixed By Commit(s)|                            |e1d4ca00094a4267b6fd70f613f
                   |                            |2e0390b2a8cbf

--- Comment #1 from Simon Pilgrim <llvm-dev at redking.me.uk> ---
Constant rotations are now folded to llvm.fshl in InstCombine:

define i32 @fi32 %0) {
  %2 = load i64, i64* @_ZZ1fjE1x, align 8
  %3 = add i64 %2, 1
  %4 = tail call i64 @llvm.fshl.i64(i64 %3, i64 %3, i64 32)
  store i64 %4, i64* @_ZZ1fjE1x, align 8
  %5 = trunc i64 %4 to i32
  ret i32 %5
}
declare i64 @llvm.fshl.i64(i64, i64, i64)


f:
  movq    _ZZ1fjE1x(%rip), %rax
  incq    %rax
  rorxq   $32, %rax, %rax
  movq    %rax, _ZZ1fjE1x(%rip)
  retq

-- 
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/20201010/73e4e383/attachment.html>


More information about the llvm-bugs mailing list