660 lines · plain
1; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -mattr=-promote-alloca < %s | FileCheck -allow-deprecated-dag-overlap -check-prefixes=GCN,GFX9,GFX9-MUBUF %s2; RxN: llc -mtriple=amdgcn -mcpu=gfx906 -mattr=-promote-alloca,+sram-ecc < %s | FileCheck -allow-deprecated-dag-overlap -check-prefixes=GCN,GFX9 %s3; RUN: llc -mtriple=amdgcn -mcpu=fiji -mattr=-promote-alloca < %s | FileCheck -allow-deprecated-dag-overlap -check-prefixes=GCN,GFX803,NO-D16-HI %s4; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -mattr=-promote-alloca -mattr=+enable-flat-scratch < %s | FileCheck -allow-deprecated-dag-overlap -check-prefixes=GCN,GFX9,GFX9-FLATSCR %s5 6; GCN-LABEL: {{^}}store_global_hi_v2i16:7; GCN: s_waitcnt8 9; GFX9-NEXT: global_store_short_d16_hi v[0:1], v2, off10 11; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v2, 16, v212; GFX803-NEXT: flat_store_short v[0:1], v213 14; GCN-NEXT: s_waitcnt15; GCN-NEXT: s_setpc_b6416define void @store_global_hi_v2i16(ptr addrspace(1) %out, i32 %arg) #0 {17entry:18 ; FIXME: ABI for pre-gfx919 %value = bitcast i32 %arg to <2 x i16>20 %hi = extractelement <2 x i16> %value, i32 121 store i16 %hi, ptr addrspace(1) %out22 ret void23}24 25; GCN-LABEL: {{^}}store_global_hi_v2f16:26; GCN: s_waitcnt27 28; GFX9-NEXT: global_store_short_d16_hi v[0:1], v2, off29 30; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v2, 16, v231; GFX803-NEXT: flat_store_short v[0:1], v232 33; GCN-NEXT: s_waitcnt34; GCN-NEXT: s_setpc_b6435define void @store_global_hi_v2f16(ptr addrspace(1) %out, i32 %arg) #0 {36entry:37 ; FIXME: ABI for pre-gfx938 %value = bitcast i32 %arg to <2 x half>39 %hi = extractelement <2 x half> %value, i32 140 store half %hi, ptr addrspace(1) %out41 ret void42}43 44; GCN-LABEL: {{^}}store_global_hi_i32_shift:45; GCN: s_waitcnt46 47; GFX9-NEXT: global_store_short_d16_hi v[0:1], v2, off48 49; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v2, 16, v250; GFX803-NEXT: flat_store_short v[0:1], v251 52; GCN-NEXT: s_waitcnt53; GCN-NEXT: s_setpc_b6454define void @store_global_hi_i32_shift(ptr addrspace(1) %out, i32 %value) #0 {55entry:56 %hi32 = lshr i32 %value, 1657 %hi = trunc i32 %hi32 to i1658 store i16 %hi, ptr addrspace(1) %out59 ret void60}61 62; GCN-LABEL: {{^}}store_global_hi_v2i16_i8:63; GCN: s_waitcnt64 65; GFX9-NEXT: global_store_byte_d16_hi v[0:1], v2, off66 67; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v2, 16, v268; GFX803-NEXT: flat_store_byte v[0:1], v269 70; GCN-NEXT: s_waitcnt71; GCN-NEXT: s_setpc_b6472define void @store_global_hi_v2i16_i8(ptr addrspace(1) %out, i32 %arg) #0 {73entry:74 %value = bitcast i32 %arg to <2 x i16>75 %hi = extractelement <2 x i16> %value, i32 176 %trunc = trunc i16 %hi to i877 store i8 %trunc, ptr addrspace(1) %out78 ret void79}80 81; GCN-LABEL: {{^}}store_global_hi_i8_shift:82; GCN: s_waitcnt83 84; GFX9-NEXT: global_store_byte_d16_hi v[0:1], v2, off85 86; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v2, 16, v287; GFX803-NEXT: flat_store_byte v[0:1], v288 89; GCN-NEXT: s_waitcnt90; GCN-NEXT: s_setpc_b6491define void @store_global_hi_i8_shift(ptr addrspace(1) %out, i32 %value) #0 {92entry:93 %hi32 = lshr i32 %value, 1694 %hi = trunc i32 %hi32 to i895 store i8 %hi, ptr addrspace(1) %out96 ret void97}98 99; GCN-LABEL: {{^}}store_global_hi_v2i16_max_offset:100; GCN: s_waitcnt101; GFX9-NEXT: global_store_short_d16_hi v[0:1], v2, off offset:4094102 103; GFX803-DAG: v_add_u32_e32104; GFX803-DAG: v_addc_u32_e32105; GFX803-DAG: v_lshrrev_b32_e32 v2, 16, v2106; GFX803: flat_store_short v[0:1], v2{{$}}107 108; GCN-NEXT: s_waitcnt109; GCN-NEXT: s_setpc_b64110define void @store_global_hi_v2i16_max_offset(ptr addrspace(1) %out, i32 %arg) #0 {111entry:112 ; FIXME: ABI for pre-gfx9113 %value = bitcast i32 %arg to <2 x i16>114 %hi = extractelement <2 x i16> %value, i32 1115 %gep = getelementptr inbounds i16, ptr addrspace(1) %out, i64 2047116 store i16 %hi, ptr addrspace(1) %gep117 ret void118}119 120; GCN-LABEL: {{^}}store_global_hi_v2i16_min_offset:121; GCN: s_waitcnt122; GFX9-NEXT: global_store_short_d16_hi v[0:1], v2, off offset:-4096{{$}}123 124; GFX803-DAG: v_add_u32_e32125; GFX803-DAG: v_addc_u32_e32126; GFX803-DAG: v_lshrrev_b32_e32 v2, 16, v2127; GFX803: flat_store_short v[0:1], v{{[0-9]$}}128 129; GCN-NEXT: s_waitcnt130; GCN-NEXT: s_setpc_b64131define void @store_global_hi_v2i16_min_offset(ptr addrspace(1) %out, i32 %arg) #0 {132entry:133 %value = bitcast i32 %arg to <2 x i16>134 %hi = extractelement <2 x i16> %value, i32 1135 %gep = getelementptr inbounds i16, ptr addrspace(1) %out, i64 -2048136 store i16 %hi, ptr addrspace(1) %gep137 ret void138}139 140; GCN-LABEL: {{^}}store_global_hi_v2i16_i8_max_offset:141; GCN: s_waitcnt142; GFX9-NEXT: global_store_byte_d16_hi v[0:1], v2, off offset:4095143 144; GFX803-DAG: v_add_u32_e32145; GFX803-DAG: v_addc_u32_e32146; GFX803-DAG: v_lshrrev_b32_e32 v2, 16, v2147; GFX803: flat_store_byte v[0:1], v{{[0-9]$}}148 149; GCN-NEXT: s_waitcnt150; GCN-NEXT: s_setpc_b64151define void @store_global_hi_v2i16_i8_max_offset(ptr addrspace(1) %out, i32 %arg) #0 {152entry:153 %value = bitcast i32 %arg to <2 x i16>154 %hi = extractelement <2 x i16> %value, i32 1155 %trunc = trunc i16 %hi to i8156 %gep = getelementptr inbounds i8, ptr addrspace(1) %out, i64 4095157 store i8 %trunc, ptr addrspace(1) %gep158 ret void159}160 161; GCN-LABEL: {{^}}store_global_hi_v2i16_i8_min_offset:162; GCN: s_waitcnt163; GFX9-NEXT: global_store_byte_d16_hi v[0:1], v2, off offset:-4095164 165; GFX803-DAG: v_add_u32_e32166; GFX803-DAG: v_addc_u32_e32167; GFX803-DAG: v_lshrrev_b32_e32 v2, 16, v2168; GFX803: flat_store_byte v[0:1], v{{[0-9]$}}169 170; GCN-NEXT: s_waitcnt171; GCN-NEXT: s_setpc_b64172define void @store_global_hi_v2i16_i8_min_offset(ptr addrspace(1) %out, i32 %arg) #0 {173entry:174 %value = bitcast i32 %arg to <2 x i16>175 %hi = extractelement <2 x i16> %value, i32 1176 %trunc = trunc i16 %hi to i8177 %gep = getelementptr inbounds i8, ptr addrspace(1) %out, i64 -4095178 store i8 %trunc, ptr addrspace(1) %gep179 ret void180}181 182; GCN-LABEL: {{^}}store_flat_hi_v2i16:183; GCN: s_waitcnt184 185; GFX9-NEXT: flat_store_short_d16_hi v[0:1], v2{{$}}186 187; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v2, 16, v2188; NO-D16-HI-NEXT: flat_store_short v[0:1], v2189 190; GCN-NEXT: s_waitcnt191; GCN-NEXT: s_setpc_b64192define void @store_flat_hi_v2i16(ptr %out, i32 %arg) #0 {193entry:194 %value = bitcast i32 %arg to <2 x i16>195 %hi = extractelement <2 x i16> %value, i32 1196 store i16 %hi, ptr %out197 ret void198}199 200; GCN-LABEL: {{^}}store_flat_hi_v2f16:201; GCN: s_waitcnt202 203; GFX9-NEXT: flat_store_short_d16_hi v[0:1], v2{{$}}204 205; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v2, 16, v2206; NO-D16-HI-NEXT: flat_store_short v[0:1], v2207 208; GCN-NEXT: s_waitcnt209; GCN-NEXT: s_setpc_b64210define void @store_flat_hi_v2f16(ptr %out, i32 %arg) #0 {211entry:212 %value = bitcast i32 %arg to <2 x half>213 %hi = extractelement <2 x half> %value, i32 1214 store half %hi, ptr %out215 ret void216}217 218; GCN-LABEL: {{^}}store_flat_hi_i32_shift:219; GCN: s_waitcnt220 221; GFX9-NEXT: flat_store_short_d16_hi v[0:1], v2{{$}}222 223; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v2, 16, v2224; NO-D16-HI-NEXT: flat_store_short v[0:1], v2225 226; GCN-NEXT: s_waitcnt227; GCN-NEXT: s_setpc_b64228define void @store_flat_hi_i32_shift(ptr %out, i32 %value) #0 {229entry:230 %hi32 = lshr i32 %value, 16231 %hi = trunc i32 %hi32 to i16232 store i16 %hi, ptr %out233 ret void234}235 236; GCN-LABEL: {{^}}store_flat_hi_v2i16_i8:237; GCN: s_waitcnt238 239; GFX9-NEXT: flat_store_byte_d16_hi v[0:1], v2{{$}}240 241; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v2, 16, v2242; NO-D16-HI-NEXT: flat_store_byte v[0:1], v2243 244; GCN-NEXT: s_waitcnt245; GCN-NEXT: s_setpc_b64246define void @store_flat_hi_v2i16_i8(ptr %out, i32 %arg) #0 {247entry:248 %value = bitcast i32 %arg to <2 x i16>249 %hi = extractelement <2 x i16> %value, i32 1250 %trunc = trunc i16 %hi to i8251 store i8 %trunc, ptr %out252 ret void253}254 255; GCN-LABEL: {{^}}store_flat_hi_i8_shift:256; GCN: s_waitcnt257 258; GFX9-NEXT: flat_store_byte_d16_hi v[0:1], v2{{$}}259 260; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v2, 16, v2261; NO-D16-HI-NEXT: flat_store_byte v[0:1], v2262 263; GCN-NEXT: s_waitcnt264; GCN-NEXT: s_setpc_b64265define void @store_flat_hi_i8_shift(ptr %out, i32 %value) #0 {266entry:267 %hi32 = lshr i32 %value, 16268 %hi = trunc i32 %hi32 to i8269 store i8 %hi, ptr %out270 ret void271}272 273; GCN-LABEL: {{^}}store_flat_hi_v2i16_max_offset:274; GCN: s_waitcnt275; GFX9-NEXT: flat_store_short_d16_hi v[0:1], v2 offset:4094{{$}}276 277; GFX803-DAG: v_add_u32_e32278; GFX803-DAG: v_addc_u32_e32279; GFX803-DAG: v_lshrrev_b32_e32 v2, 16, v2280; GFX803: flat_store_short v[0:1], v2{{$}}281 282; GCN-NEXT: s_waitcnt283; GCN-NEXT: s_setpc_b64284define void @store_flat_hi_v2i16_max_offset(ptr %out, i32 %arg) #0 {285entry:286 %value = bitcast i32 %arg to <2 x i16>287 %hi = extractelement <2 x i16> %value, i32 1288 %gep = getelementptr inbounds i16, ptr %out, i64 2047289 store i16 %hi, ptr %gep290 ret void291}292 293; GCN-LABEL: {{^}}store_flat_hi_v2i16_neg_offset:294; GCN: s_waitcnt295; GFX803: v_add{{(_co)?}}_{{i|u}}32_e32296; GFX803: v_addc_u32_e32297 298; GFX9-DAG: v_add_co_u32_e32 v{{[0-9]+}}, vcc, 0xfffff802, v299; GFX9-DAG: v_addc_co_u32_e32 v{{[0-9]+}}, vcc, -1, v300 301; GFX9-NEXT: flat_store_short_d16_hi v[0:1], v2{{$}}302; GFX803: flat_store_short v[0:1], v2{{$}}303; GCN-NEXT: s_waitcnt304; GCN-NEXT: s_setpc_b64305define void @store_flat_hi_v2i16_neg_offset(ptr %out, i32 %arg) #0 {306entry:307 %value = bitcast i32 %arg to <2 x i16>308 %hi = extractelement <2 x i16> %value, i32 1309 %gep = getelementptr inbounds i16, ptr %out, i64 -1023310 store i16 %hi, ptr %gep311 ret void312}313 314; GCN-LABEL: {{^}}store_flat_hi_v2i16_i8_max_offset:315; GCN: s_waitcnt316; GFX9-NEXT: flat_store_byte_d16_hi v[0:1], v2 offset:4095{{$}}317 318; GFX803-DAG: v_lshrrev_b32_e32 v2, 16, v2319; GFX803-DAG: v_add_u32_e32320; GFX803-DAG: v_addc_u32_e32321; GFX803: flat_store_byte v[0:1], v2{{$}}322 323; GCN-NEXT: s_waitcnt324; GCN-NEXT: s_setpc_b64325define void @store_flat_hi_v2i16_i8_max_offset(ptr %out, i32 %arg) #0 {326entry:327 %value = bitcast i32 %arg to <2 x i16>328 %hi = extractelement <2 x i16> %value, i32 1329 %trunc = trunc i16 %hi to i8330 %gep = getelementptr inbounds i8, ptr %out, i64 4095331 store i8 %trunc, ptr %gep332 ret void333}334 335; GCN-LABEL: {{^}}store_flat_hi_v2i16_i8_neg_offset:336; GCN: s_waitcnt337 338; GFX803-DAG: v_add_u32_e32339; GFX803-DAG: v_addc_u32_e32340 341; GFX9-DAG: v_add_co_u32_e32 v{{[0-9]+}}, vcc, 0xfffff001, v342; GFX9-DAG: v_addc_co_u32_e32 v{{[0-9]+}}, vcc, -1, v{{[0-9]+}}, vcc343 344; GFX9-NEXT: flat_store_byte_d16_hi v[0:1], v2{{$}}345 346; GFX803-DAG: v_lshrrev_b32_e32 v2, 16, v2347; GFX803: flat_store_byte v[0:1], v2{{$}}348 349; GCN-NEXT: s_waitcnt350; GCN-NEXT: s_setpc_b64351define void @store_flat_hi_v2i16_i8_neg_offset(ptr %out, i32 %arg) #0 {352entry:353 %value = bitcast i32 %arg to <2 x i16>354 %hi = extractelement <2 x i16> %value, i32 1355 %trunc = trunc i16 %hi to i8356 %gep = getelementptr inbounds i8, ptr %out, i64 -4095357 store i8 %trunc, ptr %gep358 ret void359}360 361; GCN-LABEL: {{^}}store_private_hi_v2i16:362; GCN: s_waitcnt363 364; GFX9-MUBUF-NEXT: buffer_store_short_d16_hi v1, v0, s[0:3], 0 offen{{$}}365; GFX9-FLATSCR-NEXT: scratch_store_short_d16_hi v0, v1, off366 367; NO-D16-HI: v_lshrrev_b32_e32 v1, 16, v1368; NO-D16-HI: buffer_store_short v1, v0, s[0:3], 0 offen{{$}}369 370; GCN-NEXT: s_waitcnt371; GCN-NEXT: s_setpc_b64372define void @store_private_hi_v2i16(ptr addrspace(5) %out, i32 %arg) #0 {373entry:374 ; FIXME: ABI for pre-gfx9375 %value = bitcast i32 %arg to <2 x i16>376 %hi = extractelement <2 x i16> %value, i32 1377 store i16 %hi, ptr addrspace(5) %out378 ret void379}380 381; GCN-LABEL: {{^}}store_private_hi_v2f16:382; GCN: s_waitcnt383 384; GFX9-MUBUF-NEXT: buffer_store_short_d16_hi v1, v0, s[0:3], 0 offen{{$}}385; GFX9-FLATSCR-NEXT: scratch_store_short_d16_hi v0, v1, off{{$}}386 387; NO-D16-HI: v_lshrrev_b32_e32 v1, 16, v1388; NO-D16-HI: buffer_store_short v1, v0, s[0:3], 0 offen{{$}}389 390; GCN-NEXT: s_waitcnt391; GCN-NEXT: s_setpc_b64392define void @store_private_hi_v2f16(ptr addrspace(5) %out, i32 %arg) #0 {393entry:394 ; FIXME: ABI for pre-gfx9395 %value = bitcast i32 %arg to <2 x half>396 %hi = extractelement <2 x half> %value, i32 1397 store half %hi, ptr addrspace(5) %out398 ret void399}400 401; GCN-LABEL: {{^}}store_private_hi_i32_shift:402; GCN: s_waitcnt403 404; GFX9-MUBUF-NEXT: buffer_store_short_d16_hi v1, v0, s[0:3], 0 offen{{$}}405; GFX9-FLATSCR-NEXT: scratch_store_short_d16_hi v0, v1, off{{$}}406 407; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v1, 16, v1408; NO-D16-HI-NEXT: buffer_store_short v1, v0, s[0:3], 0 offen{{$}}409 410; GCN-NEXT: s_waitcnt411; GCN-NEXT: s_setpc_b64412define void @store_private_hi_i32_shift(ptr addrspace(5) %out, i32 %value) #0 {413entry:414 %hi32 = lshr i32 %value, 16415 %hi = trunc i32 %hi32 to i16416 store i16 %hi, ptr addrspace(5) %out417 ret void418}419 420; GCN-LABEL: {{^}}store_private_hi_v2i16_i8:421; GCN: s_waitcnt422 423; GFX9-MUBUF-NEXT: buffer_store_byte_d16_hi v1, v0, s[0:3], 0 offen{{$}}424; GFX9-FLATSCR-NEXT: scratch_store_byte_d16_hi v0, v1, off{{$}}425 426; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v1, 16, v1427; NO-D16-HI-NEXT: buffer_store_byte v1, v0, s[0:3], 0 offen{{$}}428 429; GCN-NEXT: s_waitcnt430; GCN-NEXT: s_setpc_b64431define void @store_private_hi_v2i16_i8(ptr addrspace(5) %out, i32 %arg) #0 {432entry:433 %value = bitcast i32 %arg to <2 x i16>434 %hi = extractelement <2 x i16> %value, i32 1435 %trunc = trunc i16 %hi to i8436 store i8 %trunc, ptr addrspace(5) %out437 ret void438}439 440; GCN-LABEL: {{^}}store_private_hi_i8_shift:441; GCN: s_waitcnt442 443; GFX9-MUBUF-NEXT: buffer_store_byte_d16_hi v1, v0, s[0:3], 0 offen{{$}}444; GFX9-FLATSCR-NEXT: scratch_store_byte_d16_hi v0, v1, off{{$}}445 446; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v1, 16, v1447; NO-D16-HI-NEXT: buffer_store_byte v1, v0, s[0:3], 0 offen{{$}}448 449; GCN-NEXT: s_waitcnt450; GCN-NEXT: s_setpc_b64451define void @store_private_hi_i8_shift(ptr addrspace(5) %out, i32 %value) #0 {452entry:453 %hi32 = lshr i32 %value, 16454 %hi = trunc i32 %hi32 to i8455 store i8 %hi, ptr addrspace(5) %out456 ret void457}458 459; GCN-LABEL: {{^}}store_private_hi_v2i16_max_offset:460; GCN: s_waitcnt461; GFX9-MUBUF: buffer_store_short_d16_hi v0, off, s[0:3], s32 offset:4094{{$}}462; GFX9-FLATSCR: scratch_store_short_d16_hi off, v0, s32 offset:4094{{$}}463 464; NO-D16-HI: v_lshrrev_b32_e32 v0, 16, v0465; NO-D16-HI-NEXT: buffer_store_short v0, off, s[0:3], s32 offset:4094{{$}}466 467; GCN-NEXT: s_waitcnt468; GCN-NEXT: s_setpc_b64469define void @store_private_hi_v2i16_max_offset(ptr addrspace(5) byval(i16) %out, i32 %arg) #0 {470entry:471 %value = bitcast i32 %arg to <2 x i16>472 %hi = extractelement <2 x i16> %value, i32 1473 %gep = getelementptr inbounds i16, ptr addrspace(5) %out, i64 2047474 store i16 %hi, ptr addrspace(5) %gep475 ret void476}477 478 479 480; GCN-LABEL: {{^}}store_private_hi_v2i16_nooff:481; GCN: s_waitcnt482 483; GFX9-MUBUF-NEXT: buffer_store_short_d16_hi v0, off, s[0:3], 0{{$}}484; GFX9-FLATSCR-NEXT: s_mov_b32 [[SOFF:s[0-9]+]], 0485; GFX9-FLATSCR-NEXT: scratch_store_short_d16_hi off, v0, [[SOFF]]{{$}}486 487; NO-D16-HI-NEXT: v_lshrrev_b32_e32 v0, 16, v0488; NO-D16-HI-NEXT: buffer_store_short v0, off, s[0:3], 0{{$}}489 490; GCN-NEXT: s_waitcnt491; GCN-NEXT: s_setpc_b64492define void @store_private_hi_v2i16_nooff(i32 %arg) #0 {493entry:494 ; FIXME: ABI for pre-gfx9495 %value = bitcast i32 %arg to <2 x i16>496 %hi = extractelement <2 x i16> %value, i32 1497 store volatile i16 %hi, ptr addrspace(5) null498 ret void499}500 501 502; GCN-LABEL: {{^}}store_private_hi_v2i16_i8_nooff:503; GCN: s_waitcnt504 505; GFX9-MUBUF-NEXT: buffer_store_byte_d16_hi v0, off, s[0:3], 0{{$}}506; GFX9-FLATSCR-NEXT: s_mov_b32 [[SOFF:s[0-9]+]], 0507; GFX9-FLATSCR-NEXT: scratch_store_byte_d16_hi off, v0, [[SOFF]]{{$}}508 509; NO-D16-HI: v_lshrrev_b32_e32 v0, 16, v0510; NO-D16-HI: buffer_store_byte v0, off, s[0:3], 0{{$}}511 512; GCN-NEXT: s_waitcnt513; GCN-NEXT: s_setpc_b64514define void @store_private_hi_v2i16_i8_nooff(i32 %arg) #0 {515entry:516 %value = bitcast i32 %arg to <2 x i16>517 %hi = extractelement <2 x i16> %value, i32 1518 %trunc = trunc i16 %hi to i8519 store volatile i8 %trunc, ptr addrspace(5) null520 ret void521}522 523; GCN-LABEL: {{^}}store_local_hi_v2i16:524; GCN: s_waitcnt525 526; GFX9-NEXT: ds_write_b16_d16_hi v0, v1{{$}}527 528; NO-D16-HI: v_lshrrev_b32_e32 v1, 16, v1529; NO-D16-HI: ds_write_b16 v0, v1530 531; GCN-NEXT: s_waitcnt532; GCN-NEXT: s_setpc_b64533define void @store_local_hi_v2i16(ptr addrspace(3) %out, i32 %arg) #0 {534entry:535 ; FIXME: ABI for pre-gfx9536 %value = bitcast i32 %arg to <2 x i16>537 %hi = extractelement <2 x i16> %value, i32 1538 store i16 %hi, ptr addrspace(3) %out539 ret void540}541 542; GCN-LABEL: {{^}}store_local_hi_v2f16:543; GCN: s_waitcnt544 545; GFX9-NEXT: ds_write_b16_d16_hi v0, v1{{$}}546 547; NO-D16-HI: v_lshrrev_b32_e32 v1, 16, v1548; NO-D16-HI: ds_write_b16 v0, v1549 550; GCN-NEXT: s_waitcnt551; GCN-NEXT: s_setpc_b64552define void @store_local_hi_v2f16(ptr addrspace(3) %out, i32 %arg) #0 {553entry:554 ; FIXME: ABI for pre-gfx9555 %value = bitcast i32 %arg to <2 x half>556 %hi = extractelement <2 x half> %value, i32 1557 store half %hi, ptr addrspace(3) %out558 ret void559}560 561; GCN-LABEL: {{^}}store_local_hi_i32_shift:562; GCN: s_waitcnt563 564; GFX9-NEXT: ds_write_b16_d16_hi v0, v1{{$}}565 566; NO-D16-HI: v_lshrrev_b32_e32 v1, 16, v1567; NO-D16-HI: ds_write_b16 v0, v1568 569; GCN-NEXT: s_waitcnt570; GCN-NEXT: s_setpc_b64571define void @store_local_hi_i32_shift(ptr addrspace(3) %out, i32 %value) #0 {572entry:573 %hi32 = lshr i32 %value, 16574 %hi = trunc i32 %hi32 to i16575 store i16 %hi, ptr addrspace(3) %out576 ret void577}578 579; GCN-LABEL: {{^}}store_local_hi_v2i16_i8:580; GCN: s_waitcnt581 582; GFX9-NEXT: ds_write_b8_d16_hi v0, v1{{$}}583 584; NO-D16-HI: v_lshrrev_b32_e32 v1, 16, v1585; NO-D16-HI: ds_write_b8 v0, v1586 587; GCN-NEXT: s_waitcnt588; GCN-NEXT: s_setpc_b64589define void @store_local_hi_v2i16_i8(ptr addrspace(3) %out, i32 %arg) #0 {590entry:591 %value = bitcast i32 %arg to <2 x i16>592 %hi = extractelement <2 x i16> %value, i32 1593 %trunc = trunc i16 %hi to i8594 store i8 %trunc, ptr addrspace(3) %out595 ret void596}597 598; GCN-LABEL: {{^}}store_local_hi_v2i16_max_offset:599; GCN: s_waitcnt600; GFX9-NEXT: ds_write_b16_d16_hi v0, v1 offset:65534{{$}}601 602; NO-D16-HI: v_lshrrev_b32_e32 v1, 16, v1603; NO-D16-HI: ds_write_b16 v0, v1 offset:65534{{$}}604 605; GCN-NEXT: s_waitcnt606; GCN-NEXT: s_setpc_b64607define void @store_local_hi_v2i16_max_offset(ptr addrspace(3) %out, i32 %arg) #0 {608entry:609 ; FIXME: ABI for pre-gfx9610 %value = bitcast i32 %arg to <2 x i16>611 %hi = extractelement <2 x i16> %value, i32 1612 %gep = getelementptr inbounds i16, ptr addrspace(3) %out, i64 32767613 store i16 %hi, ptr addrspace(3) %gep614 ret void615}616 617; GCN-LABEL: {{^}}store_private_hi_v2i16_to_offset:618; GCN: s_waitcnt619; GFX9-MUBUF: buffer_store_dword620; GFX9-MUBUF-NEXT: s_waitcnt vmcnt(0)621; GFX9-MUBUF-NEXT: buffer_store_short_d16_hi v0, off, s[0:3], s32 offset:4058622; GFX9-MUBUF-NEXT: s_waitcnt vmcnt(0)623; GFX9-FLATSCR: scratch_store_dword624; GFX9-FLATSCR-NEXT: s_waitcnt vmcnt(0)625; GFX9-FLATSCR-NEXT: scratch_store_short_d16_hi off, v0, s32 offset:4058626; GFX9-FLATSCR-NEXT: s_waitcnt vmcnt(0)627define void @store_private_hi_v2i16_to_offset(i32 %arg, ptr addrspace(5) %obj0) #0 {628entry:629 %obj1 = alloca [4096 x i16], align 2, addrspace(5)630 store volatile i32 123, ptr addrspace(5) %obj0631 %value = bitcast i32 %arg to <2 x i16>632 %hi = extractelement <2 x i16> %value, i32 1633 %gep = getelementptr inbounds [4096 x i16], ptr addrspace(5) %obj1, i32 0, i32 2027634 store i16 %hi, ptr addrspace(5) %gep635 ret void636}637 638; GCN-LABEL: {{^}}store_private_hi_v2i16_i8_to_offset:639; GCN: s_waitcnt640; GFX9-MUBUF: buffer_store_dword641; GFX9-MUBUF-NEXT: s_waitcnt vmcnt(0)642; GFX9-MUBUF-NEXT: buffer_store_byte_d16_hi v0, off, s[0:3], s32 offset:4059643; GFX9-FLATSCR: scratch_store_dword644; GFX9-FLATSCR-NEXT: s_waitcnt vmcnt(0)645; GFX9-FLATSCR-NEXT: scratch_store_byte_d16_hi off, v0, s32 offset:4059646; GFX9-FLATSCR-NEXT: s_waitcnt vmcnt(0)647define void @store_private_hi_v2i16_i8_to_offset(i32 %arg, ptr addrspace(5) %obj0) #0 {648entry:649 %obj1 = alloca [4096 x i8], align 2, addrspace(5)650 store volatile i32 123, ptr addrspace(5) %obj0651 %value = bitcast i32 %arg to <2 x i16>652 %hi = extractelement <2 x i16> %value, i32 1653 %gep = getelementptr inbounds [4096 x i8], ptr addrspace(5) %obj1, i32 0, i32 4055654 %trunc = trunc i16 %hi to i8655 store i8 %trunc, ptr addrspace(5) %gep656 ret void657}658 659attributes #0 = { nounwind }660