287 lines · plain
1# RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass si-fold-operands %s -o - | FileCheck -check-prefix=GCN %s2 3# GCN-LABEL: name: test_part_fold{{$}}4# GCN: %2:sreg_32 = S_ADD_I32 70, %15---6name: test_part_fold7tracksRegLiveness: true8body: |9 bb.0:10 %0:sreg_32 = S_MOV_B32 7011 %1:sreg_32 = S_MOV_B32 8012 %2:sreg_32 = S_ADD_I32 %0, %1, implicit-def $scc13...14 15# GCN-LABEL: name: test_inline_const{{$}}16# GCN: %2:sreg_32 = S_ADD_I32 70, 6317---18name: test_inline_const19tracksRegLiveness: true20body: |21 bb.0:22 %0:sreg_32 = S_MOV_B32 7023 %1:sreg_32 = S_MOV_B32 6324 %2:sreg_32 = S_ADD_I32 %0, %1, implicit-def $scc25...26# GCN-LABEL: name: test_obscure{{$}}27# GCN: %2:sreg_32 = S_LSHL2_ADD_U32 70, %128---29name: test_obscure30tracksRegLiveness: true31body: |32 bb.0:33 %0:sreg_32 = S_MOV_B32 7034 %1:sreg_32 = S_MOV_B32 8035 %2:sreg_32 = S_LSHL2_ADD_U32 %0, %1, implicit-def $scc36...37# GCN-LABEL: name: test_obscure_inline{{$}}38# GCN: %2:sreg_32 = S_LSHL2_ADD_U32 70, 6339---40name: test_obscure_inline41tracksRegLiveness: true42body: |43 bb.0:44 %0:sreg_32 = S_MOV_B32 7045 %1:sreg_32 = S_MOV_B32 6346 %2:sreg_32 = S_LSHL2_ADD_U32 %0, %1, implicit-def $scc47...48# GCN-LABEL: name: test_frameindex{{$}}49# GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 7050# GCN-NEXT: %1:sreg_32 = S_ADD_I32 %stack.0, [[S_MOV_B32_]]51---52name: test_frameindex53tracksRegLiveness: true54stack:55 - { id: 0, type: default, offset: 0, size: 64, alignment: 16}56body: |57 bb.0:58 %0:sreg_32 = S_MOV_B32 7059 %1:sreg_32 = S_ADD_I32 %stack.0, %0, implicit-def $scc60...61# GCN-LABEL: name: test_frameindex_inline{{$}}62# GCN: %1:sreg_32 = S_ADD_I32 %stack.0, 6363---64name: test_frameindex_inline65tracksRegLiveness: true66stack:67 - { id: 0, type: default, offset: 0, size: 64, alignment: 16}68body: |69 bb.0:70 %0:sreg_32 = S_MOV_B32 6371 %1:sreg_32 = S_ADD_I32 %stack.0, %0, implicit-def $scc72...73 74# GCN-LABEL: name: test_no_fold_literal_already_inline_lhs{{$}}75# GCN: %0:sreg_32 = S_MOV_B32 8076# GCN-NEXT: %1:sreg_32 = S_ADD_I32 70, %077---78name: test_no_fold_literal_already_inline_lhs79tracksRegLiveness: true80body: |81 bb.0:82 %0:sreg_32 = S_MOV_B32 8083 %1:sreg_32 = S_ADD_I32 70, %0, implicit-def $scc84...85 86# GCN-LABEL: name: test_no_fold_literal_already_inline_rhs{{$}}87# GCN: %0:sreg_32 = S_MOV_B32 8088# GCN-NEXT: %1:sreg_32 = S_ADD_I32 %0, 7089---90name: test_no_fold_literal_already_inline_rhs91tracksRegLiveness: true92body: |93 bb.0:94 %0:sreg_32 = S_MOV_B32 8095 %1:sreg_32 = S_ADD_I32 %0, 70, implicit-def $scc96...97 98# GCN-LABEL: name: test_fold_literal_inlineimm_lhs{{$}}99# GCN: %1:sreg_32 = S_ADD_I32 64, 80100---101name: test_fold_literal_inlineimm_lhs102tracksRegLiveness: true103body: |104 bb.0:105 %0:sreg_32 = S_MOV_B32 80106 %1:sreg_32 = S_ADD_I32 64, %0, implicit-def $scc107...108 109# GCN-LABEL: name: test_fold_literal_inlineimm_rhs{{$}}110# GCN: %1:sreg_32 = S_ADD_I32 80, 64111---112name: test_fold_literal_inlineimm_rhs113tracksRegLiveness: true114body: |115 bb.0:116 %0:sreg_32 = S_MOV_B32 80117 %1:sreg_32 = S_ADD_I32 %0, 64, implicit-def $scc118...119 120# GCN-LABEL: name: test_fold_same_literal_2x{{$}}121# GCN: %2:sreg_32 = S_ADD_I32 70, 70122---123name: test_fold_same_literal_2x124tracksRegLiveness: true125body: |126 bb.0:127 %0:sreg_32 = S_MOV_B32 70128 %1:sreg_32 = S_MOV_B32 70129 %2:sreg_32 = S_ADD_I32 %0, %1, implicit-def $scc130...131 132# GCN-LABEL: name: test_fold_same_literal_lhs{{$}}133# GCN: %1:sreg_32 = S_ADD_I32 70, 70134---135name: test_fold_same_literal_lhs136tracksRegLiveness: true137body: |138 bb.0:139 %0:sreg_32 = S_MOV_B32 70140 %1:sreg_32 = S_ADD_I32 70, %0, implicit-def $scc141...142 143# GCN-LABEL: name: test_fold_same_literal_rhs{{$}}144# GCN: %1:sreg_32 = S_ADD_I32 70, 70145---146name: test_fold_same_literal_rhs147tracksRegLiveness: true148body: |149 bb.0:150 %0:sreg_32 = S_MOV_B32 70151 %1:sreg_32 = S_ADD_I32 %0, 70, implicit-def $scc152...153 154 155# GCN-LABEL: name: test_s_cselect_b32_2x_literal_fold{{$}}156# GCN: %2:sreg_32 = S_CSELECT_B32 70, %1, implicit $scc157---158name: test_s_cselect_b32_2x_literal_fold159tracksRegLiveness: true160body: |161 bb.0:162 %0:sreg_32 = S_MOV_B32 70163 %1:sreg_32 = S_MOV_B32 80164 $scc = IMPLICIT_DEF165 %2:sreg_32 = S_CSELECT_B32 %0, %1, implicit $scc166...167 168# GCN-LABEL: name: test_s_cselect_b32_fold_literal_literal_lhs{{$}}169# GCN: %1:sreg_32 = S_CSELECT_B32 70, %0, implicit $scc170---171name: test_s_cselect_b32_fold_literal_literal_lhs172tracksRegLiveness: true173body: |174 bb.0:175 %0:sreg_32 = S_MOV_B32 80176 $scc = IMPLICIT_DEF177 %1:sreg_32 = S_CSELECT_B32 70, %0, implicit $scc178...179 180# GCN-LABEL: name: test_s_cselect_b32_fold_literal_literal_rhs{{$}}181# GCN: %1:sreg_32 = S_CSELECT_B32 %0, 70, implicit $scc182---183name: test_s_cselect_b32_fold_literal_literal_rhs184tracksRegLiveness: true185body: |186 bb.0:187 %0:sreg_32 = S_MOV_B32 80188 $scc = IMPLICIT_DEF189 %1:sreg_32 = S_CSELECT_B32 %0, 70, implicit $scc190...191 192# GCN-LABEL: name: test_s_cselect_b32_fold_literal_inlineimm_lhs{{$}}193# GCN: %1:sreg_32 = S_CSELECT_B32 64, 80, implicit $scc194---195name: test_s_cselect_b32_fold_literal_inlineimm_lhs196tracksRegLiveness: true197body: |198 bb.0:199 %0:sreg_32 = S_MOV_B32 80200 $scc = IMPLICIT_DEF201 %1:sreg_32 = S_CSELECT_B32 64, %0, implicit $scc202...203 204# GCN-LABEL: name: test_s_cselect_b32_fold_literal_inlineimm_rhs{{$}}205# GCN: %1:sreg_32 = S_CSELECT_B32 80, 64, implicit $scc206---207name: test_s_cselect_b32_fold_literal_inlineimm_rhs208tracksRegLiveness: true209body: |210 bb.0:211 %0:sreg_32 = S_MOV_B32 80212 $scc = IMPLICIT_DEF213 %1:sreg_32 = S_CSELECT_B32 %0, 64, implicit $scc214...215 216# GCN-LABEL: name: test_s_cmp_b32_2x_literal_fold{{$}}217# GCN: S_CMP_EQ_U32 70, %1, implicit-def $scc218---219name: test_s_cmp_b32_2x_literal_fold220tracksRegLiveness: true221body: |222 bb.0:223 %0:sreg_32 = S_MOV_B32 70224 %1:sreg_32 = S_MOV_B32 80225 $scc = IMPLICIT_DEF226 S_CMP_EQ_U32 %0, %1, implicit-def $scc227...228 229# GCN-LABEL: name: test_s_cmp_b32_literal_literal_lhs{{$}}230# GCN: S_CMP_EQ_U32 70, %0, implicit-def $scc231---232name: test_s_cmp_b32_literal_literal_lhs233tracksRegLiveness: true234body: |235 bb.0:236 %0:sreg_32 = S_MOV_B32 80237 S_CMP_EQ_U32 70, %0, implicit-def $scc238...239 240# GCN-LABEL: name: test_s_cmp_b32_literal_literal_rhs{{$}}241# GCN: S_CMP_EQ_U32 %0, 70, implicit-def $scc242---243name: test_s_cmp_b32_literal_literal_rhs244tracksRegLiveness: true245body: |246 bb.0:247 %0:sreg_32 = S_MOV_B32 80248 S_CMP_EQ_U32 %0, 70, implicit-def $scc249...250 251# GCN-LABEL: name: test_s_cmp_b32_literal_inlineimm_lhs{{$}}252# GCN: S_CMP_EQ_U32 64, 80, implicit-def $scc253---254name: test_s_cmp_b32_literal_inlineimm_lhs255tracksRegLiveness: true256body: |257 bb.0:258 %0:sreg_32 = S_MOV_B32 80259 S_CMP_EQ_U32 64, %0, implicit-def $scc260...261 262# GCN-LABEL: name: test_s_cmp_b32_literal_inlineimm_rhs{{$}}263# GCN: S_CMP_EQ_U32 80, 64, implicit-def $scc264---265name: test_s_cmp_b32_literal_inlineimm_rhs266tracksRegLiveness: true267body: |268 bb.0:269 %0:sreg_32 = S_MOV_B32 80270 S_CMP_EQ_U32 %0, 64, implicit-def $scc271...272 273# Ignore regmask operands274# GCN-LABEL: name: test_si_cs_chain_fold_with_regmask{{$}}275# GCN: SI_CS_CHAIN_TC_W32 %0, 0, 0, 1234, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8276---277name: test_si_cs_chain_fold_with_regmask278tracksRegLiveness: true279body: |280 bb.0:281 liveins: $sgpr0, $sgpr2_sgpr3, $vgpr8282 283 %1:ccr_sgpr_64 = COPY $sgpr2_sgpr3284 %2:sreg_32 = S_MOV_B32 1234285 SI_CS_CHAIN_TC_W32 %1:ccr_sgpr_64, 0, 0, %2:sreg_32, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8286...287