; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -reassociate -S | FileCheck %s
+define i32 @shl_add(i8 %x) {
+; CHECK-LABEL: @shl_add(
+; CHECK-NEXT: [[CONV:%.*]] = zext i8 [[X:%.*]] to i32
+; CHECK-NEXT: [[SHL:%.*]] = shl nuw nsw i32 [[CONV]], 8
+; CHECK-NEXT: [[SHL2:%.*]] = shl nuw nsw i32 [[CONV]], 16
+; CHECK-NEXT: [[ADD:%.*]] = or i32 [[SHL]], [[SHL2]]
+; CHECK-NEXT: ret i32 [[ADD]]
+;
+ %conv = zext i8 %x to i32
+ %shl = shl nuw nsw i32 %conv, 8
+ %shl2 = shl nuw nsw i32 %conv, 16
+ %add = or i32 %shl, %shl2
+ ret i32 %add
+}
+
; If we don't know that operands have no common bits set,
; we can't convert the `or` into an `add`.
define i32 @test1(i32 %a, i32 %b) {