-; SCE: bug 39153
-
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s
; fold (shl (zext (lshr (A, X))), X) -> (zext (shl (lshr (A, X)), X))
; Once the add is removed, the number of uses becomes one and therefore the
; dags are canonicalized. After Legalization, we need to make sure that the
; valuetype for the shift count is legal.
+; Verify also that we correctly fold the shl-shr sequence into an
+; AND with bitmask.
define void @g(i32 %a) {
%b = lshr i32 %a, 2
ret void
}
+; CHECK-LABEL: @g
+; CHECK-NOT: shr
+; CHECK-NOT: shl
+; CHECK: and
+; CHECK-NEXT: jmp
+
declare void @f(i64)