186 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 42; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s -check-prefixes=GFX9,SDAG,GFX9-SDAG3; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck %s -check-prefixes=GFX9,GFX9-GISEL4; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx1010 < %s | FileCheck %s -check-prefixes=GFX10,SDAG,GFX10-SDAG5; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx1010 < %s | FileCheck %s -check-prefixes=GFX10,GFX10-GISEL6 7declare void @foo(i32)8 9define amdgpu_ps void @test(ptr addrspace(1) inreg %ptr) {10; SDAG-LABEL: test:11; SDAG: ; %bb.0:12; SDAG-NEXT: s_mov_b32 s2, src_pops_exiting_wave_id13; SDAG-NEXT: v_mov_b32_e32 v0, 014; SDAG-NEXT: v_mov_b32_e32 v1, s215; SDAG-NEXT: global_store_dword v0, v1, s[0:1]16; SDAG-NEXT: s_endpgm17;18; GFX9-GISEL-LABEL: test:19; GFX9-GISEL: ; %bb.0:20; GFX9-GISEL-NEXT: s_mov_b32 s2, src_pops_exiting_wave_id21; GFX9-GISEL-NEXT: v_mov_b32_e32 v0, s222; GFX9-GISEL-NEXT: v_mov_b32_e32 v1, 023; GFX9-GISEL-NEXT: global_store_dword v1, v0, s[0:1]24; GFX9-GISEL-NEXT: s_endpgm25;26; GFX10-GISEL-LABEL: test:27; GFX10-GISEL: ; %bb.0:28; GFX10-GISEL-NEXT: s_mov_b32 s2, src_pops_exiting_wave_id29; GFX10-GISEL-NEXT: v_mov_b32_e32 v1, 030; GFX10-GISEL-NEXT: v_mov_b32_e32 v0, s231; GFX10-GISEL-NEXT: global_store_dword v1, v0, s[0:1]32; GFX10-GISEL-NEXT: s_endpgm33 %id = call i32 @llvm.amdgcn.pops.exiting.wave.id()34 store i32 %id, ptr addrspace(1) %ptr35 ret void36}37 38define amdgpu_ps void @test_loop() {39; GFX9-LABEL: test_loop:40; GFX9: ; %bb.0:41; GFX9-NEXT: .LBB1_1: ; %loop42; GFX9-NEXT: ; =>This Inner Loop Header: Depth=143; GFX9-NEXT: s_mov_b32 s0, src_pops_exiting_wave_id44; GFX9-NEXT: s_cmp_eq_u32 s0, 045; GFX9-NEXT: s_cbranch_scc1 .LBB1_146; GFX9-NEXT: ; %bb.2: ; %exit47; GFX9-NEXT: s_endpgm48;49; GFX10-LABEL: test_loop:50; GFX10: ; %bb.0:51; GFX10-NEXT: .LBB1_1: ; %loop52; GFX10-NEXT: ; =>This Inner Loop Header: Depth=153; GFX10-NEXT: s_mov_b32 s0, src_pops_exiting_wave_id54; GFX10-NEXT: s_cmp_eq_u32 s0, 055; GFX10-NEXT: s_cbranch_scc1 .LBB1_156; GFX10-NEXT: ; %bb.2: ; %exit57; GFX10-NEXT: s_endpgm58 br label %loop59loop:60 %id = call i32 @llvm.amdgcn.pops.exiting.wave.id()61 %cond = icmp eq i32 %id, 062 br i1 %cond, label %loop, label %exit63exit:64 ret void65}66 67define amdgpu_ps i32 @test_if(i1 inreg %cond) {68; SDAG-LABEL: test_if:69; SDAG: ; %bb.0: ; %entry70; SDAG-NEXT: s_bitcmp0_b32 s0, 071; SDAG-NEXT: s_mov_b32 s0, src_pops_exiting_wave_id72; SDAG-NEXT: s_cbranch_scc1 .LBB2_273; SDAG-NEXT: ; %bb.1: ; %body74; SDAG-NEXT: s_mov_b32 s0, src_pops_exiting_wave_id75; SDAG-NEXT: .LBB2_2: ; %exit76; SDAG-NEXT: ; return to shader part epilog77;78; GFX9-GISEL-LABEL: test_if:79; GFX9-GISEL: ; %bb.0: ; %entry80; GFX9-GISEL-NEXT: s_mov_b32 s1, s081; GFX9-GISEL-NEXT: s_xor_b32 s1, s1, 182; GFX9-GISEL-NEXT: s_and_b32 s1, s1, 183; GFX9-GISEL-NEXT: s_mov_b32 s0, src_pops_exiting_wave_id84; GFX9-GISEL-NEXT: s_cmp_lg_u32 s1, 085; GFX9-GISEL-NEXT: s_cbranch_scc1 .LBB2_286; GFX9-GISEL-NEXT: ; %bb.1: ; %body87; GFX9-GISEL-NEXT: s_mov_b32 s0, src_pops_exiting_wave_id88; GFX9-GISEL-NEXT: .LBB2_2: ; %exit89; GFX9-GISEL-NEXT: ; return to shader part epilog90;91; GFX10-GISEL-LABEL: test_if:92; GFX10-GISEL: ; %bb.0: ; %entry93; GFX10-GISEL-NEXT: s_xor_b32 s0, s0, 194; GFX10-GISEL-NEXT: s_and_b32 s1, s0, 195; GFX10-GISEL-NEXT: s_mov_b32 s0, src_pops_exiting_wave_id96; GFX10-GISEL-NEXT: s_cmp_lg_u32 s1, 097; GFX10-GISEL-NEXT: s_cbranch_scc1 .LBB2_298; GFX10-GISEL-NEXT: ; %bb.1: ; %body99; GFX10-GISEL-NEXT: s_mov_b32 s0, src_pops_exiting_wave_id100; GFX10-GISEL-NEXT: .LBB2_2: ; %exit101; GFX10-GISEL-NEXT: ; return to shader part epilog102entry:103 %id1 = call i32 @llvm.amdgcn.pops.exiting.wave.id()104 br i1 %cond, label %body, label %exit105body:106 %id2 = call i32 @llvm.amdgcn.pops.exiting.wave.id()107 br label %exit108exit:109 %id = phi i32 [ %id1, %entry ], [ %id2, %body ]110 ret i32 %id111}112 113define amdgpu_ps void @test_call(ptr addrspace(1) inreg %ptr) {114; GFX9-SDAG-LABEL: test_call:115; GFX9-SDAG: ; %bb.0:116; GFX9-SDAG-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0117; GFX9-SDAG-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1118; GFX9-SDAG-NEXT: s_mov_b32 s38, -1119; GFX9-SDAG-NEXT: s_mov_b32 s39, 0xe00000120; GFX9-SDAG-NEXT: s_add_u32 s36, s36, s2121; GFX9-SDAG-NEXT: s_addc_u32 s37, s37, 0122; GFX9-SDAG-NEXT: s_getpc_b64 s[0:1]123; GFX9-SDAG-NEXT: s_add_u32 s0, s0, foo@gotpcrel32@lo+4124; GFX9-SDAG-NEXT: s_addc_u32 s1, s1, foo@gotpcrel32@hi+12125; GFX9-SDAG-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0126; GFX9-SDAG-NEXT: s_mov_b32 s6, src_pops_exiting_wave_id127; GFX9-SDAG-NEXT: s_mov_b64 s[0:1], s[36:37]128; GFX9-SDAG-NEXT: s_mov_b64 s[8:9], 36129; GFX9-SDAG-NEXT: s_mov_b64 s[2:3], s[38:39]130; GFX9-SDAG-NEXT: v_mov_b32_e32 v0, s6131; GFX9-SDAG-NEXT: s_mov_b32 s32, 0132; GFX9-SDAG-NEXT: s_waitcnt lgkmcnt(0)133; GFX9-SDAG-NEXT: s_swappc_b64 s[30:31], s[4:5]134; GFX9-SDAG-NEXT: s_endpgm135;136; GFX9-GISEL-LABEL: test_call:137; GFX9-GISEL: ; %bb.0:138; GFX9-GISEL-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0139; GFX9-GISEL-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1140; GFX9-GISEL-NEXT: s_mov_b32 s38, -1141; GFX9-GISEL-NEXT: s_mov_b32 s39, 0xe00000142; GFX9-GISEL-NEXT: s_add_u32 s36, s36, s2143; GFX9-GISEL-NEXT: s_addc_u32 s37, s37, 0144; GFX9-GISEL-NEXT: s_getpc_b64 s[0:1]145; GFX9-GISEL-NEXT: s_add_u32 s0, s0, foo@gotpcrel32@lo+4146; GFX9-GISEL-NEXT: s_addc_u32 s1, s1, foo@gotpcrel32@hi+12147; GFX9-GISEL-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0148; GFX9-GISEL-NEXT: s_mov_b32 s2, src_pops_exiting_wave_id149; GFX9-GISEL-NEXT: v_mov_b32_e32 v0, s2150; GFX9-GISEL-NEXT: s_mov_b64 s[0:1], s[36:37]151; GFX9-GISEL-NEXT: s_mov_b64 s[2:3], s[38:39]152; GFX9-GISEL-NEXT: s_mov_b64 s[8:9], 36153; GFX9-GISEL-NEXT: s_mov_b32 s32, 0154; GFX9-GISEL-NEXT: s_waitcnt lgkmcnt(0)155; GFX9-GISEL-NEXT: s_swappc_b64 s[30:31], s[4:5]156; GFX9-GISEL-NEXT: s_endpgm157;158; GFX10-LABEL: test_call:159; GFX10: ; %bb.0:160; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0161; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1162; GFX10-NEXT: s_mov_b32 s38, -1163; GFX10-NEXT: s_mov_b32 s39, 0x31c16000164; GFX10-NEXT: s_add_u32 s36, s36, s2165; GFX10-NEXT: s_addc_u32 s37, s37, 0166; GFX10-NEXT: s_getpc_b64 s[0:1]167; GFX10-NEXT: s_add_u32 s0, s0, foo@gotpcrel32@lo+4168; GFX10-NEXT: s_addc_u32 s1, s1, foo@gotpcrel32@hi+12169; GFX10-NEXT: s_mov_b64 s[8:9], 36170; GFX10-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0171; GFX10-NEXT: s_mov_b32 s0, src_pops_exiting_wave_id172; GFX10-NEXT: s_mov_b32 s32, 0173; GFX10-NEXT: v_mov_b32_e32 v0, s0174; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]175; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]176; GFX10-NEXT: s_waitcnt lgkmcnt(0)177; GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5]178; GFX10-NEXT: s_endpgm179 %id = call i32 @llvm.amdgcn.pops.exiting.wave.id()180 call void @foo(i32 %id)181 ret void182}183 184;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:185; GFX10-SDAG: {{.*}}186