1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN %s 3 4; Check lowering of some large insertelement that use the stack 5; instead of register indexing. 6 7define amdgpu_kernel void @v_insert_v64i32_varidx(<64 x i32> addrspace(1)* %out.ptr, <64 x i32> addrspace(1)* %ptr, i32 %val, i32 %idx) #0 { 8; GCN-LABEL: v_insert_v64i32_varidx: 9; GCN: ; %bb.0: 10; GCN-NEXT: s_load_dwordx4 s[20:23], s[4:5], 0x0 11; GCN-NEXT: s_load_dwordx2 s[24:25], s[4:5], 0x10 12; GCN-NEXT: s_add_u32 s0, s0, s7 13; GCN-NEXT: s_addc_u32 s1, s1, 0 14; GCN-NEXT: v_mov_b32_e32 v16, 0x100 15; GCN-NEXT: s_waitcnt lgkmcnt(0) 16; GCN-NEXT: s_load_dwordx16 s[36:51], s[22:23], 0x0 17; GCN-NEXT: s_load_dwordx16 s[52:67], s[22:23], 0x40 18; GCN-NEXT: s_load_dwordx16 s[4:19], s[22:23], 0x80 19; GCN-NEXT: s_waitcnt lgkmcnt(0) 20; GCN-NEXT: v_mov_b32_e32 v0, s36 21; GCN-NEXT: v_mov_b32_e32 v1, s37 22; GCN-NEXT: v_mov_b32_e32 v2, s38 23; GCN-NEXT: v_mov_b32_e32 v3, s39 24; GCN-NEXT: v_mov_b32_e32 v4, s40 25; GCN-NEXT: v_mov_b32_e32 v5, s41 26; GCN-NEXT: v_mov_b32_e32 v6, s42 27; GCN-NEXT: v_mov_b32_e32 v7, s43 28; GCN-NEXT: v_mov_b32_e32 v8, s44 29; GCN-NEXT: v_mov_b32_e32 v9, s45 30; GCN-NEXT: v_mov_b32_e32 v10, s46 31; GCN-NEXT: v_mov_b32_e32 v11, s47 32; GCN-NEXT: v_mov_b32_e32 v12, s48 33; GCN-NEXT: v_mov_b32_e32 v13, s49 34; GCN-NEXT: v_mov_b32_e32 v14, s50 35; GCN-NEXT: v_mov_b32_e32 v15, s51 36; GCN-NEXT: s_load_dwordx16 s[36:51], s[22:23], 0xc0 37; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:256 38; GCN-NEXT: buffer_store_dword v1, off, s[0:3], 0 offset:260 39; GCN-NEXT: buffer_store_dword v2, off, s[0:3], 0 offset:264 40; GCN-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:268 41; GCN-NEXT: buffer_store_dword v4, off, s[0:3], 0 offset:272 42; GCN-NEXT: buffer_store_dword v5, off, s[0:3], 0 offset:276 43; GCN-NEXT: buffer_store_dword v6, off, s[0:3], 0 offset:280 44; GCN-NEXT: buffer_store_dword v7, off, s[0:3], 0 offset:284 45; GCN-NEXT: buffer_store_dword v8, off, s[0:3], 0 offset:288 46; GCN-NEXT: buffer_store_dword v9, off, s[0:3], 0 offset:292 47; GCN-NEXT: buffer_store_dword v10, off, s[0:3], 0 offset:296 48; GCN-NEXT: buffer_store_dword v11, off, s[0:3], 0 offset:300 49; GCN-NEXT: buffer_store_dword v12, off, s[0:3], 0 offset:304 50; GCN-NEXT: buffer_store_dword v13, off, s[0:3], 0 offset:308 51; GCN-NEXT: buffer_store_dword v14, off, s[0:3], 0 offset:312 52; GCN-NEXT: buffer_store_dword v15, off, s[0:3], 0 offset:316 53; GCN-NEXT: v_mov_b32_e32 v0, s52 54; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:320 55; GCN-NEXT: v_mov_b32_e32 v0, s53 56; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:324 57; GCN-NEXT: v_mov_b32_e32 v0, s54 58; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:328 59; GCN-NEXT: v_mov_b32_e32 v0, s55 60; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:332 61; GCN-NEXT: v_mov_b32_e32 v0, s56 62; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:336 63; GCN-NEXT: v_mov_b32_e32 v0, s57 64; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:340 65; GCN-NEXT: v_mov_b32_e32 v0, s58 66; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:344 67; GCN-NEXT: v_mov_b32_e32 v0, s59 68; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:348 69; GCN-NEXT: v_mov_b32_e32 v0, s60 70; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:352 71; GCN-NEXT: v_mov_b32_e32 v0, s61 72; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:356 73; GCN-NEXT: v_mov_b32_e32 v0, s62 74; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:360 75; GCN-NEXT: v_mov_b32_e32 v0, s63 76; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:364 77; GCN-NEXT: v_mov_b32_e32 v0, s64 78; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:368 79; GCN-NEXT: v_mov_b32_e32 v0, s65 80; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:372 81; GCN-NEXT: v_mov_b32_e32 v0, s66 82; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:376 83; GCN-NEXT: v_mov_b32_e32 v0, s67 84; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:380 85; GCN-NEXT: v_mov_b32_e32 v0, s4 86; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:384 87; GCN-NEXT: v_mov_b32_e32 v0, s5 88; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:388 89; GCN-NEXT: v_mov_b32_e32 v0, s6 90; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:392 91; GCN-NEXT: v_mov_b32_e32 v0, s7 92; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:396 93; GCN-NEXT: v_mov_b32_e32 v0, s8 94; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:400 95; GCN-NEXT: v_mov_b32_e32 v0, s9 96; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:404 97; GCN-NEXT: v_mov_b32_e32 v0, s10 98; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:408 99; GCN-NEXT: v_mov_b32_e32 v0, s11 100; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:412 101; GCN-NEXT: v_mov_b32_e32 v0, s12 102; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:416 103; GCN-NEXT: v_mov_b32_e32 v0, s13 104; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:420 105; GCN-NEXT: v_mov_b32_e32 v0, s14 106; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:424 107; GCN-NEXT: v_mov_b32_e32 v0, s15 108; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:428 109; GCN-NEXT: v_mov_b32_e32 v0, s16 110; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:432 111; GCN-NEXT: v_mov_b32_e32 v0, s17 112; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:436 113; GCN-NEXT: v_mov_b32_e32 v0, s18 114; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:440 115; GCN-NEXT: v_mov_b32_e32 v0, s19 116; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:444 117; GCN-NEXT: s_waitcnt lgkmcnt(0) 118; GCN-NEXT: v_mov_b32_e32 v0, s36 119; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:448 120; GCN-NEXT: v_mov_b32_e32 v0, s37 121; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:452 122; GCN-NEXT: v_mov_b32_e32 v0, s38 123; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:456 124; GCN-NEXT: v_mov_b32_e32 v0, s39 125; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:460 126; GCN-NEXT: v_mov_b32_e32 v0, s40 127; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:464 128; GCN-NEXT: v_mov_b32_e32 v0, s41 129; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:468 130; GCN-NEXT: v_mov_b32_e32 v0, s42 131; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:472 132; GCN-NEXT: v_mov_b32_e32 v0, s43 133; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:476 134; GCN-NEXT: v_mov_b32_e32 v0, s44 135; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:480 136; GCN-NEXT: v_mov_b32_e32 v0, s45 137; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:484 138; GCN-NEXT: v_mov_b32_e32 v0, s46 139; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:488 140; GCN-NEXT: v_mov_b32_e32 v0, s47 141; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:492 142; GCN-NEXT: v_mov_b32_e32 v0, s48 143; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:496 144; GCN-NEXT: v_mov_b32_e32 v0, s49 145; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:500 146; GCN-NEXT: v_mov_b32_e32 v0, s50 147; GCN-NEXT: s_and_b32 s4, s25, 63 148; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:504 149; GCN-NEXT: v_mov_b32_e32 v0, s51 150; GCN-NEXT: s_lshl_b32 s4, s4, 2 151; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:508 152; GCN-NEXT: v_add_u32_e32 v0, s4, v16 153; GCN-NEXT: v_mov_b32_e32 v1, s24 154; GCN-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen 155; GCN-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:256 156; GCN-NEXT: s_nop 0 157; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:260 158; GCN-NEXT: buffer_load_dword v2, off, s[0:3], 0 offset:264 159; GCN-NEXT: buffer_load_dword v3, off, s[0:3], 0 offset:268 160; GCN-NEXT: s_waitcnt vmcnt(0) 161; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:512 ; 4-byte Folded Spill 162; GCN-NEXT: s_waitcnt vmcnt(0) 163; GCN-NEXT: buffer_store_dword v1, off, s[0:3], 0 offset:516 ; 4-byte Folded Spill 164; GCN-NEXT: buffer_store_dword v2, off, s[0:3], 0 offset:520 ; 4-byte Folded Spill 165; GCN-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:524 ; 4-byte Folded Spill 166; GCN-NEXT: buffer_load_dword v0, off, s[0:3], 0 offset:272 167; GCN-NEXT: s_nop 0 168; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:276 169; GCN-NEXT: buffer_load_dword v2, off, s[0:3], 0 offset:280 170; GCN-NEXT: buffer_load_dword v3, off, s[0:3], 0 offset:284 171; GCN-NEXT: s_waitcnt vmcnt(0) 172; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0 offset:528 ; 4-byte Folded Spill 173; GCN-NEXT: s_waitcnt vmcnt(0) 174; GCN-NEXT: buffer_store_dword v1, off, s[0:3], 0 offset:532 ; 4-byte Folded Spill 175; GCN-NEXT: buffer_store_dword v2, off, s[0:3], 0 offset:536 ; 4-byte Folded Spill 176; GCN-NEXT: buffer_store_dword v3, off, s[0:3], 0 offset:540 ; 4-byte Folded Spill 177; GCN-NEXT: buffer_load_dword v8, off, s[0:3], 0 offset:288 178; GCN-NEXT: buffer_load_dword v9, off, s[0:3], 0 offset:292 179; GCN-NEXT: buffer_load_dword v10, off, s[0:3], 0 offset:296 180; GCN-NEXT: buffer_load_dword v11, off, s[0:3], 0 offset:300 181; GCN-NEXT: buffer_load_dword v12, off, s[0:3], 0 offset:304 182; GCN-NEXT: buffer_load_dword v13, off, s[0:3], 0 offset:308 183; GCN-NEXT: buffer_load_dword v14, off, s[0:3], 0 offset:312 184; GCN-NEXT: buffer_load_dword v15, off, s[0:3], 0 offset:316 185; GCN-NEXT: buffer_load_dword v16, off, s[0:3], 0 offset:320 186; GCN-NEXT: buffer_load_dword v17, off, s[0:3], 0 offset:324 187; GCN-NEXT: buffer_load_dword v18, off, s[0:3], 0 offset:328 188; GCN-NEXT: buffer_load_dword v19, off, s[0:3], 0 offset:332 189; GCN-NEXT: buffer_load_dword v20, off, s[0:3], 0 offset:336 190; GCN-NEXT: buffer_load_dword v21, off, s[0:3], 0 offset:340 191; GCN-NEXT: buffer_load_dword v22, off, s[0:3], 0 offset:344 192; GCN-NEXT: buffer_load_dword v23, off, s[0:3], 0 offset:348 193; GCN-NEXT: buffer_load_dword v24, off, s[0:3], 0 offset:352 194; GCN-NEXT: buffer_load_dword v25, off, s[0:3], 0 offset:356 195; GCN-NEXT: buffer_load_dword v26, off, s[0:3], 0 offset:360 196; GCN-NEXT: buffer_load_dword v27, off, s[0:3], 0 offset:364 197; GCN-NEXT: buffer_load_dword v28, off, s[0:3], 0 offset:368 198; GCN-NEXT: buffer_load_dword v29, off, s[0:3], 0 offset:372 199; GCN-NEXT: buffer_load_dword v30, off, s[0:3], 0 offset:376 200; GCN-NEXT: buffer_load_dword v31, off, s[0:3], 0 offset:380 201; GCN-NEXT: buffer_load_dword v32, off, s[0:3], 0 offset:384 202; GCN-NEXT: buffer_load_dword v33, off, s[0:3], 0 offset:388 203; GCN-NEXT: buffer_load_dword v34, off, s[0:3], 0 offset:392 204; GCN-NEXT: buffer_load_dword v35, off, s[0:3], 0 offset:396 205; GCN-NEXT: buffer_load_dword v36, off, s[0:3], 0 offset:400 206; GCN-NEXT: buffer_load_dword v37, off, s[0:3], 0 offset:404 207; GCN-NEXT: buffer_load_dword v38, off, s[0:3], 0 offset:408 208; GCN-NEXT: buffer_load_dword v39, off, s[0:3], 0 offset:412 209; GCN-NEXT: buffer_load_dword v40, off, s[0:3], 0 offset:416 210; GCN-NEXT: buffer_load_dword v41, off, s[0:3], 0 offset:420 211; GCN-NEXT: buffer_load_dword v42, off, s[0:3], 0 offset:424 212; GCN-NEXT: buffer_load_dword v43, off, s[0:3], 0 offset:428 213; GCN-NEXT: buffer_load_dword v44, off, s[0:3], 0 offset:432 214; GCN-NEXT: buffer_load_dword v45, off, s[0:3], 0 offset:436 215; GCN-NEXT: buffer_load_dword v46, off, s[0:3], 0 offset:440 216; GCN-NEXT: buffer_load_dword v47, off, s[0:3], 0 offset:444 217; GCN-NEXT: buffer_load_dword v48, off, s[0:3], 0 offset:448 218; GCN-NEXT: buffer_load_dword v49, off, s[0:3], 0 offset:452 219; GCN-NEXT: buffer_load_dword v50, off, s[0:3], 0 offset:456 220; GCN-NEXT: buffer_load_dword v51, off, s[0:3], 0 offset:460 221; GCN-NEXT: buffer_load_dword v52, off, s[0:3], 0 offset:464 222; GCN-NEXT: buffer_load_dword v53, off, s[0:3], 0 offset:468 223; GCN-NEXT: buffer_load_dword v54, off, s[0:3], 0 offset:472 224; GCN-NEXT: buffer_load_dword v55, off, s[0:3], 0 offset:476 225; GCN-NEXT: buffer_load_dword v56, off, s[0:3], 0 offset:480 226; GCN-NEXT: buffer_load_dword v57, off, s[0:3], 0 offset:484 227; GCN-NEXT: buffer_load_dword v58, off, s[0:3], 0 offset:488 228; GCN-NEXT: buffer_load_dword v59, off, s[0:3], 0 offset:492 229; GCN-NEXT: buffer_load_dword v60, off, s[0:3], 0 offset:496 230; GCN-NEXT: buffer_load_dword v61, off, s[0:3], 0 offset:500 231; GCN-NEXT: buffer_load_dword v62, off, s[0:3], 0 offset:504 232; GCN-NEXT: buffer_load_dword v63, off, s[0:3], 0 offset:508 233; GCN-NEXT: s_nop 0 234; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:512 ; 4-byte Folded Reload 235; GCN-NEXT: s_nop 0 236; GCN-NEXT: buffer_load_dword v2, off, s[0:3], 0 offset:516 ; 4-byte Folded Reload 237; GCN-NEXT: s_nop 0 238; GCN-NEXT: buffer_load_dword v3, off, s[0:3], 0 offset:520 ; 4-byte Folded Reload 239; GCN-NEXT: s_nop 0 240; GCN-NEXT: buffer_load_dword v4, off, s[0:3], 0 offset:524 ; 4-byte Folded Reload 241; GCN-NEXT: v_mov_b32_e32 v0, 0 242; GCN-NEXT: s_waitcnt vmcnt(0) 243; GCN-NEXT: global_store_dwordx4 v0, v[1:4], s[20:21] 244; GCN-NEXT: buffer_load_dword v1, off, s[0:3], 0 offset:528 ; 4-byte Folded Reload 245; GCN-NEXT: s_nop 0 246; GCN-NEXT: buffer_load_dword v2, off, s[0:3], 0 offset:532 ; 4-byte Folded Reload 247; GCN-NEXT: s_nop 0 248; GCN-NEXT: buffer_load_dword v3, off, s[0:3], 0 offset:536 ; 4-byte Folded Reload 249; GCN-NEXT: s_nop 0 250; GCN-NEXT: buffer_load_dword v4, off, s[0:3], 0 offset:540 ; 4-byte Folded Reload 251; GCN-NEXT: s_waitcnt vmcnt(0) 252; GCN-NEXT: global_store_dwordx4 v0, v[1:4], s[20:21] offset:16 253; GCN-NEXT: global_store_dwordx4 v0, v[8:11], s[20:21] offset:32 254; GCN-NEXT: global_store_dwordx4 v0, v[12:15], s[20:21] offset:48 255; GCN-NEXT: global_store_dwordx4 v0, v[16:19], s[20:21] offset:64 256; GCN-NEXT: global_store_dwordx4 v0, v[20:23], s[20:21] offset:80 257; GCN-NEXT: global_store_dwordx4 v0, v[24:27], s[20:21] offset:96 258; GCN-NEXT: global_store_dwordx4 v0, v[28:31], s[20:21] offset:112 259; GCN-NEXT: global_store_dwordx4 v0, v[32:35], s[20:21] offset:128 260; GCN-NEXT: global_store_dwordx4 v0, v[36:39], s[20:21] offset:144 261; GCN-NEXT: global_store_dwordx4 v0, v[40:43], s[20:21] offset:160 262; GCN-NEXT: global_store_dwordx4 v0, v[44:47], s[20:21] offset:176 263; GCN-NEXT: global_store_dwordx4 v0, v[48:51], s[20:21] offset:192 264; GCN-NEXT: global_store_dwordx4 v0, v[52:55], s[20:21] offset:208 265; GCN-NEXT: global_store_dwordx4 v0, v[56:59], s[20:21] offset:224 266; GCN-NEXT: global_store_dwordx4 v0, v[60:63], s[20:21] offset:240 267; GCN-NEXT: s_endpgm 268 %vec = load <64 x i32>, <64 x i32> addrspace(1)* %ptr 269 %insert = insertelement <64 x i32> %vec, i32 %val, i32 %idx 270 store <64 x i32> %insert, <64 x i32> addrspace(1)* %out.ptr 271 ret void 272} 273 274attributes #0 = { "amdgpu-flat-workgroup-size"="1,256" "amdgpu-waves-per-eu"="1,10" } 275