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

---
name: test_extract_lo32_i64
body: |
  bb.0.entry:
    liveins: $vgpr0_vgpr1

    ; CHECK-LABEL: name: test_extract_lo32_i64
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
    ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s64), 0
    ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
    %0:_(s64) = COPY $vgpr0_vgpr1
    %1:_(s32) = G_EXTRACT %0, 0
    S_ENDPGM implicit %1
...
---
name: test_extract_hi32_i64
body: |
  bb.0.entry:
    liveins: $vgpr0_vgpr1

    ; CHECK-LABEL: name: test_extract_hi32_i64
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
    ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s64), 32
    ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
    %0:_(s64) = COPY $vgpr0_vgpr1
    %1:_(s32) = G_EXTRACT %0, 32
     S_ENDPGM implicit %1
...

---
name: test_extract_dword0_i128
body: |
  bb.0.entry:
    liveins: $vgpr0_vgpr1

    ; CHECK-LABEL: name: test_extract_dword0_i128
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
    ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s64), 0
    ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
    %0:_(s64) = COPY $vgpr0_vgpr1
    %1:_(s32) = G_EXTRACT %0, 0
    S_ENDPGM implicit %1
...

---
name: test_extract_dword1_i128
body: |
  bb.0.entry:
    liveins: $vgpr0_vgpr1_vgpr2_vgpr3

    ; CHECK-LABEL: name: test_extract_dword1_i128
    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s128), 32
    ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    %1:_(s32) = G_EXTRACT %0, 32
    S_ENDPGM implicit %1
...

---
name: test_extract_dword2_i128
body: |
  bb.0.entry:
    liveins: $vgpr0_vgpr1_vgpr2_vgpr3

    ; CHECK-LABEL: name: test_extract_dword2_i128
    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s128), 64
    ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    %1:_(s32) = G_EXTRACT %0, 64
    S_ENDPGM implicit %1
...

---
name: test_extract_dword3_i128
body: |
  bb.0.entry:
    liveins: $vgpr0_vgpr1_vgpr2_vgpr3

    ; CHECK-LABEL: name: test_extract_dword3_i128
    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s128), 96
    ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    %1:_(s32) = G_EXTRACT %0, 96
     S_ENDPGM implicit %1
...
---
name: test_extract_dword2_i96
body: |
  bb.0.entry:
    liveins: $vgpr0_vgpr1_vgpr2

    ; CHECK-LABEL: name: test_extract_dword2_i96
    ; CHECK: [[COPY:%[0-9]+]]:_(s96) = COPY $vgpr0_vgpr1_vgpr2
    ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s96), 64
    ; CHECK: S_ENDPGM implicit [[EXTRACT]](s32)
    %0:_(s96) = COPY $vgpr0_vgpr1_vgpr2
    %1:_(s32) = G_EXTRACT %0, 64
    S_ENDPGM implicit %1
...
