Compiler projects using llvm
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck %s

---
name: ctpop_s8_s8
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: ctpop_s8_s8
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[AND]](s32)
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[CTPOP]](s32)
    ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
    ; CHECK-NEXT: $vgpr0 = COPY [[AND1]](s32)
    %0:_(s32) = COPY $vgpr0
    %1:_(s8) = G_TRUNC %0
    %2:_(s8) = G_CTPOP %1
    %3:_(s32) = G_ZEXT %2
    $vgpr0 = COPY %3
...

---
name: ctpop_s9_s9
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: ctpop_s9_s9
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 511
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[AND]](s32)
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[CTPOP]](s32)
    ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
    ; CHECK-NEXT: $vgpr0 = COPY [[AND1]](s32)
    %0:_(s32) = COPY $vgpr0
    %1:_(s9) = G_TRUNC %0
    %2:_(s9) = G_CTPOP %1
    %3:_(s32) = G_ZEXT %2
    $vgpr0 = COPY %3
...

---
name: ctpop_s32_s32

body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: ctpop_s32_s32
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[COPY]](s32)
    ; CHECK-NEXT: $vgpr0 = COPY [[CTPOP]](s32)
    %0:_(s32) = COPY $vgpr0
    %1:_(s32) = G_CTPOP %0
    $vgpr0 = COPY %1
...

---
name: ctpop_s32_s64

body: |
  bb.0:
    liveins: $vgpr0_vgpr1
    ; CHECK-LABEL: name: ctpop_s32_s64
    ; CHECK: liveins: $vgpr0_vgpr1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[COPY]](s64)
    ; CHECK-NEXT: $vgpr0 = COPY [[CTPOP]](s32)
    %0:_(s64) = COPY $vgpr0_vgpr1
    %1:_(s32) = G_CTPOP %0
    $vgpr0 = COPY %1
...

---
name: ctpop_s64_s64

body: |
  bb.0:
    liveins: $vgpr0_vgpr1
    ; CHECK-LABEL: name: ctpop_s64_s64
    ; CHECK: liveins: $vgpr0_vgpr1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[COPY]](s64)
    ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[CTPOP]](s32)
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
    %0:_(s64) = COPY $vgpr0_vgpr1
    %1:_(s64) = G_CTPOP %0
    $vgpr0_vgpr1 = COPY %1
...

---
name: ctpop_s16_s32

body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: ctpop_s16_s32
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[COPY]](s32)
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[CTPOP]], [[C]]
    ; CHECK-NEXT: $vgpr0 = COPY [[AND]](s32)
    %0:_(s32) = COPY $vgpr0
    %1:_(s16) = G_CTPOP %0
    %2:_(s32) = G_ZEXT %1
    $vgpr0 = COPY %2
...

---
name: ctpop_s16_s16

body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: ctpop_s16_s16
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[AND]](s32)
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[CTPOP]](s32)
    ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
    ; CHECK-NEXT: $vgpr0 = COPY [[AND1]](s32)
    %0:_(s32) = COPY $vgpr0
    %1:_(s16) = G_TRUNC %0
    %2:_(s16) = G_CTPOP %1
    %3:_(s32) = G_ZEXT %2
    $vgpr0 = COPY %3
...

---
name: ctpop_v2s32_v2s32

body: |
  bb.0:
    liveins: $vgpr0_vgpr1
    ; CHECK-LABEL: name: ctpop_v2s32_v2s32
    ; CHECK: liveins: $vgpr0_vgpr1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
    ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[UV]](s32)
    ; CHECK-NEXT: [[CTPOP1:%[0-9]+]]:_(s32) = G_CTPOP [[UV1]](s32)
    ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[CTPOP]](s32), [[CTPOP1]](s32)
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
    %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
    %1:_(<2 x s32>) = G_CTPOP %0
    $vgpr0_vgpr1 = COPY %1
...

---
name: ctpop_v2s32_v2s64

body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2_vgpr3
    ; CHECK-LABEL: name: ctpop_v2s32_v2s64
    ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[UV]](s64)
    ; CHECK-NEXT: [[CTPOP1:%[0-9]+]]:_(s32) = G_CTPOP [[UV1]](s64)
    ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[CTPOP]](s32), [[CTPOP1]](s32)
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
    %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    %1:_(<2 x s32>) = G_CTPOP %0
    $vgpr0_vgpr1 = COPY %1
...

---
name: ctpop_v2s16_v2s16

body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: ctpop_v2s16_v2s16
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
    ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITCAST]], [[C]](s32)
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[BITCAST]], [[C1]]
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[AND]](s32)
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[CTPOP]](s32)
    ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[LSHR]], [[C1]]
    ; CHECK-NEXT: [[CTPOP1:%[0-9]+]]:_(s32) = G_CTPOP [[AND1]](s32)
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[CTPOP1]](s32)
    ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]]
    ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C1]]
    ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C]](s32)
    ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND2]], [[SHL]]
    ; CHECK-NEXT: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
    ; CHECK-NEXT: $vgpr0 = COPY [[BITCAST1]](<2 x s16>)
    %0:_(<2 x s16>) = COPY $vgpr0
    %1:_(<2 x s16>) = G_CTPOP %0
    $vgpr0 = COPY %1
...

---
name: ctpop_s7_s7

body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: ctpop_s7_s7
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[AND]](s32)
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[CTPOP]](s32)
    ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
    ; CHECK-NEXT: $vgpr0 = COPY [[AND1]](s32)
    %0:_(s32) = COPY $vgpr0
    %1:_(s7) = G_TRUNC %0
    %2:_(s7) = G_CTPOP %1
    %3:_(s32) = G_ZEXT %2
    $vgpr0 = COPY %3
...

---
name: ctpop_s33_s33

body: |
  bb.0:
    liveins: $vgpr0_vgpr1

    ; CHECK-LABEL: name: ctpop_s33_s33
    ; CHECK: liveins: $vgpr0_vgpr1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934591
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[AND]](s64)
    ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[CTPOP]](s32)
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
    ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[ZEXT]], [[C1]]
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[AND1]](s64)
    %0:_(s64) = COPY $vgpr0_vgpr1
    %1:_(s33) = G_TRUNC %0
    %2:_(s33) = G_CTPOP %1
    %3:_(s64) = G_ANYEXT %2
    $vgpr0_vgpr1 = COPY %3
...

---
name: ctpop_s65_s65
body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2
    ; CHECK-LABEL: name: ctpop_s65_s65
    ; CHECK: liveins: $vgpr0_vgpr1_vgpr2
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s96) = COPY $vgpr0_vgpr1_vgpr2
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
    ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32), [[UV2:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s96)
    ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
    ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[UV]](s32), [[UV1]](s32)
    ; CHECK-NEXT: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[UV2]](s32), [[DEF]](s32)
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[MV]], [[C]]
    ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[MV1]], [[C1]]
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[AND]](s64)
    ; CHECK-NEXT: [[CTPOP1:%[0-9]+]]:_(s32) = G_CTPOP [[AND1]](s64)
    ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[CTPOP1]], [[CTPOP]]
    ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
    ; CHECK-NEXT: [[MV2:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[ADD]](s32), [[C2]](s32)
    ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
    ; CHECK-NEXT: [[UV3:%[0-9]+]]:_(s32), [[UV4:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C3]](s64)
    ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[UV3]](s32)
    ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[UV3]], [[C4]](s32)
    ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[LSHR]](s32)
    ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:_(s16) = G_TRUNC [[UV4]](s32)
    ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[UV4]], [[C4]](s32)
    ; CHECK-NEXT: [[TRUNC3:%[0-9]+]]:_(s16) = G_TRUNC [[LSHR1]](s32)
    ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
    ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C5]](s16)
    ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s16) = G_CONSTANT i16 2
    ; CHECK-NEXT: [[LSHR3:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C6]](s16)
    ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s16) = G_CONSTANT i16 3
    ; CHECK-NEXT: [[LSHR4:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C7]](s16)
    ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s16) = G_CONSTANT i16 4
    ; CHECK-NEXT: [[LSHR5:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C8]](s16)
    ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s16) = G_CONSTANT i16 5
    ; CHECK-NEXT: [[LSHR6:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C9]](s16)
    ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s16) = G_CONSTANT i16 6
    ; CHECK-NEXT: [[LSHR7:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C10]](s16)
    ; CHECK-NEXT: [[C11:%[0-9]+]]:_(s16) = G_CONSTANT i16 7
    ; CHECK-NEXT: [[LSHR8:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C11]](s16)
    ; CHECK-NEXT: [[C12:%[0-9]+]]:_(s16) = G_CONSTANT i16 8
    ; CHECK-NEXT: [[LSHR9:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C12]](s16)
    ; CHECK-NEXT: [[C13:%[0-9]+]]:_(s16) = G_CONSTANT i16 9
    ; CHECK-NEXT: [[LSHR10:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C13]](s16)
    ; CHECK-NEXT: [[C14:%[0-9]+]]:_(s16) = G_CONSTANT i16 10
    ; CHECK-NEXT: [[LSHR11:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C14]](s16)
    ; CHECK-NEXT: [[C15:%[0-9]+]]:_(s16) = G_CONSTANT i16 11
    ; CHECK-NEXT: [[LSHR12:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C15]](s16)
    ; CHECK-NEXT: [[C16:%[0-9]+]]:_(s16) = G_CONSTANT i16 12
    ; CHECK-NEXT: [[LSHR13:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C16]](s16)
    ; CHECK-NEXT: [[C17:%[0-9]+]]:_(s16) = G_CONSTANT i16 13
    ; CHECK-NEXT: [[LSHR14:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C17]](s16)
    ; CHECK-NEXT: [[C18:%[0-9]+]]:_(s16) = G_CONSTANT i16 14
    ; CHECK-NEXT: [[LSHR15:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C18]](s16)
    ; CHECK-NEXT: [[C19:%[0-9]+]]:_(s16) = G_CONSTANT i16 15
    ; CHECK-NEXT: [[LSHR16:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC]], [[C19]](s16)
    ; CHECK-NEXT: [[LSHR17:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C5]](s16)
    ; CHECK-NEXT: [[LSHR18:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C6]](s16)
    ; CHECK-NEXT: [[LSHR19:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C7]](s16)
    ; CHECK-NEXT: [[LSHR20:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C8]](s16)
    ; CHECK-NEXT: [[LSHR21:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C9]](s16)
    ; CHECK-NEXT: [[LSHR22:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C10]](s16)
    ; CHECK-NEXT: [[LSHR23:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C11]](s16)
    ; CHECK-NEXT: [[LSHR24:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C12]](s16)
    ; CHECK-NEXT: [[LSHR25:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C13]](s16)
    ; CHECK-NEXT: [[LSHR26:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C14]](s16)
    ; CHECK-NEXT: [[LSHR27:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C15]](s16)
    ; CHECK-NEXT: [[LSHR28:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C16]](s16)
    ; CHECK-NEXT: [[LSHR29:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C17]](s16)
    ; CHECK-NEXT: [[LSHR30:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C18]](s16)
    ; CHECK-NEXT: [[LSHR31:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC1]], [[C19]](s16)
    ; CHECK-NEXT: [[LSHR32:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C5]](s16)
    ; CHECK-NEXT: [[LSHR33:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C6]](s16)
    ; CHECK-NEXT: [[LSHR34:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C7]](s16)
    ; CHECK-NEXT: [[LSHR35:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C8]](s16)
    ; CHECK-NEXT: [[LSHR36:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C9]](s16)
    ; CHECK-NEXT: [[LSHR37:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C10]](s16)
    ; CHECK-NEXT: [[LSHR38:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C11]](s16)
    ; CHECK-NEXT: [[LSHR39:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C12]](s16)
    ; CHECK-NEXT: [[LSHR40:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C13]](s16)
    ; CHECK-NEXT: [[LSHR41:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C14]](s16)
    ; CHECK-NEXT: [[LSHR42:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C15]](s16)
    ; CHECK-NEXT: [[LSHR43:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C16]](s16)
    ; CHECK-NEXT: [[LSHR44:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C17]](s16)
    ; CHECK-NEXT: [[LSHR45:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C18]](s16)
    ; CHECK-NEXT: [[LSHR46:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC2]], [[C19]](s16)
    ; CHECK-NEXT: [[LSHR47:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C5]](s16)
    ; CHECK-NEXT: [[LSHR48:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C6]](s16)
    ; CHECK-NEXT: [[LSHR49:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C7]](s16)
    ; CHECK-NEXT: [[LSHR50:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C8]](s16)
    ; CHECK-NEXT: [[LSHR51:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C9]](s16)
    ; CHECK-NEXT: [[LSHR52:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C10]](s16)
    ; CHECK-NEXT: [[LSHR53:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C11]](s16)
    ; CHECK-NEXT: [[LSHR54:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C12]](s16)
    ; CHECK-NEXT: [[LSHR55:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C13]](s16)
    ; CHECK-NEXT: [[LSHR56:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C14]](s16)
    ; CHECK-NEXT: [[LSHR57:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C15]](s16)
    ; CHECK-NEXT: [[LSHR58:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C16]](s16)
    ; CHECK-NEXT: [[LSHR59:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C17]](s16)
    ; CHECK-NEXT: [[LSHR60:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C18]](s16)
    ; CHECK-NEXT: [[LSHR61:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC3]], [[C19]](s16)
    ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C5]]
    ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s16) = G_AND [[LSHR2]], [[C5]]
    ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s16) = G_SHL [[AND3]], [[C5]](s16)
    ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s16) = G_OR [[AND2]], [[SHL]]
    ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s16) = G_AND [[LSHR3]], [[C5]]
    ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s16) = G_SHL [[AND4]], [[C6]](s16)
    ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s16) = G_OR [[OR]], [[SHL1]]
    ; CHECK-NEXT: [[AND5:%[0-9]+]]:_(s16) = G_AND [[LSHR4]], [[C5]]
    ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s16) = G_SHL [[AND5]], [[C7]](s16)
    ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s16) = G_OR [[OR1]], [[SHL2]]
    ; CHECK-NEXT: [[AND6:%[0-9]+]]:_(s16) = G_AND [[LSHR5]], [[C5]]
    ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s16) = G_SHL [[AND6]], [[C8]](s16)
    ; CHECK-NEXT: [[OR3:%[0-9]+]]:_(s16) = G_OR [[OR2]], [[SHL3]]
    ; CHECK-NEXT: [[AND7:%[0-9]+]]:_(s16) = G_AND [[LSHR6]], [[C5]]
    ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s16) = G_SHL [[AND7]], [[C9]](s16)
    ; CHECK-NEXT: [[OR4:%[0-9]+]]:_(s16) = G_OR [[OR3]], [[SHL4]]
    ; CHECK-NEXT: [[AND8:%[0-9]+]]:_(s16) = G_AND [[LSHR7]], [[C5]]
    ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s16) = G_SHL [[AND8]], [[C10]](s16)
    ; CHECK-NEXT: [[OR5:%[0-9]+]]:_(s16) = G_OR [[OR4]], [[SHL5]]
    ; CHECK-NEXT: [[AND9:%[0-9]+]]:_(s16) = G_AND [[LSHR8]], [[C5]]
    ; CHECK-NEXT: [[SHL6:%[0-9]+]]:_(s16) = G_SHL [[AND9]], [[C11]](s16)
    ; CHECK-NEXT: [[OR6:%[0-9]+]]:_(s16) = G_OR [[OR5]], [[SHL6]]
    ; CHECK-NEXT: [[AND10:%[0-9]+]]:_(s16) = G_AND [[LSHR9]], [[C5]]
    ; CHECK-NEXT: [[SHL7:%[0-9]+]]:_(s16) = G_SHL [[AND10]], [[C12]](s16)
    ; CHECK-NEXT: [[OR7:%[0-9]+]]:_(s16) = G_OR [[OR6]], [[SHL7]]
    ; CHECK-NEXT: [[AND11:%[0-9]+]]:_(s16) = G_AND [[LSHR10]], [[C5]]
    ; CHECK-NEXT: [[SHL8:%[0-9]+]]:_(s16) = G_SHL [[AND11]], [[C13]](s16)
    ; CHECK-NEXT: [[OR8:%[0-9]+]]:_(s16) = G_OR [[OR7]], [[SHL8]]
    ; CHECK-NEXT: [[AND12:%[0-9]+]]:_(s16) = G_AND [[LSHR11]], [[C5]]
    ; CHECK-NEXT: [[SHL9:%[0-9]+]]:_(s16) = G_SHL [[AND12]], [[C14]](s16)
    ; CHECK-NEXT: [[OR9:%[0-9]+]]:_(s16) = G_OR [[OR8]], [[SHL9]]
    ; CHECK-NEXT: [[AND13:%[0-9]+]]:_(s16) = G_AND [[LSHR12]], [[C5]]
    ; CHECK-NEXT: [[SHL10:%[0-9]+]]:_(s16) = G_SHL [[AND13]], [[C15]](s16)
    ; CHECK-NEXT: [[OR10:%[0-9]+]]:_(s16) = G_OR [[OR9]], [[SHL10]]
    ; CHECK-NEXT: [[AND14:%[0-9]+]]:_(s16) = G_AND [[LSHR13]], [[C5]]
    ; CHECK-NEXT: [[SHL11:%[0-9]+]]:_(s16) = G_SHL [[AND14]], [[C16]](s16)
    ; CHECK-NEXT: [[OR11:%[0-9]+]]:_(s16) = G_OR [[OR10]], [[SHL11]]
    ; CHECK-NEXT: [[AND15:%[0-9]+]]:_(s16) = G_AND [[LSHR14]], [[C5]]
    ; CHECK-NEXT: [[SHL12:%[0-9]+]]:_(s16) = G_SHL [[AND15]], [[C17]](s16)
    ; CHECK-NEXT: [[OR12:%[0-9]+]]:_(s16) = G_OR [[OR11]], [[SHL12]]
    ; CHECK-NEXT: [[AND16:%[0-9]+]]:_(s16) = G_AND [[LSHR15]], [[C5]]
    ; CHECK-NEXT: [[SHL13:%[0-9]+]]:_(s16) = G_SHL [[AND16]], [[C18]](s16)
    ; CHECK-NEXT: [[OR13:%[0-9]+]]:_(s16) = G_OR [[OR12]], [[SHL13]]
    ; CHECK-NEXT: [[AND17:%[0-9]+]]:_(s16) = G_AND [[LSHR16]], [[C5]]
    ; CHECK-NEXT: [[SHL14:%[0-9]+]]:_(s16) = G_SHL [[AND17]], [[C19]](s16)
    ; CHECK-NEXT: [[OR14:%[0-9]+]]:_(s16) = G_OR [[OR13]], [[SHL14]]
    ; CHECK-NEXT: [[AND18:%[0-9]+]]:_(s16) = G_AND [[TRUNC1]], [[C5]]
    ; CHECK-NEXT: [[AND19:%[0-9]+]]:_(s16) = G_AND [[LSHR17]], [[C5]]
    ; CHECK-NEXT: [[SHL15:%[0-9]+]]:_(s16) = G_SHL [[AND19]], [[C5]](s16)
    ; CHECK-NEXT: [[OR15:%[0-9]+]]:_(s16) = G_OR [[AND18]], [[SHL15]]
    ; CHECK-NEXT: [[AND20:%[0-9]+]]:_(s16) = G_AND [[LSHR18]], [[C5]]
    ; CHECK-NEXT: [[SHL16:%[0-9]+]]:_(s16) = G_SHL [[AND20]], [[C6]](s16)
    ; CHECK-NEXT: [[OR16:%[0-9]+]]:_(s16) = G_OR [[OR15]], [[SHL16]]
    ; CHECK-NEXT: [[AND21:%[0-9]+]]:_(s16) = G_AND [[LSHR19]], [[C5]]
    ; CHECK-NEXT: [[SHL17:%[0-9]+]]:_(s16) = G_SHL [[AND21]], [[C7]](s16)
    ; CHECK-NEXT: [[OR17:%[0-9]+]]:_(s16) = G_OR [[OR16]], [[SHL17]]
    ; CHECK-NEXT: [[AND22:%[0-9]+]]:_(s16) = G_AND [[LSHR20]], [[C5]]
    ; CHECK-NEXT: [[SHL18:%[0-9]+]]:_(s16) = G_SHL [[AND22]], [[C8]](s16)
    ; CHECK-NEXT: [[OR18:%[0-9]+]]:_(s16) = G_OR [[OR17]], [[SHL18]]
    ; CHECK-NEXT: [[AND23:%[0-9]+]]:_(s16) = G_AND [[LSHR21]], [[C5]]
    ; CHECK-NEXT: [[SHL19:%[0-9]+]]:_(s16) = G_SHL [[AND23]], [[C9]](s16)
    ; CHECK-NEXT: [[OR19:%[0-9]+]]:_(s16) = G_OR [[OR18]], [[SHL19]]
    ; CHECK-NEXT: [[AND24:%[0-9]+]]:_(s16) = G_AND [[LSHR22]], [[C5]]
    ; CHECK-NEXT: [[SHL20:%[0-9]+]]:_(s16) = G_SHL [[AND24]], [[C10]](s16)
    ; CHECK-NEXT: [[OR20:%[0-9]+]]:_(s16) = G_OR [[OR19]], [[SHL20]]
    ; CHECK-NEXT: [[AND25:%[0-9]+]]:_(s16) = G_AND [[LSHR23]], [[C5]]
    ; CHECK-NEXT: [[SHL21:%[0-9]+]]:_(s16) = G_SHL [[AND25]], [[C11]](s16)
    ; CHECK-NEXT: [[OR21:%[0-9]+]]:_(s16) = G_OR [[OR20]], [[SHL21]]
    ; CHECK-NEXT: [[AND26:%[0-9]+]]:_(s16) = G_AND [[LSHR24]], [[C5]]
    ; CHECK-NEXT: [[SHL22:%[0-9]+]]:_(s16) = G_SHL [[AND26]], [[C12]](s16)
    ; CHECK-NEXT: [[OR22:%[0-9]+]]:_(s16) = G_OR [[OR21]], [[SHL22]]
    ; CHECK-NEXT: [[AND27:%[0-9]+]]:_(s16) = G_AND [[LSHR25]], [[C5]]
    ; CHECK-NEXT: [[SHL23:%[0-9]+]]:_(s16) = G_SHL [[AND27]], [[C13]](s16)
    ; CHECK-NEXT: [[OR23:%[0-9]+]]:_(s16) = G_OR [[OR22]], [[SHL23]]
    ; CHECK-NEXT: [[AND28:%[0-9]+]]:_(s16) = G_AND [[LSHR26]], [[C5]]
    ; CHECK-NEXT: [[SHL24:%[0-9]+]]:_(s16) = G_SHL [[AND28]], [[C14]](s16)
    ; CHECK-NEXT: [[OR24:%[0-9]+]]:_(s16) = G_OR [[OR23]], [[SHL24]]
    ; CHECK-NEXT: [[AND29:%[0-9]+]]:_(s16) = G_AND [[LSHR27]], [[C5]]
    ; CHECK-NEXT: [[SHL25:%[0-9]+]]:_(s16) = G_SHL [[AND29]], [[C15]](s16)
    ; CHECK-NEXT: [[OR25:%[0-9]+]]:_(s16) = G_OR [[OR24]], [[SHL25]]
    ; CHECK-NEXT: [[AND30:%[0-9]+]]:_(s16) = G_AND [[LSHR28]], [[C5]]
    ; CHECK-NEXT: [[SHL26:%[0-9]+]]:_(s16) = G_SHL [[AND30]], [[C16]](s16)
    ; CHECK-NEXT: [[OR26:%[0-9]+]]:_(s16) = G_OR [[OR25]], [[SHL26]]
    ; CHECK-NEXT: [[AND31:%[0-9]+]]:_(s16) = G_AND [[LSHR29]], [[C5]]
    ; CHECK-NEXT: [[SHL27:%[0-9]+]]:_(s16) = G_SHL [[AND31]], [[C17]](s16)
    ; CHECK-NEXT: [[OR27:%[0-9]+]]:_(s16) = G_OR [[OR26]], [[SHL27]]
    ; CHECK-NEXT: [[AND32:%[0-9]+]]:_(s16) = G_AND [[LSHR30]], [[C5]]
    ; CHECK-NEXT: [[SHL28:%[0-9]+]]:_(s16) = G_SHL [[AND32]], [[C18]](s16)
    ; CHECK-NEXT: [[OR28:%[0-9]+]]:_(s16) = G_OR [[OR27]], [[SHL28]]
    ; CHECK-NEXT: [[AND33:%[0-9]+]]:_(s16) = G_AND [[LSHR31]], [[C5]]
    ; CHECK-NEXT: [[SHL29:%[0-9]+]]:_(s16) = G_SHL [[AND33]], [[C19]](s16)
    ; CHECK-NEXT: [[OR29:%[0-9]+]]:_(s16) = G_OR [[OR28]], [[SHL29]]
    ; CHECK-NEXT: [[AND34:%[0-9]+]]:_(s16) = G_AND [[TRUNC2]], [[C5]]
    ; CHECK-NEXT: [[AND35:%[0-9]+]]:_(s16) = G_AND [[LSHR32]], [[C5]]
    ; CHECK-NEXT: [[SHL30:%[0-9]+]]:_(s16) = G_SHL [[AND35]], [[C5]](s16)
    ; CHECK-NEXT: [[OR30:%[0-9]+]]:_(s16) = G_OR [[AND34]], [[SHL30]]
    ; CHECK-NEXT: [[AND36:%[0-9]+]]:_(s16) = G_AND [[LSHR33]], [[C5]]
    ; CHECK-NEXT: [[SHL31:%[0-9]+]]:_(s16) = G_SHL [[AND36]], [[C6]](s16)
    ; CHECK-NEXT: [[OR31:%[0-9]+]]:_(s16) = G_OR [[OR30]], [[SHL31]]
    ; CHECK-NEXT: [[AND37:%[0-9]+]]:_(s16) = G_AND [[LSHR34]], [[C5]]
    ; CHECK-NEXT: [[SHL32:%[0-9]+]]:_(s16) = G_SHL [[AND37]], [[C7]](s16)
    ; CHECK-NEXT: [[OR32:%[0-9]+]]:_(s16) = G_OR [[OR31]], [[SHL32]]
    ; CHECK-NEXT: [[AND38:%[0-9]+]]:_(s16) = G_AND [[LSHR35]], [[C5]]
    ; CHECK-NEXT: [[SHL33:%[0-9]+]]:_(s16) = G_SHL [[AND38]], [[C8]](s16)
    ; CHECK-NEXT: [[OR33:%[0-9]+]]:_(s16) = G_OR [[OR32]], [[SHL33]]
    ; CHECK-NEXT: [[AND39:%[0-9]+]]:_(s16) = G_AND [[LSHR36]], [[C5]]
    ; CHECK-NEXT: [[SHL34:%[0-9]+]]:_(s16) = G_SHL [[AND39]], [[C9]](s16)
    ; CHECK-NEXT: [[OR34:%[0-9]+]]:_(s16) = G_OR [[OR33]], [[SHL34]]
    ; CHECK-NEXT: [[AND40:%[0-9]+]]:_(s16) = G_AND [[LSHR37]], [[C5]]
    ; CHECK-NEXT: [[SHL35:%[0-9]+]]:_(s16) = G_SHL [[AND40]], [[C10]](s16)
    ; CHECK-NEXT: [[OR35:%[0-9]+]]:_(s16) = G_OR [[OR34]], [[SHL35]]
    ; CHECK-NEXT: [[AND41:%[0-9]+]]:_(s16) = G_AND [[LSHR38]], [[C5]]
    ; CHECK-NEXT: [[SHL36:%[0-9]+]]:_(s16) = G_SHL [[AND41]], [[C11]](s16)
    ; CHECK-NEXT: [[OR36:%[0-9]+]]:_(s16) = G_OR [[OR35]], [[SHL36]]
    ; CHECK-NEXT: [[AND42:%[0-9]+]]:_(s16) = G_AND [[LSHR39]], [[C5]]
    ; CHECK-NEXT: [[SHL37:%[0-9]+]]:_(s16) = G_SHL [[AND42]], [[C12]](s16)
    ; CHECK-NEXT: [[OR37:%[0-9]+]]:_(s16) = G_OR [[OR36]], [[SHL37]]
    ; CHECK-NEXT: [[AND43:%[0-9]+]]:_(s16) = G_AND [[LSHR40]], [[C5]]
    ; CHECK-NEXT: [[SHL38:%[0-9]+]]:_(s16) = G_SHL [[AND43]], [[C13]](s16)
    ; CHECK-NEXT: [[OR38:%[0-9]+]]:_(s16) = G_OR [[OR37]], [[SHL38]]
    ; CHECK-NEXT: [[AND44:%[0-9]+]]:_(s16) = G_AND [[LSHR41]], [[C5]]
    ; CHECK-NEXT: [[SHL39:%[0-9]+]]:_(s16) = G_SHL [[AND44]], [[C14]](s16)
    ; CHECK-NEXT: [[OR39:%[0-9]+]]:_(s16) = G_OR [[OR38]], [[SHL39]]
    ; CHECK-NEXT: [[AND45:%[0-9]+]]:_(s16) = G_AND [[LSHR42]], [[C5]]
    ; CHECK-NEXT: [[SHL40:%[0-9]+]]:_(s16) = G_SHL [[AND45]], [[C15]](s16)
    ; CHECK-NEXT: [[OR40:%[0-9]+]]:_(s16) = G_OR [[OR39]], [[SHL40]]
    ; CHECK-NEXT: [[AND46:%[0-9]+]]:_(s16) = G_AND [[LSHR43]], [[C5]]
    ; CHECK-NEXT: [[SHL41:%[0-9]+]]:_(s16) = G_SHL [[AND46]], [[C16]](s16)
    ; CHECK-NEXT: [[OR41:%[0-9]+]]:_(s16) = G_OR [[OR40]], [[SHL41]]
    ; CHECK-NEXT: [[AND47:%[0-9]+]]:_(s16) = G_AND [[LSHR44]], [[C5]]
    ; CHECK-NEXT: [[SHL42:%[0-9]+]]:_(s16) = G_SHL [[AND47]], [[C17]](s16)
    ; CHECK-NEXT: [[OR42:%[0-9]+]]:_(s16) = G_OR [[OR41]], [[SHL42]]
    ; CHECK-NEXT: [[AND48:%[0-9]+]]:_(s16) = G_AND [[LSHR45]], [[C5]]
    ; CHECK-NEXT: [[SHL43:%[0-9]+]]:_(s16) = G_SHL [[AND48]], [[C18]](s16)
    ; CHECK-NEXT: [[OR43:%[0-9]+]]:_(s16) = G_OR [[OR42]], [[SHL43]]
    ; CHECK-NEXT: [[AND49:%[0-9]+]]:_(s16) = G_AND [[LSHR46]], [[C5]]
    ; CHECK-NEXT: [[SHL44:%[0-9]+]]:_(s16) = G_SHL [[AND49]], [[C19]](s16)
    ; CHECK-NEXT: [[OR44:%[0-9]+]]:_(s16) = G_OR [[OR43]], [[SHL44]]
    ; CHECK-NEXT: [[AND50:%[0-9]+]]:_(s16) = G_AND [[TRUNC3]], [[C5]]
    ; CHECK-NEXT: [[AND51:%[0-9]+]]:_(s16) = G_AND [[LSHR47]], [[C5]]
    ; CHECK-NEXT: [[SHL45:%[0-9]+]]:_(s16) = G_SHL [[AND51]], [[C5]](s16)
    ; CHECK-NEXT: [[OR45:%[0-9]+]]:_(s16) = G_OR [[AND50]], [[SHL45]]
    ; CHECK-NEXT: [[AND52:%[0-9]+]]:_(s16) = G_AND [[LSHR48]], [[C5]]
    ; CHECK-NEXT: [[SHL46:%[0-9]+]]:_(s16) = G_SHL [[AND52]], [[C6]](s16)
    ; CHECK-NEXT: [[OR46:%[0-9]+]]:_(s16) = G_OR [[OR45]], [[SHL46]]
    ; CHECK-NEXT: [[AND53:%[0-9]+]]:_(s16) = G_AND [[LSHR49]], [[C5]]
    ; CHECK-NEXT: [[SHL47:%[0-9]+]]:_(s16) = G_SHL [[AND53]], [[C7]](s16)
    ; CHECK-NEXT: [[OR47:%[0-9]+]]:_(s16) = G_OR [[OR46]], [[SHL47]]
    ; CHECK-NEXT: [[AND54:%[0-9]+]]:_(s16) = G_AND [[LSHR50]], [[C5]]
    ; CHECK-NEXT: [[SHL48:%[0-9]+]]:_(s16) = G_SHL [[AND54]], [[C8]](s16)
    ; CHECK-NEXT: [[OR48:%[0-9]+]]:_(s16) = G_OR [[OR47]], [[SHL48]]
    ; CHECK-NEXT: [[AND55:%[0-9]+]]:_(s16) = G_AND [[LSHR51]], [[C5]]
    ; CHECK-NEXT: [[SHL49:%[0-9]+]]:_(s16) = G_SHL [[AND55]], [[C9]](s16)
    ; CHECK-NEXT: [[OR49:%[0-9]+]]:_(s16) = G_OR [[OR48]], [[SHL49]]
    ; CHECK-NEXT: [[AND56:%[0-9]+]]:_(s16) = G_AND [[LSHR52]], [[C5]]
    ; CHECK-NEXT: [[SHL50:%[0-9]+]]:_(s16) = G_SHL [[AND56]], [[C10]](s16)
    ; CHECK-NEXT: [[OR50:%[0-9]+]]:_(s16) = G_OR [[OR49]], [[SHL50]]
    ; CHECK-NEXT: [[AND57:%[0-9]+]]:_(s16) = G_AND [[LSHR53]], [[C5]]
    ; CHECK-NEXT: [[SHL51:%[0-9]+]]:_(s16) = G_SHL [[AND57]], [[C11]](s16)
    ; CHECK-NEXT: [[OR51:%[0-9]+]]:_(s16) = G_OR [[OR50]], [[SHL51]]
    ; CHECK-NEXT: [[AND58:%[0-9]+]]:_(s16) = G_AND [[LSHR54]], [[C5]]
    ; CHECK-NEXT: [[SHL52:%[0-9]+]]:_(s16) = G_SHL [[AND58]], [[C12]](s16)
    ; CHECK-NEXT: [[OR52:%[0-9]+]]:_(s16) = G_OR [[OR51]], [[SHL52]]
    ; CHECK-NEXT: [[AND59:%[0-9]+]]:_(s16) = G_AND [[LSHR55]], [[C5]]
    ; CHECK-NEXT: [[SHL53:%[0-9]+]]:_(s16) = G_SHL [[AND59]], [[C13]](s16)
    ; CHECK-NEXT: [[OR53:%[0-9]+]]:_(s16) = G_OR [[OR52]], [[SHL53]]
    ; CHECK-NEXT: [[AND60:%[0-9]+]]:_(s16) = G_AND [[LSHR56]], [[C5]]
    ; CHECK-NEXT: [[SHL54:%[0-9]+]]:_(s16) = G_SHL [[AND60]], [[C14]](s16)
    ; CHECK-NEXT: [[OR54:%[0-9]+]]:_(s16) = G_OR [[OR53]], [[SHL54]]
    ; CHECK-NEXT: [[AND61:%[0-9]+]]:_(s16) = G_AND [[LSHR57]], [[C5]]
    ; CHECK-NEXT: [[SHL55:%[0-9]+]]:_(s16) = G_SHL [[AND61]], [[C15]](s16)
    ; CHECK-NEXT: [[OR55:%[0-9]+]]:_(s16) = G_OR [[OR54]], [[SHL55]]
    ; CHECK-NEXT: [[AND62:%[0-9]+]]:_(s16) = G_AND [[LSHR58]], [[C5]]
    ; CHECK-NEXT: [[SHL56:%[0-9]+]]:_(s16) = G_SHL [[AND62]], [[C16]](s16)
    ; CHECK-NEXT: [[OR56:%[0-9]+]]:_(s16) = G_OR [[OR55]], [[SHL56]]
    ; CHECK-NEXT: [[AND63:%[0-9]+]]:_(s16) = G_AND [[LSHR59]], [[C5]]
    ; CHECK-NEXT: [[SHL57:%[0-9]+]]:_(s16) = G_SHL [[AND63]], [[C17]](s16)
    ; CHECK-NEXT: [[OR57:%[0-9]+]]:_(s16) = G_OR [[OR56]], [[SHL57]]
    ; CHECK-NEXT: [[AND64:%[0-9]+]]:_(s16) = G_AND [[LSHR60]], [[C5]]
    ; CHECK-NEXT: [[SHL58:%[0-9]+]]:_(s16) = G_SHL [[AND64]], [[C18]](s16)
    ; CHECK-NEXT: [[OR58:%[0-9]+]]:_(s16) = G_OR [[OR57]], [[SHL58]]
    ; CHECK-NEXT: [[AND65:%[0-9]+]]:_(s16) = G_AND [[LSHR61]], [[C5]]
    ; CHECK-NEXT: [[SHL59:%[0-9]+]]:_(s16) = G_SHL [[AND65]], [[C19]](s16)
    ; CHECK-NEXT: [[OR59:%[0-9]+]]:_(s16) = G_OR [[OR58]], [[SHL59]]
    ; CHECK-NEXT: [[C20:%[0-9]+]]:_(s16) = G_CONSTANT i16 0
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL60:%[0-9]+]]:_(s16) = G_SHL [[COPY2]], [[C5]](s16)
    ; CHECK-NEXT: [[OR60:%[0-9]+]]:_(s16) = G_OR [[COPY1]], [[SHL60]]
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL61:%[0-9]+]]:_(s16) = G_SHL [[COPY3]], [[C6]](s16)
    ; CHECK-NEXT: [[OR61:%[0-9]+]]:_(s16) = G_OR [[OR60]], [[SHL61]]
    ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL62:%[0-9]+]]:_(s16) = G_SHL [[COPY4]], [[C7]](s16)
    ; CHECK-NEXT: [[OR62:%[0-9]+]]:_(s16) = G_OR [[OR61]], [[SHL62]]
    ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL63:%[0-9]+]]:_(s16) = G_SHL [[COPY5]], [[C8]](s16)
    ; CHECK-NEXT: [[OR63:%[0-9]+]]:_(s16) = G_OR [[OR62]], [[SHL63]]
    ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL64:%[0-9]+]]:_(s16) = G_SHL [[COPY6]], [[C9]](s16)
    ; CHECK-NEXT: [[OR64:%[0-9]+]]:_(s16) = G_OR [[OR63]], [[SHL64]]
    ; CHECK-NEXT: [[COPY7:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL65:%[0-9]+]]:_(s16) = G_SHL [[COPY7]], [[C10]](s16)
    ; CHECK-NEXT: [[OR65:%[0-9]+]]:_(s16) = G_OR [[OR64]], [[SHL65]]
    ; CHECK-NEXT: [[COPY8:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL66:%[0-9]+]]:_(s16) = G_SHL [[COPY8]], [[C11]](s16)
    ; CHECK-NEXT: [[OR66:%[0-9]+]]:_(s16) = G_OR [[OR65]], [[SHL66]]
    ; CHECK-NEXT: [[COPY9:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL67:%[0-9]+]]:_(s16) = G_SHL [[COPY9]], [[C12]](s16)
    ; CHECK-NEXT: [[OR67:%[0-9]+]]:_(s16) = G_OR [[OR66]], [[SHL67]]
    ; CHECK-NEXT: [[COPY10:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL68:%[0-9]+]]:_(s16) = G_SHL [[COPY10]], [[C13]](s16)
    ; CHECK-NEXT: [[OR68:%[0-9]+]]:_(s16) = G_OR [[OR67]], [[SHL68]]
    ; CHECK-NEXT: [[COPY11:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL69:%[0-9]+]]:_(s16) = G_SHL [[COPY11]], [[C14]](s16)
    ; CHECK-NEXT: [[OR69:%[0-9]+]]:_(s16) = G_OR [[OR68]], [[SHL69]]
    ; CHECK-NEXT: [[COPY12:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL70:%[0-9]+]]:_(s16) = G_SHL [[COPY12]], [[C15]](s16)
    ; CHECK-NEXT: [[OR70:%[0-9]+]]:_(s16) = G_OR [[OR69]], [[SHL70]]
    ; CHECK-NEXT: [[COPY13:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL71:%[0-9]+]]:_(s16) = G_SHL [[COPY13]], [[C16]](s16)
    ; CHECK-NEXT: [[OR71:%[0-9]+]]:_(s16) = G_OR [[OR70]], [[SHL71]]
    ; CHECK-NEXT: [[COPY14:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL72:%[0-9]+]]:_(s16) = G_SHL [[COPY14]], [[C17]](s16)
    ; CHECK-NEXT: [[OR72:%[0-9]+]]:_(s16) = G_OR [[OR71]], [[SHL72]]
    ; CHECK-NEXT: [[COPY15:%[0-9]+]]:_(s16) = COPY [[C20]](s16)
    ; CHECK-NEXT: [[SHL73:%[0-9]+]]:_(s16) = G_SHL [[COPY15]], [[C18]](s16)
    ; CHECK-NEXT: [[OR73:%[0-9]+]]:_(s16) = G_OR [[OR72]], [[SHL73]]
    ; CHECK-NEXT: [[SHL74:%[0-9]+]]:_(s16) = G_SHL [[C20]], [[C19]](s16)
    ; CHECK-NEXT: [[OR74:%[0-9]+]]:_(s16) = G_OR [[OR73]], [[SHL74]]
    ; CHECK-NEXT: [[COPY16:%[0-9]+]]:_(s64) = COPY [[MV2]](s64)
    ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[OR14]](s16)
    ; CHECK-NEXT: [[ZEXT1:%[0-9]+]]:_(s32) = G_ZEXT [[OR29]](s16)
    ; CHECK-NEXT: [[SHL75:%[0-9]+]]:_(s32) = G_SHL [[ZEXT1]], [[C4]](s32)
    ; CHECK-NEXT: [[OR75:%[0-9]+]]:_(s32) = G_OR [[ZEXT]], [[SHL75]]
    ; CHECK-NEXT: [[ZEXT2:%[0-9]+]]:_(s32) = G_ZEXT [[OR44]](s16)
    ; CHECK-NEXT: [[ZEXT3:%[0-9]+]]:_(s32) = G_ZEXT [[OR59]](s16)
    ; CHECK-NEXT: [[SHL76:%[0-9]+]]:_(s32) = G_SHL [[ZEXT3]], [[C4]](s32)
    ; CHECK-NEXT: [[OR76:%[0-9]+]]:_(s32) = G_OR [[ZEXT2]], [[SHL76]]
    ; CHECK-NEXT: [[MV3:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[OR75]](s32), [[OR76]](s32)
    ; CHECK-NEXT: [[ZEXT4:%[0-9]+]]:_(s32) = G_ZEXT [[OR74]](s16)
    ; CHECK-NEXT: [[COPY17:%[0-9]+]]:_(s32) = COPY [[C2]](s32)
    ; CHECK-NEXT: [[SHL77:%[0-9]+]]:_(s32) = G_SHL [[COPY17]], [[C4]](s32)
    ; CHECK-NEXT: [[OR77:%[0-9]+]]:_(s32) = G_OR [[ZEXT4]], [[SHL77]]
    ; CHECK-NEXT: [[COPY18:%[0-9]+]]:_(s32) = COPY [[C2]](s32)
    ; CHECK-NEXT: [[COPY19:%[0-9]+]]:_(s32) = COPY [[C2]](s32)
    ; CHECK-NEXT: [[SHL78:%[0-9]+]]:_(s32) = G_SHL [[COPY19]], [[C4]](s32)
    ; CHECK-NEXT: [[OR78:%[0-9]+]]:_(s32) = G_OR [[COPY18]], [[SHL78]]
    ; CHECK-NEXT: [[MV4:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[OR77]](s32), [[OR78]](s32)
    ; CHECK-NEXT: [[MV5:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[MV3]](s64), [[MV4]](s64)
    ; CHECK-NEXT: [[EXTRACT:%[0-9]+]]:_(s64) = G_EXTRACT [[MV5]](s128), 0
    ; CHECK-NEXT: [[AND66:%[0-9]+]]:_(s64) = G_AND [[COPY16]], [[EXTRACT]]
    ; CHECK-NEXT: [[UV5:%[0-9]+]]:_(s32), [[UV6:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[AND66]](s64)
    ; CHECK-NEXT: [[TRUNC4:%[0-9]+]]:_(s16) = G_TRUNC [[UV5]](s32)
    ; CHECK-NEXT: [[LSHR62:%[0-9]+]]:_(s32) = G_LSHR [[UV5]], [[C4]](s32)
    ; CHECK-NEXT: [[TRUNC5:%[0-9]+]]:_(s16) = G_TRUNC [[LSHR62]](s32)
    ; CHECK-NEXT: [[LSHR63:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C5]](s16)
    ; CHECK-NEXT: [[LSHR64:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C6]](s16)
    ; CHECK-NEXT: [[LSHR65:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C7]](s16)
    ; CHECK-NEXT: [[LSHR66:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C8]](s16)
    ; CHECK-NEXT: [[LSHR67:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C9]](s16)
    ; CHECK-NEXT: [[LSHR68:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C10]](s16)
    ; CHECK-NEXT: [[LSHR69:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C11]](s16)
    ; CHECK-NEXT: [[LSHR70:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C12]](s16)
    ; CHECK-NEXT: [[LSHR71:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C13]](s16)
    ; CHECK-NEXT: [[LSHR72:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C14]](s16)
    ; CHECK-NEXT: [[LSHR73:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C15]](s16)
    ; CHECK-NEXT: [[LSHR74:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C16]](s16)
    ; CHECK-NEXT: [[LSHR75:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C17]](s16)
    ; CHECK-NEXT: [[LSHR76:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C18]](s16)
    ; CHECK-NEXT: [[LSHR77:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC4]], [[C19]](s16)
    ; CHECK-NEXT: [[LSHR78:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C5]](s16)
    ; CHECK-NEXT: [[LSHR79:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C6]](s16)
    ; CHECK-NEXT: [[LSHR80:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C7]](s16)
    ; CHECK-NEXT: [[LSHR81:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C8]](s16)
    ; CHECK-NEXT: [[LSHR82:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C9]](s16)
    ; CHECK-NEXT: [[LSHR83:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C10]](s16)
    ; CHECK-NEXT: [[LSHR84:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C11]](s16)
    ; CHECK-NEXT: [[LSHR85:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C12]](s16)
    ; CHECK-NEXT: [[LSHR86:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C13]](s16)
    ; CHECK-NEXT: [[LSHR87:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C14]](s16)
    ; CHECK-NEXT: [[LSHR88:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C15]](s16)
    ; CHECK-NEXT: [[LSHR89:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C16]](s16)
    ; CHECK-NEXT: [[LSHR90:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C17]](s16)
    ; CHECK-NEXT: [[LSHR91:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C18]](s16)
    ; CHECK-NEXT: [[LSHR92:%[0-9]+]]:_(s16) = G_LSHR [[TRUNC5]], [[C19]](s16)
    ; CHECK-NEXT: [[C21:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
    ; CHECK-NEXT: [[AND67:%[0-9]+]]:_(s32) = G_AND [[UV5]], [[C21]]
    ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR63]](s16)
    ; CHECK-NEXT: [[AND68:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C21]]
    ; CHECK-NEXT: [[SHL79:%[0-9]+]]:_(s32) = G_SHL [[AND68]], [[C21]](s32)
    ; CHECK-NEXT: [[OR79:%[0-9]+]]:_(s32) = G_OR [[AND67]], [[SHL79]]
    ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR64]](s16)
    ; CHECK-NEXT: [[AND69:%[0-9]+]]:_(s32) = G_AND [[ANYEXT1]], [[C21]]
    ; CHECK-NEXT: [[C22:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
    ; CHECK-NEXT: [[SHL80:%[0-9]+]]:_(s32) = G_SHL [[AND69]], [[C22]](s32)
    ; CHECK-NEXT: [[OR80:%[0-9]+]]:_(s32) = G_OR [[OR79]], [[SHL80]]
    ; CHECK-NEXT: [[ANYEXT2:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR65]](s16)
    ; CHECK-NEXT: [[AND70:%[0-9]+]]:_(s32) = G_AND [[ANYEXT2]], [[C21]]
    ; CHECK-NEXT: [[C23:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
    ; CHECK-NEXT: [[SHL81:%[0-9]+]]:_(s32) = G_SHL [[AND70]], [[C23]](s32)
    ; CHECK-NEXT: [[OR81:%[0-9]+]]:_(s32) = G_OR [[OR80]], [[SHL81]]
    ; CHECK-NEXT: [[ANYEXT3:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR66]](s16)
    ; CHECK-NEXT: [[AND71:%[0-9]+]]:_(s32) = G_AND [[ANYEXT3]], [[C21]]
    ; CHECK-NEXT: [[C24:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
    ; CHECK-NEXT: [[SHL82:%[0-9]+]]:_(s32) = G_SHL [[AND71]], [[C24]](s32)
    ; CHECK-NEXT: [[OR82:%[0-9]+]]:_(s32) = G_OR [[OR81]], [[SHL82]]
    ; CHECK-NEXT: [[ANYEXT4:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR67]](s16)
    ; CHECK-NEXT: [[AND72:%[0-9]+]]:_(s32) = G_AND [[ANYEXT4]], [[C21]]
    ; CHECK-NEXT: [[C25:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
    ; CHECK-NEXT: [[SHL83:%[0-9]+]]:_(s32) = G_SHL [[AND72]], [[C25]](s32)
    ; CHECK-NEXT: [[OR83:%[0-9]+]]:_(s32) = G_OR [[OR82]], [[SHL83]]
    ; CHECK-NEXT: [[ANYEXT5:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR68]](s16)
    ; CHECK-NEXT: [[AND73:%[0-9]+]]:_(s32) = G_AND [[ANYEXT5]], [[C21]]
    ; CHECK-NEXT: [[C26:%[0-9]+]]:_(s32) = G_CONSTANT i32 6
    ; CHECK-NEXT: [[SHL84:%[0-9]+]]:_(s32) = G_SHL [[AND73]], [[C26]](s32)
    ; CHECK-NEXT: [[OR84:%[0-9]+]]:_(s32) = G_OR [[OR83]], [[SHL84]]
    ; CHECK-NEXT: [[ANYEXT6:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR69]](s16)
    ; CHECK-NEXT: [[AND74:%[0-9]+]]:_(s32) = G_AND [[ANYEXT6]], [[C21]]
    ; CHECK-NEXT: [[C27:%[0-9]+]]:_(s32) = G_CONSTANT i32 7
    ; CHECK-NEXT: [[SHL85:%[0-9]+]]:_(s32) = G_SHL [[AND74]], [[C27]](s32)
    ; CHECK-NEXT: [[OR85:%[0-9]+]]:_(s32) = G_OR [[OR84]], [[SHL85]]
    ; CHECK-NEXT: [[ANYEXT7:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR70]](s16)
    ; CHECK-NEXT: [[AND75:%[0-9]+]]:_(s32) = G_AND [[ANYEXT7]], [[C21]]
    ; CHECK-NEXT: [[C28:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
    ; CHECK-NEXT: [[SHL86:%[0-9]+]]:_(s32) = G_SHL [[AND75]], [[C28]](s32)
    ; CHECK-NEXT: [[OR86:%[0-9]+]]:_(s32) = G_OR [[OR85]], [[SHL86]]
    ; CHECK-NEXT: [[ANYEXT8:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR71]](s16)
    ; CHECK-NEXT: [[AND76:%[0-9]+]]:_(s32) = G_AND [[ANYEXT8]], [[C21]]
    ; CHECK-NEXT: [[C29:%[0-9]+]]:_(s32) = G_CONSTANT i32 9
    ; CHECK-NEXT: [[SHL87:%[0-9]+]]:_(s32) = G_SHL [[AND76]], [[C29]](s32)
    ; CHECK-NEXT: [[OR87:%[0-9]+]]:_(s32) = G_OR [[OR86]], [[SHL87]]
    ; CHECK-NEXT: [[ANYEXT9:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR72]](s16)
    ; CHECK-NEXT: [[AND77:%[0-9]+]]:_(s32) = G_AND [[ANYEXT9]], [[C21]]
    ; CHECK-NEXT: [[C30:%[0-9]+]]:_(s32) = G_CONSTANT i32 10
    ; CHECK-NEXT: [[SHL88:%[0-9]+]]:_(s32) = G_SHL [[AND77]], [[C30]](s32)
    ; CHECK-NEXT: [[OR88:%[0-9]+]]:_(s32) = G_OR [[OR87]], [[SHL88]]
    ; CHECK-NEXT: [[ANYEXT10:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR73]](s16)
    ; CHECK-NEXT: [[AND78:%[0-9]+]]:_(s32) = G_AND [[ANYEXT10]], [[C21]]
    ; CHECK-NEXT: [[C31:%[0-9]+]]:_(s32) = G_CONSTANT i32 11
    ; CHECK-NEXT: [[SHL89:%[0-9]+]]:_(s32) = G_SHL [[AND78]], [[C31]](s32)
    ; CHECK-NEXT: [[OR89:%[0-9]+]]:_(s32) = G_OR [[OR88]], [[SHL89]]
    ; CHECK-NEXT: [[ANYEXT11:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR74]](s16)
    ; CHECK-NEXT: [[AND79:%[0-9]+]]:_(s32) = G_AND [[ANYEXT11]], [[C21]]
    ; CHECK-NEXT: [[C32:%[0-9]+]]:_(s32) = G_CONSTANT i32 12
    ; CHECK-NEXT: [[SHL90:%[0-9]+]]:_(s32) = G_SHL [[AND79]], [[C32]](s32)
    ; CHECK-NEXT: [[OR90:%[0-9]+]]:_(s32) = G_OR [[OR89]], [[SHL90]]
    ; CHECK-NEXT: [[ANYEXT12:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR75]](s16)
    ; CHECK-NEXT: [[AND80:%[0-9]+]]:_(s32) = G_AND [[ANYEXT12]], [[C21]]
    ; CHECK-NEXT: [[C33:%[0-9]+]]:_(s32) = G_CONSTANT i32 13
    ; CHECK-NEXT: [[SHL91:%[0-9]+]]:_(s32) = G_SHL [[AND80]], [[C33]](s32)
    ; CHECK-NEXT: [[OR91:%[0-9]+]]:_(s32) = G_OR [[OR90]], [[SHL91]]
    ; CHECK-NEXT: [[ANYEXT13:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR76]](s16)
    ; CHECK-NEXT: [[AND81:%[0-9]+]]:_(s32) = G_AND [[ANYEXT13]], [[C21]]
    ; CHECK-NEXT: [[C34:%[0-9]+]]:_(s32) = G_CONSTANT i32 14
    ; CHECK-NEXT: [[SHL92:%[0-9]+]]:_(s32) = G_SHL [[AND81]], [[C34]](s32)
    ; CHECK-NEXT: [[OR92:%[0-9]+]]:_(s32) = G_OR [[OR91]], [[SHL92]]
    ; CHECK-NEXT: [[ANYEXT14:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR77]](s16)
    ; CHECK-NEXT: [[AND82:%[0-9]+]]:_(s32) = G_AND [[ANYEXT14]], [[C21]]
    ; CHECK-NEXT: [[C35:%[0-9]+]]:_(s32) = G_CONSTANT i32 15
    ; CHECK-NEXT: [[SHL93:%[0-9]+]]:_(s32) = G_SHL [[AND82]], [[C35]](s32)
    ; CHECK-NEXT: [[OR93:%[0-9]+]]:_(s32) = G_OR [[OR92]], [[SHL93]]
    ; CHECK-NEXT: [[AND83:%[0-9]+]]:_(s32) = G_AND [[LSHR62]], [[C21]]
    ; CHECK-NEXT: [[SHL94:%[0-9]+]]:_(s32) = G_SHL [[AND83]], [[C4]](s32)
    ; CHECK-NEXT: [[OR94:%[0-9]+]]:_(s32) = G_OR [[OR93]], [[SHL94]]
    ; CHECK-NEXT: [[ANYEXT15:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR78]](s16)
    ; CHECK-NEXT: [[AND84:%[0-9]+]]:_(s32) = G_AND [[ANYEXT15]], [[C21]]
    ; CHECK-NEXT: [[C36:%[0-9]+]]:_(s32) = G_CONSTANT i32 17
    ; CHECK-NEXT: [[SHL95:%[0-9]+]]:_(s32) = G_SHL [[AND84]], [[C36]](s32)
    ; CHECK-NEXT: [[OR95:%[0-9]+]]:_(s32) = G_OR [[OR94]], [[SHL95]]
    ; CHECK-NEXT: [[ANYEXT16:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR79]](s16)
    ; CHECK-NEXT: [[AND85:%[0-9]+]]:_(s32) = G_AND [[ANYEXT16]], [[C21]]
    ; CHECK-NEXT: [[C37:%[0-9]+]]:_(s32) = G_CONSTANT i32 18
    ; CHECK-NEXT: [[SHL96:%[0-9]+]]:_(s32) = G_SHL [[AND85]], [[C37]](s32)
    ; CHECK-NEXT: [[OR96:%[0-9]+]]:_(s32) = G_OR [[OR95]], [[SHL96]]
    ; CHECK-NEXT: [[ANYEXT17:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR80]](s16)
    ; CHECK-NEXT: [[AND86:%[0-9]+]]:_(s32) = G_AND [[ANYEXT17]], [[C21]]
    ; CHECK-NEXT: [[C38:%[0-9]+]]:_(s32) = G_CONSTANT i32 19
    ; CHECK-NEXT: [[SHL97:%[0-9]+]]:_(s32) = G_SHL [[AND86]], [[C38]](s32)
    ; CHECK-NEXT: [[OR97:%[0-9]+]]:_(s32) = G_OR [[OR96]], [[SHL97]]
    ; CHECK-NEXT: [[ANYEXT18:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR81]](s16)
    ; CHECK-NEXT: [[AND87:%[0-9]+]]:_(s32) = G_AND [[ANYEXT18]], [[C21]]
    ; CHECK-NEXT: [[C39:%[0-9]+]]:_(s32) = G_CONSTANT i32 20
    ; CHECK-NEXT: [[SHL98:%[0-9]+]]:_(s32) = G_SHL [[AND87]], [[C39]](s32)
    ; CHECK-NEXT: [[OR98:%[0-9]+]]:_(s32) = G_OR [[OR97]], [[SHL98]]
    ; CHECK-NEXT: [[ANYEXT19:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR82]](s16)
    ; CHECK-NEXT: [[AND88:%[0-9]+]]:_(s32) = G_AND [[ANYEXT19]], [[C21]]
    ; CHECK-NEXT: [[C40:%[0-9]+]]:_(s32) = G_CONSTANT i32 21
    ; CHECK-NEXT: [[SHL99:%[0-9]+]]:_(s32) = G_SHL [[AND88]], [[C40]](s32)
    ; CHECK-NEXT: [[OR99:%[0-9]+]]:_(s32) = G_OR [[OR98]], [[SHL99]]
    ; CHECK-NEXT: [[ANYEXT20:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR83]](s16)
    ; CHECK-NEXT: [[AND89:%[0-9]+]]:_(s32) = G_AND [[ANYEXT20]], [[C21]]
    ; CHECK-NEXT: [[C41:%[0-9]+]]:_(s32) = G_CONSTANT i32 22
    ; CHECK-NEXT: [[SHL100:%[0-9]+]]:_(s32) = G_SHL [[AND89]], [[C41]](s32)
    ; CHECK-NEXT: [[OR100:%[0-9]+]]:_(s32) = G_OR [[OR99]], [[SHL100]]
    ; CHECK-NEXT: [[ANYEXT21:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR84]](s16)
    ; CHECK-NEXT: [[AND90:%[0-9]+]]:_(s32) = G_AND [[ANYEXT21]], [[C21]]
    ; CHECK-NEXT: [[C42:%[0-9]+]]:_(s32) = G_CONSTANT i32 23
    ; CHECK-NEXT: [[SHL101:%[0-9]+]]:_(s32) = G_SHL [[AND90]], [[C42]](s32)
    ; CHECK-NEXT: [[OR101:%[0-9]+]]:_(s32) = G_OR [[OR100]], [[SHL101]]
    ; CHECK-NEXT: [[ANYEXT22:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR85]](s16)
    ; CHECK-NEXT: [[AND91:%[0-9]+]]:_(s32) = G_AND [[ANYEXT22]], [[C21]]
    ; CHECK-NEXT: [[C43:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
    ; CHECK-NEXT: [[SHL102:%[0-9]+]]:_(s32) = G_SHL [[AND91]], [[C43]](s32)
    ; CHECK-NEXT: [[OR102:%[0-9]+]]:_(s32) = G_OR [[OR101]], [[SHL102]]
    ; CHECK-NEXT: [[ANYEXT23:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR86]](s16)
    ; CHECK-NEXT: [[AND92:%[0-9]+]]:_(s32) = G_AND [[ANYEXT23]], [[C21]]
    ; CHECK-NEXT: [[C44:%[0-9]+]]:_(s32) = G_CONSTANT i32 25
    ; CHECK-NEXT: [[SHL103:%[0-9]+]]:_(s32) = G_SHL [[AND92]], [[C44]](s32)
    ; CHECK-NEXT: [[OR103:%[0-9]+]]:_(s32) = G_OR [[OR102]], [[SHL103]]
    ; CHECK-NEXT: [[ANYEXT24:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR87]](s16)
    ; CHECK-NEXT: [[AND93:%[0-9]+]]:_(s32) = G_AND [[ANYEXT24]], [[C21]]
    ; CHECK-NEXT: [[C45:%[0-9]+]]:_(s32) = G_CONSTANT i32 26
    ; CHECK-NEXT: [[SHL104:%[0-9]+]]:_(s32) = G_SHL [[AND93]], [[C45]](s32)
    ; CHECK-NEXT: [[OR104:%[0-9]+]]:_(s32) = G_OR [[OR103]], [[SHL104]]
    ; CHECK-NEXT: [[ANYEXT25:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR88]](s16)
    ; CHECK-NEXT: [[AND94:%[0-9]+]]:_(s32) = G_AND [[ANYEXT25]], [[C21]]
    ; CHECK-NEXT: [[C46:%[0-9]+]]:_(s32) = G_CONSTANT i32 27
    ; CHECK-NEXT: [[SHL105:%[0-9]+]]:_(s32) = G_SHL [[AND94]], [[C46]](s32)
    ; CHECK-NEXT: [[OR105:%[0-9]+]]:_(s32) = G_OR [[OR104]], [[SHL105]]
    ; CHECK-NEXT: [[ANYEXT26:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR89]](s16)
    ; CHECK-NEXT: [[AND95:%[0-9]+]]:_(s32) = G_AND [[ANYEXT26]], [[C21]]
    ; CHECK-NEXT: [[C47:%[0-9]+]]:_(s32) = G_CONSTANT i32 28
    ; CHECK-NEXT: [[SHL106:%[0-9]+]]:_(s32) = G_SHL [[AND95]], [[C47]](s32)
    ; CHECK-NEXT: [[OR106:%[0-9]+]]:_(s32) = G_OR [[OR105]], [[SHL106]]
    ; CHECK-NEXT: [[ANYEXT27:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR90]](s16)
    ; CHECK-NEXT: [[AND96:%[0-9]+]]:_(s32) = G_AND [[ANYEXT27]], [[C21]]
    ; CHECK-NEXT: [[C48:%[0-9]+]]:_(s32) = G_CONSTANT i32 29
    ; CHECK-NEXT: [[SHL107:%[0-9]+]]:_(s32) = G_SHL [[AND96]], [[C48]](s32)
    ; CHECK-NEXT: [[OR107:%[0-9]+]]:_(s32) = G_OR [[OR106]], [[SHL107]]
    ; CHECK-NEXT: [[ANYEXT28:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR91]](s16)
    ; CHECK-NEXT: [[AND97:%[0-9]+]]:_(s32) = G_AND [[ANYEXT28]], [[C21]]
    ; CHECK-NEXT: [[C49:%[0-9]+]]:_(s32) = G_CONSTANT i32 30
    ; CHECK-NEXT: [[SHL108:%[0-9]+]]:_(s32) = G_SHL [[AND97]], [[C49]](s32)
    ; CHECK-NEXT: [[OR108:%[0-9]+]]:_(s32) = G_OR [[OR107]], [[SHL108]]
    ; CHECK-NEXT: [[ANYEXT29:%[0-9]+]]:_(s32) = G_ANYEXT [[LSHR92]](s16)
    ; CHECK-NEXT: [[AND98:%[0-9]+]]:_(s32) = G_AND [[ANYEXT29]], [[C21]]
    ; CHECK-NEXT: [[C50:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
    ; CHECK-NEXT: [[SHL109:%[0-9]+]]:_(s32) = G_SHL [[AND98]], [[C50]](s32)
    ; CHECK-NEXT: [[OR109:%[0-9]+]]:_(s32) = G_OR [[OR108]], [[SHL109]]
    ; CHECK-NEXT: $vgpr0 = COPY [[OR109]](s32)
    %0:_(s96) = COPY $vgpr0_vgpr1_vgpr2
    %1:_(s65) = G_TRUNC %0
    %2:_(s65) = G_CTPOP %1
    %3:_(s32) = G_TRUNC %2
    $vgpr0 = COPY %3
...

---
name: ctpop_s32_s65
body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2
    ; CHECK-LABEL: name: ctpop_s32_s65
    ; CHECK: liveins: $vgpr0_vgpr1_vgpr2
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s96) = COPY $vgpr0_vgpr1_vgpr2
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
    ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32), [[UV2:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s96)
    ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
    ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[UV]](s32), [[UV1]](s32)
    ; CHECK-NEXT: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[UV2]](s32), [[DEF]](s32)
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[MV]], [[C]]
    ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[MV1]], [[C1]]
    ; CHECK-NEXT: [[CTPOP:%[0-9]+]]:_(s32) = G_CTPOP [[AND]](s64)
    ; CHECK-NEXT: [[CTPOP1:%[0-9]+]]:_(s32) = G_CTPOP [[AND1]](s64)
    ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[CTPOP1]], [[CTPOP]]
    ; CHECK-NEXT: $vgpr0 = COPY [[ADD]](s32)
    %0:_(s96) = COPY $vgpr0_vgpr1_vgpr2
    %1:_(s65) = G_TRUNC %0
    %2:_(s32) = G_CTPOP %1
    $vgpr0 = COPY %2
...