[PATCH] D47980: [InstCombine] Fold (x << y) >> y -> x & (-1 >> y)
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 11 03:02:06 PDT 2018
lebedev.ri added a comment.
(i didn't mean to self-accept, keyboard accels got better of me)
================
Comment at: test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll:898-899
; CHECK-NEXT: %1 = sub i32 32, %width
-; CHECK-NEXT: %2 = shl i32 %src, %1
-; CHECK-NEXT: %bfe = lshr i32 %2, %1
+; CHECK-NEXT: %2 = lshr i32 -1, %1
+; CHECK-NEXT: %bfe = and i32 %2, %src
; CHECK-NEXT: ret i32 %bfe
----------------
nhaehnle wrote:
> Indeed, the pattern matching in the backend does not recognize this and ends up generating worse code.
Yep, see D48005 for the backend tests.
Repository:
rL LLVM
https://reviews.llvm.org/D47980
More information about the llvm-commits
mailing list