# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
-# RUN: llc -march=amdgcn -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s -check-prefixes=GCN
+# RUN: llc -march=amdgcn -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefixes=GCN %s
+# RUN: llc -march=amdgcn -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=2 -pass-remarks-missed='gisel*' -o /dev/null %s 2>&1 | FileCheck -check-prefixes=ERR %s
+# G_IMPLICIT_DEF should probably never be produced for scc. Make sure there's no crash.
+# ERR: remark: <unknown>:0:0: cannot select: %0:scc(s1) = G_IMPLICIT_DEF (in function: implicit_def_s1_scc)
+# ERR-NOT: remark
+
+---
+
+name: implicit_def_s32_sgpr
+legalized: true
+regBankSelected: true
+
+body: |
+ bb.0:
+ ; GCN-LABEL: name: implicit_def_s32_sgpr
+ ; GCN: [[DEF:%[0-9]+]]:sreg_32_xm0 = IMPLICIT_DEF
+ ; GCN: S_ENDPGM 0, implicit [[DEF]]
+ %0:sgpr(s32) = G_IMPLICIT_DEF
+ S_ENDPGM 0, implicit %0
+...
---
-name: implicit_def_s32
+name: implicit_def_s32_vgpr
legalized: true
regBankSelected: true
body: |
bb.0:
- liveins: $vgpr3_vgpr4
- ; GCN-LABEL: name: implicit_def_s32
- ; GCN: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4
+ ; GCN-LABEL: name: implicit_def_s32_vgpr
; GCN: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
- ; GCN: FLAT_STORE_DWORD [[COPY]], [[DEF]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr
- %0:vgpr(p1) = COPY $vgpr3_vgpr4
- %1:vgpr(s32) = G_IMPLICIT_DEF
- G_STORE %1, %0 :: (store 4, addrspace 1)
+ ; GCN: S_ENDPGM 0, implicit [[DEF]]
+ %0:vgpr(s32) = G_IMPLICIT_DEF
+ S_ENDPGM 0, implicit %0
...
+
---
-name: implicit_def_s64
+name: implicit_def_s64_sgpr
legalized: true
regBankSelected: true
body: |
bb.0:
- liveins: $vgpr3_vgpr4
- ; GCN-LABEL: name: implicit_def_s64
- ; GCN: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr3_vgpr4
- ; GCN: [[DEF:%[0-9]+]]:vreg_64 = IMPLICIT_DEF
- ; GCN: FLAT_STORE_DWORDX2 [[COPY]], [[DEF]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr
- %0:vgpr(p1) = COPY $vgpr3_vgpr4
- %1:vgpr(s64) = G_IMPLICIT_DEF
- G_STORE %1, %0 :: (store 8, addrspace 1)
+ ; GCN-LABEL: name: implicit_def_s64_sgpr
+ ; GCN: [[DEF:%[0-9]+]]:sreg_64_xexec = IMPLICIT_DEF
+ ; GCN: S_ENDPGM 0, implicit [[DEF]]
+ %0:sgpr(s64) = G_IMPLICIT_DEF
+ S_ENDPGM 0, implicit %0
+...
+
---
+name: implicit_def_s64_vgpr
+legalized: true
+regBankSelected: true
+
+body: |
+ bb.0:
+ ; GCN-LABEL: name: implicit_def_s64_vgpr
+ ; GCN: [[DEF:%[0-9]+]]:vreg_64 = IMPLICIT_DEF
+ ; GCN: S_ENDPGM 0, implicit [[DEF]]
+ %0:vgpr(s64) = G_IMPLICIT_DEF
+ S_ENDPGM 0, implicit %0
+...
+
---
+name: implicit_def_p0_sgpr
+legalized: true
+regBankSelected: true
-name: implicit_def_p0
+body: |
+ bb.0:
+ ; GCN-LABEL: name: implicit_def_p0_sgpr
+ ; GCN: [[DEF:%[0-9]+]]:sreg_64_xexec = IMPLICIT_DEF
+ ; GCN: S_ENDPGM 0, implicit [[DEF]]
+ %0:sgpr(p0) = G_IMPLICIT_DEF
+ S_ENDPGM 0, implicit %0
+...
+
+---
+name: implicit_def_p0_vgpr
legalized: true
regBankSelected: true
body: |
bb.0:
+ ; GCN-LABEL: name: implicit_def_p0_vgpr
+ ; GCN: [[DEF:%[0-9]+]]:vreg_64 = IMPLICIT_DEF
+ ; GCN: S_ENDPGM 0, implicit [[DEF]]
%0:vgpr(p0) = G_IMPLICIT_DEF
- %1:vgpr(s32) = G_CONSTANT i32 4
- G_STORE %1, %0 :: (store 4)
+ S_ENDPGM 0, implicit %0
...
---
-name: implicit_def_p1
+name: implicit_def_p1_vgpr
legalized: true
regBankSelected: true
body: |
bb.0:
- ; GCN-LABEL: name: implicit_def_p1
+ ; GCN-LABEL: name: implicit_def_p1_vgpr
; GCN: [[DEF:%[0-9]+]]:vreg_64 = IMPLICIT_DEF
; GCN: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 4, implicit $exec
; GCN: FLAT_STORE_DWORD [[DEF]], [[V_MOV_B32_e32_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr
%1:vgpr(s32) = G_CONSTANT i32 4
G_STORE %1, %0 :: (store 4, addrspace 1)
...
+
---
-name: implicit_def_p3
+name: implicit_def_p3_vgpr
legalized: true
regBankSelected: true
body: |
bb.0:
- ; GCN-LABEL: name: implicit_def_p3
+ ; GCN-LABEL: name: implicit_def_p3_vgpr
; GCN: [[DEF:%[0-9]+]]:vreg_64 = IMPLICIT_DEF
; GCN: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 4, implicit $exec
; GCN: FLAT_STORE_DWORD [[DEF]], [[V_MOV_B32_e32_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr
%1:vgpr(s32) = G_CONSTANT i32 4
G_STORE %1, %0 :: (store 4, addrspace 1)
...
+
---
-name: implicit_def_p4
+name: implicit_def_p4_vgpr
legalized: true
regBankSelected: true
body: |
bb.0:
- ; GCN-LABEL: name: implicit_def_p4
+ ; GCN-LABEL: name: implicit_def_p4_vgpr
; GCN: [[DEF:%[0-9]+]]:vreg_64 = IMPLICIT_DEF
; GCN: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 4, implicit $exec
; GCN: FLAT_STORE_DWORD [[DEF]], [[V_MOV_B32_e32_]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr
%1:vgpr(s32) = G_CONSTANT i32 4
G_STORE %1, %0 :: (store 4, addrspace 1)
...
+
+---
+
+name: implicit_def_s1_vgpr
+legalized: true
+regBankSelected: true
+
+body: |
+ bb.0:
+ ; GCN-LABEL: name: implicit_def_s1_vgpr
+ ; GCN: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
+ ; GCN: S_ENDPGM 0, implicit [[DEF]]
+ %0:vgpr(s1) = G_IMPLICIT_DEF
+ S_ENDPGM 0, implicit %0
+...
+
+---
+
+name: implicit_def_s1_sgpr
+legalized: true
+regBankSelected: true
+
+body: |
+ bb.0:
+ ; GCN-LABEL: name: implicit_def_s1_sgpr
+ ; GCN: [[DEF:%[0-9]+]]:sreg_32_xm0 = IMPLICIT_DEF
+ ; GCN: S_ENDPGM 0, implicit [[DEF]]
+ %0:sgpr(s1) = G_IMPLICIT_DEF
+ S_ENDPGM 0, implicit %0
+...
+
+---
+
+name: implicit_def_s1_scc
+legalized: true
+regBankSelected: true
+
+body: |
+ bb.0:
+ ; GCN-LABEL: name: implicit_def_s1_scc
+ ; GCN: [[DEF:%[0-9]+]]:scc(s1) = G_IMPLICIT_DEF
+ ; GCN: S_ENDPGM 0, implicit [[DEF]](s1)
+ %0:scc(s1) = G_IMPLICIT_DEF
+ S_ENDPGM 0, implicit %0
+...
+
+---
+
+name: implicit_def_s1_vcc
+legalized: true
+regBankSelected: true
+
+body: |
+ bb.0:
+ ; GCN-LABEL: name: implicit_def_s1_vcc
+ ; GCN: [[DEF:%[0-9]+]]:sreg_64_xexec = IMPLICIT_DEF
+ ; GCN: S_ENDPGM 0, implicit [[DEF]]
+ %0:vcc(s1) = G_IMPLICIT_DEF
+ S_ENDPGM 0, implicit %0
+...