1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs -run-pass si-fold-operands,dead-mi-elimination %s -o - | FileCheck -check-prefix=GCN %s
6 # Uses a carry out in an instruction that can't be shrunk.
8 name: shrink_scalar_imm_vgpr_v_add_i32_e64_other_carry_out_use
9 tracksRegLiveness: true
13 ; GCN-LABEL: name: shrink_scalar_imm_vgpr_v_add_i32_e64_other_carry_out_use
14 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32_xm0 = S_MOV_B32 12345
15 ; GCN: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
16 ; GCN: [[V_ADD_I32_e32_:%[0-9]+]]:vgpr_32 = V_ADD_I32_e32 [[S_MOV_B32_]], [[DEF]], implicit-def $vcc, implicit $exec
17 ; GCN: [[COPY:%[0-9]+]]:sreg_64_xexec = COPY killed $vcc
18 ; GCN: S_ENDPGM 0, implicit [[COPY]]
19 %0:sreg_32_xm0 = S_MOV_B32 12345
20 %1:vgpr_32 = IMPLICIT_DEF
21 %2:vgpr_32 = IMPLICIT_DEF
22 %3:vgpr_32 = IMPLICIT_DEF
24 %4:vgpr_32, %5:sreg_64_xexec = V_ADD_I32_e64 %0, %1, 0, implicit $exec
25 S_ENDPGM 0, implicit %5
30 name: shrink_scalar_imm_multi_use_with_used_carry
31 tracksRegLiveness: true
35 ; GCN-LABEL: name: shrink_scalar_imm_multi_use_with_used_carry
36 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32_xm0 = S_MOV_B32 12345
37 ; GCN: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
38 ; GCN: [[DEF1:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
39 ; GCN: [[V_ADD_I32_e64_:%[0-9]+]]:vgpr_32, [[V_ADD_I32_e64_1:%[0-9]+]]:sreg_64_xexec = V_ADD_I32_e64 [[S_MOV_B32_]], [[DEF]], 0, implicit $exec
40 ; GCN: [[V_ADD_I32_e64_2:%[0-9]+]]:vgpr_32, [[V_ADD_I32_e64_3:%[0-9]+]]:sreg_64_xexec = V_ADD_I32_e64 [[S_MOV_B32_]], [[DEF1]], 0, implicit $exec
41 ; GCN: S_ENDPGM 0, implicit [[V_ADD_I32_e64_1]], implicit [[V_ADD_I32_e64_2]]
42 %0:sreg_32_xm0 = S_MOV_B32 12345
43 %1:vgpr_32 = IMPLICIT_DEF
44 %2:vgpr_32 = IMPLICIT_DEF
45 %3:vgpr_32 = IMPLICIT_DEF
46 %4:vgpr_32 = IMPLICIT_DEF
48 %5:vgpr_32, %6:sreg_64_xexec = V_ADD_I32_e64 %0, %1, 0, implicit $exec
49 %7:vgpr_32, %8:sreg_64_xexec = V_ADD_I32_e64 %0, %2, 0, implicit $exec
50 S_ENDPGM 0, implicit %6, implicit %7
55 # TODO: Is it OK to leave the broken use around on the DBG_VALUE?
57 name: shrink_scalar_imm_vgpr_v_add_i32_e64_dbg_only_carry_out_use
58 tracksRegLiveness: true
62 ; GCN-LABEL: name: shrink_scalar_imm_vgpr_v_add_i32_e64_dbg_only_carry_out_use
63 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32_xm0 = S_MOV_B32 12345
64 ; GCN: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
65 ; GCN: [[V_ADD_I32_e32_:%[0-9]+]]:vgpr_32 = V_ADD_I32_e32 [[S_MOV_B32_]], [[DEF]], implicit-def $vcc, implicit $exec
66 ; GCN: DBG_VALUE %5:sreg_64_xexec, $noreg
67 ; GCN: S_ENDPGM 0, implicit [[V_ADD_I32_e32_]]
68 %0:sreg_32_xm0 = S_MOV_B32 12345
69 %1:vgpr_32 = IMPLICIT_DEF
70 %2:vgpr_32 = IMPLICIT_DEF
71 %3:vgpr_32 = IMPLICIT_DEF
73 %4:vgpr_32, %5:sreg_64_xexec = V_ADD_I32_e64 %0, %1, 0, implicit $exec
75 S_ENDPGM 0, implicit %4
81 # Uses carry out in a normal pattern
83 name: shrink_scalar_imm_vgpr_v_add_i32_e64_carry_out_use
84 tracksRegLiveness: true
88 ; GCN-LABEL: name: shrink_scalar_imm_vgpr_v_add_i32_e64_carry_out_use
89 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32_xm0 = S_MOV_B32 12345
90 ; GCN: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
91 ; GCN: [[DEF1:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
92 ; GCN: [[DEF2:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
93 ; GCN: [[V_ADD_I32_e32_:%[0-9]+]]:vgpr_32 = V_ADD_I32_e32 [[S_MOV_B32_]], [[DEF]], implicit-def $vcc, implicit $exec
94 ; GCN: [[COPY:%[0-9]+]]:sreg_64_xexec = COPY killed $vcc
95 ; GCN: [[V_ADDC_U32_e64_:%[0-9]+]]:vgpr_32, [[V_ADDC_U32_e64_1:%[0-9]+]]:sreg_64_xexec = V_ADDC_U32_e64 [[DEF1]], [[DEF2]], [[COPY]], 0, implicit $exec
96 ; GCN: S_ENDPGM 0, implicit [[V_ADDC_U32_e64_]]
97 %0:sreg_32_xm0 = S_MOV_B32 12345
98 %1:vgpr_32 = IMPLICIT_DEF
99 %2:vgpr_32 = IMPLICIT_DEF
100 %3:vgpr_32 = IMPLICIT_DEF
102 %4:vgpr_32, %5:sreg_64_xexec = V_ADD_I32_e64 %0, %1, 0, implicit $exec
103 %6:vgpr_32, %7:sreg_64_xexec = V_ADDC_U32_e64 %2, %3, %5, 0, implicit $exec
104 S_ENDPGM 0, implicit %6