inst-select-trunc.mir 10.7 KB
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=amdgcn -run-pass=instruction-select -verify-machineinstrs  %s -o - | FileCheck %s -check-prefixes=GCN

---

name: trunc_sgpr_s32_to_s1
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0
    ; GCN-LABEL: name: trunc_sgpr_s32_to_s1
    ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
    ; GCN: S_ENDPGM 0, implicit [[COPY]]
    %0:sgpr(s32) = COPY $sgpr0
    %1:sgpr(s1) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_sgpr_s32_to_s16
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0
    ; GCN-LABEL: name: trunc_sgpr_s32_to_s16
    ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
    ; GCN: S_ENDPGM 0, implicit [[COPY]]
    %0:sgpr(s32) = COPY $sgpr0
    %1:sgpr(s16) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_sgpr_s64_to_s32
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0_sgpr1
    ; GCN-LABEL: name: trunc_sgpr_s64_to_s32
    ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
    ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:sgpr(s64) = COPY $sgpr0_sgpr1
    %1:sgpr(s32) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_sgpr_s64_to_s16
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0_sgpr1
    ; GCN-LABEL: name: trunc_sgpr_s64_to_s16
    ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
    ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:sgpr(s64) = COPY $sgpr0_sgpr1
    %1:sgpr(s16) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_sgpr_s64_to_s1
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0_sgpr1
    ; GCN-LABEL: name: trunc_sgpr_s64_to_s1
    ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
    ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:sgpr(s64) = COPY $sgpr0_sgpr1
    %1:sgpr(s1) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_sgpr_s96_to_s16
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0_sgpr1_sgpr2
    ; GCN-LABEL: name: trunc_sgpr_s96_to_s16
    ; GCN: [[COPY:%[0-9]+]]:sgpr_96 = COPY $sgpr0_sgpr1_sgpr2
    ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:sgpr(s96) = COPY $sgpr0_sgpr1_sgpr2
    %1:sgpr(s16) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_sgpr_s96_to_s64
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0_sgpr1_sgpr2
    ; GCN-LABEL: name: trunc_sgpr_s96_to_s64
    ; GCN: [[COPY:%[0-9]+]]:sgpr_96_with_sub0_sub1 = COPY $sgpr0_sgpr1_sgpr2
    ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY [[COPY]].sub0_sub1
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:sgpr(s96) = COPY $sgpr0_sgpr1_sgpr2
    %1:sgpr(s64) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_sgpr_s128_to_s16
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0_sgpr1_sgpr2_sgpr3
    ; GCN-LABEL: name: trunc_sgpr_s128_to_s16
    ; GCN: [[COPY:%[0-9]+]]:sgpr_128 = COPY $sgpr0_sgpr1_sgpr2_sgpr3
    ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:sgpr(s128) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
    %1:sgpr(s16) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_sgpr_s128_to_s96
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0_sgpr1_sgpr2_sgpr3
    ; GCN-LABEL: name: trunc_sgpr_s128_to_s96
    ; GCN: [[COPY:%[0-9]+]]:sgpr_128_with_sub0_sub1_sub2 = COPY $sgpr0_sgpr1_sgpr2_sgpr3
    ; GCN: [[COPY1:%[0-9]+]]:sgpr_96 = COPY [[COPY]].sub0_sub1_sub2
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:sgpr(s128) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
    %1:sgpr(s96) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_sgpr_s256_to_s128
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7
    ; GCN-LABEL: name: trunc_sgpr_s256_to_s128
    ; GCN: [[COPY:%[0-9]+]]:sgpr_256 = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7
    ; GCN: [[COPY1:%[0-9]+]]:sgpr_128 = COPY [[COPY]].sub0_sub1_sub2_sub3
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:sgpr(s256) = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7
    %1:sgpr(s128) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_sgpr_s512_to_s256
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
    ; GCN-LABEL: name: trunc_sgpr_s512_to_s256
    ; GCN: [[COPY:%[0-9]+]]:sgpr_512 = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
    ; GCN: [[COPY1:%[0-9]+]]:sgpr_256 = COPY [[COPY]].sub0_sub1_sub2_sub3_sub4_sub5_sub6_sub7
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:sgpr(s512) = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
    %1:sgpr(s256) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s32_to_s1
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0
    ; GCN-LABEL: name: trunc_vgpr_s32_to_s1
    ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GCN: S_ENDPGM 0, implicit [[COPY]]
    %0:vgpr(s32) = COPY $vgpr0
    %1:vgpr(s1) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s32_to_s16
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0
    ; GCN-LABEL: name: trunc_vgpr_s32_to_s16
    ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GCN: S_ENDPGM 0, implicit [[COPY]]
    %0:vgpr(s32) = COPY $vgpr0
    %1:vgpr(s16) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s64_to_s32
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0_vgpr1
    ; GCN-LABEL: name: trunc_vgpr_s64_to_s32
    ; GCN: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
    ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:vgpr(s64) = COPY $vgpr0_vgpr1
    %1:vgpr(s32) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s64_to_s16
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0_vgpr1
    ; GCN-LABEL: name: trunc_vgpr_s64_to_s16
    ; GCN: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
    ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:vgpr(s64) = COPY $vgpr0_vgpr1
    %1:vgpr(s16) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s64_to_s1
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0_vgpr1
    ; GCN-LABEL: name: trunc_vgpr_s64_to_s1
    ; GCN: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
    ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:vgpr(s64) = COPY $vgpr0_vgpr1
    %1:vgpr(s1) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s96_to_s16
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2
    ; GCN-LABEL: name: trunc_vgpr_s96_to_s16
    ; GCN: [[COPY:%[0-9]+]]:vreg_96 = COPY $vgpr0_vgpr1_vgpr2
    ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:vgpr(s96) = COPY $vgpr0_vgpr1_vgpr2
    %1:vgpr(s16) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s96_to_s64
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2
    ; GCN-LABEL: name: trunc_vgpr_s96_to_s64
    ; GCN: [[COPY:%[0-9]+]]:vreg_96 = COPY $vgpr0_vgpr1_vgpr2
    ; GCN: [[COPY1:%[0-9]+]]:vreg_64 = COPY [[COPY]].sub0_sub1
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:vgpr(s96) = COPY $vgpr0_vgpr1_vgpr2
    %1:vgpr(s64) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s128_to_s16
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2_vgpr3
    ; GCN-LABEL: name: trunc_vgpr_s128_to_s16
    ; GCN: [[COPY:%[0-9]+]]:vreg_128 = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:vgpr(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    %1:vgpr(s16) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s128_to_s96
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2_vgpr3
    ; GCN-LABEL: name: trunc_vgpr_s128_to_s96
    ; GCN: [[COPY:%[0-9]+]]:vreg_128 = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    ; GCN: [[COPY1:%[0-9]+]]:vreg_96 = COPY [[COPY]].sub0_sub1_sub2
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:vgpr(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
    %1:vgpr(s96) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s256_to_s128
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
    ; GCN-LABEL: name: trunc_vgpr_s256_to_s128
    ; GCN: [[COPY:%[0-9]+]]:vreg_256 = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
    ; GCN: [[COPY1:%[0-9]+]]:vreg_128 = COPY [[COPY]].sub0_sub1_sub2_sub3
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:vgpr(s256) = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
    %1:vgpr(s128) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...
---

name: trunc_vgpr_s512_to_s256
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
    ; GCN-LABEL: name: trunc_vgpr_s512_to_s256
    ; GCN: [[COPY:%[0-9]+]]:vreg_512 = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
    ; GCN: [[COPY1:%[0-9]+]]:vreg_256 = COPY [[COPY]].sub0_sub1_sub2_sub3_sub4_sub5_sub6_sub7
    ; GCN: S_ENDPGM 0, implicit [[COPY1]]
    %0:vgpr(s512) = COPY $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
    %1:vgpr(s256) = G_TRUNC %0
    S_ENDPGM 0, implicit %1
...

---

name: trunc_sgpr_s32_to_s1_use
legalized:       true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0, $sgpr1
    ; GCN-LABEL: name: trunc_sgpr_s32_to_s1_use
    ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
    ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
    ; GCN: $scc = COPY [[COPY]]
    ; GCN: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY]], [[COPY1]], implicit $scc
    ; GCN: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
    %0:sgpr(s32) = COPY $sgpr0
    %1:sgpr(s32) = COPY $sgpr1
    %2:sgpr(s1) = G_TRUNC %0
    %3:sgpr(s32) = G_SELECT %2, %0, %1
    S_ENDPGM 0, implicit %3
...