# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass none -o - %s | FileCheck %s
# This test ensures that the MIR parser parses shufflemask correctly

# CHECK-LABEL: name: test_shuffle_1_0
# CHECK: G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(1, 0)
---
name: test_shuffle_1_0
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $d0

    %0:_(<2 x s32>) = COPY $d0
    %2:_(<2 x s32>) = G_IMPLICIT_DEF
    %1:_(<2 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %2, shufflemask(1, 0)
    $d0 = COPY %1(<2 x s32>)
    RET_ReallyLR implicit $d0

...

# CHECK-LABEL: name: test_shuffle_nospace
# CHECK: G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(1, 0)
---
name: test_shuffle_nospace
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $d0

    %0:_(<2 x s32>) = COPY $d0
    %2:_(<2 x s32>) = G_IMPLICIT_DEF
    %1:_(<2 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %2, shufflemask(1,0)
    $d0 = COPY %1(<2 x s32>)
    RET_ReallyLR implicit $d0

...

# CHECK-LABEL: name: test_shuffle_0_0
# CHECK: G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(0, 0)
---
name: test_shuffle_0_0
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $d0

    %0:_(<2 x s32>) = COPY $d0
    %2:_(<2 x s32>) = G_IMPLICIT_DEF
    %1:_(<2 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %2, shufflemask(0, 0)
    $d0 = COPY %1(<2 x s32>)
    RET_ReallyLR implicit $d0

...

# CHECK-LABEL: name: test_shuffle_1_1
# CHECK: G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(1, 1)
---
name: test_shuffle_1_1
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $d0

    %0:_(<2 x s32>) = COPY $d0
    %2:_(<2 x s32>) = G_IMPLICIT_DEF
    %1:_(<2 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %2, shufflemask(1, 1)
    $d0 = COPY %1(<2 x s32>)
    RET_ReallyLR implicit $d0

...

# CHECK-LABEL: name: test_shuffle_undef_undef
# CHECK: G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(undef, undef)

---
name:            test_shuffle_undef_undef
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $d0

    %0:_(<2 x s32>) = COPY $d0
    %2:_(<2 x s32>) = G_IMPLICIT_DEF
    %1:_(<2 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %2, shufflemask(undef, undef)
    $d0 = COPY %1(<2 x s32>)
    RET_ReallyLR implicit $d0

...

# CHECK-LABEL: name: test_shuffle_undef_0
# CHECK: G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(undef, 0)

---
name:            test_shuffle_undef_0
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $d0

    %0:_(<2 x s32>) = COPY $d0
    %2:_(<2 x s32>) = G_IMPLICIT_DEF
    %1:_(<2 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %2, shufflemask(undef, 0)
    $d0 = COPY %1(<2 x s32>)
    RET_ReallyLR implicit $d0

...

# CHECK-LABEL: name: test_shuffle_0_undef
# CHECK: G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(0, undef)

---
name:            test_shuffle_0_undef
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $d0

    %0:_(<2 x s32>) = COPY $d0
    %2:_(<2 x s32>) = G_IMPLICIT_DEF
    %1:_(<2 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %2, shufflemask(0, undef)
    $d0 = COPY %1(<2 x s32>)
    RET_ReallyLR implicit $d0

...

# CHECK-LABEL: name: test_shuffle_0
# CHECK: G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(0)
---
name: test_shuffle_0
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $d0

    %0:_(<2 x s32>) = COPY $d0
    %2:_(<2 x s32>) = G_IMPLICIT_DEF
    %1:_(s32) = G_SHUFFLE_VECTOR %0(<2 x s32>), %2, shufflemask(0)
    $w0 = COPY %1
    RET_ReallyLR implicit $w0

...

# CHECK-LABEL: name: test_shuffle_1
# CHECK: G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(1)
---
name: test_shuffle_1
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $d0

    %0:_(<2 x s32>) = COPY $d0
    %2:_(<2 x s32>) = G_IMPLICIT_DEF
    %1:_(s32) = G_SHUFFLE_VECTOR %0(<2 x s32>), %2, shufflemask(1)
    $w0 = COPY %1
    RET_ReallyLR implicit $w0

...

# CHECK-LABEL: name: test_shuffle_undef
# CHECK: G_SHUFFLE_VECTOR %0(<2 x s32>), %1, shufflemask(undef)
---
name: test_shuffle_undef
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $d0

    %0:_(<2 x s32>) = COPY $d0
    %2:_(<2 x s32>) = G_IMPLICIT_DEF
    %1:_(s32) = G_SHUFFLE_VECTOR %0(<2 x s32>), %2, shufflemask(undef)
    $w0 = COPY %1
    RET_ReallyLR implicit $w0

...
