345 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 52; RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -amdgpu-enable-vopd=0 < %s | FileCheck -check-prefix=GCN %s3 4define amdgpu_ps void @test_export_zeroes_f32() #0 {5; GCN-LABEL: test_export_zeroes_f32:6; GCN: ; %bb.0:7; GCN-NEXT: s_setprio 28; GCN-NEXT: v_mov_b32_e32 v0, 09; GCN-NEXT: exp mrt0 off, off, off, off10; GCN-NEXT: exp mrt0 off, off, off, off done11; GCN-NEXT: s_setprio 012; GCN-NEXT: s_nop 013; GCN-NEXT: s_nop 014; GCN-NEXT: s_endpgm15 call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float 0.0, float 0.0, float 0.0, float 0.0, i1 false, i1 false)16 call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float 0.0, float 0.0, float 0.0, float 0.0, i1 true, i1 false)17 ret void18}19 20define amdgpu_ps void @test_export_en_src0_f32() #0 {21; GCN-LABEL: test_export_en_src0_f32:22; GCN: ; %bb.0:23; GCN-NEXT: s_setprio 224; GCN-NEXT: v_mov_b32_e32 v0, 4.025; GCN-NEXT: v_mov_b32_e32 v1, 0.526; GCN-NEXT: v_mov_b32_e32 v2, 2.027; GCN-NEXT: v_mov_b32_e32 v3, 1.028; GCN-NEXT: exp mrt0 v3, off, off, off done29; GCN-NEXT: s_setprio 030; GCN-NEXT: s_nop 031; GCN-NEXT: s_nop 032; GCN-NEXT: s_endpgm33 call void @llvm.amdgcn.exp.f32(i32 0, i32 1, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false)34 ret void35}36 37define amdgpu_gs void @test_export_gs() #0 {38; GCN-LABEL: test_export_gs:39; GCN: ; %bb.0:40; GCN-NEXT: s_setprio 241; GCN-NEXT: v_mov_b32_e32 v0, 4.042; GCN-NEXT: v_mov_b32_e32 v1, 0.543; GCN-NEXT: v_mov_b32_e32 v2, 2.044; GCN-NEXT: v_mov_b32_e32 v3, 1.045; GCN-NEXT: exp mrt0 off, v2, off, off done46; GCN-NEXT: s_setprio 047; GCN-NEXT: s_nop 048; GCN-NEXT: s_nop 049; GCN-NEXT: s_endpgm50 call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false)51 ret void52}53 54define amdgpu_hs void @test_export_hs() #0 {55; GCN-LABEL: test_export_hs:56; GCN: ; %bb.0:57; GCN-NEXT: s_setprio 258; GCN-NEXT: v_mov_b32_e32 v0, 4.059; GCN-NEXT: v_mov_b32_e32 v1, 0.560; GCN-NEXT: v_mov_b32_e32 v2, 2.061; GCN-NEXT: v_mov_b32_e32 v3, 1.062; GCN-NEXT: exp mrt0 off, v2, off, off done63; GCN-NEXT: s_setprio 064; GCN-NEXT: s_nop 065; GCN-NEXT: s_nop 066; GCN-NEXT: s_endpgm67 call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false)68 ret void69}70 71define amdgpu_gfx void @test_export_gfx(float %v) #0 {72; GCN-LABEL: test_export_gfx:73; GCN: ; %bb.0:74; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)75; GCN-NEXT: v_mov_b32_e32 v1, 4.076; GCN-NEXT: v_mov_b32_e32 v2, 0.577; GCN-NEXT: v_mov_b32_e32 v3, 2.078; GCN-NEXT: exp mrt0 off, v3, off, off done79; GCN-NEXT: s_setprio 080; GCN-NEXT: s_waitcnt_expcnt null, 0x081; GCN-NEXT: s_nop 082; GCN-NEXT: s_nop 083; GCN-NEXT: s_setprio 284; GCN-NEXT: s_waitcnt expcnt(0)85; GCN-NEXT: s_setpc_b64 s[30:31]86 call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float %v, float 2.0, float 0.5, float 4.0, i1 true, i1 false)87 ret void88}89 90define amdgpu_cs void @test_export_cs() #0 {91; GCN-LABEL: test_export_cs:92; GCN: ; %bb.0:93; GCN-NEXT: v_mov_b32_e32 v0, 4.094; GCN-NEXT: v_mov_b32_e32 v1, 0.595; GCN-NEXT: v_mov_b32_e32 v2, 2.096; GCN-NEXT: v_mov_b32_e32 v3, 1.097; GCN-NEXT: exp mrt0 off, v2, off, off done98; GCN-NEXT: s_endpgm99 call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false)100 ret void101}102 103define amdgpu_kernel void @test_export_kernel() #0 {104; GCN-LABEL: test_export_kernel:105; GCN: ; %bb.0:106; GCN-NEXT: v_mov_b32_e32 v0, 4.0107; GCN-NEXT: v_mov_b32_e32 v1, 0.5108; GCN-NEXT: v_mov_b32_e32 v2, 2.0109; GCN-NEXT: v_mov_b32_e32 v3, 1.0110; GCN-NEXT: exp mrt0 off, v2, off, off done111; GCN-NEXT: s_endpgm112 call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false)113 ret void114}115 116define amdgpu_gfx void @test_no_export_gfx(float %v) #0 {117; GCN-LABEL: test_no_export_gfx:118; GCN: ; %bb.0:119; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)120; GCN-NEXT: s_setpc_b64 s[30:31]121 ret void122}123 124define amdgpu_ps void @test_no_export_ps(float %v) #0 {125; GCN-LABEL: test_no_export_ps:126; GCN: ; %bb.0:127; GCN-NEXT: s_endpgm128 ret void129}130 131define amdgpu_ps void @test_if_export_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 {132; GCN-LABEL: test_if_export_f32:133; GCN: ; %bb.0:134; GCN-NEXT: s_setprio 2135; GCN-NEXT: s_mov_b32 s0, exec_lo136; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0137; GCN-NEXT: s_cbranch_execz .LBB9_2138; GCN-NEXT: ; %bb.1: ; %exp139; GCN-NEXT: exp mrt0 v1, v2, v3, v4140; GCN-NEXT: s_setprio 0141; GCN-NEXT: s_waitcnt_expcnt null, 0x0142; GCN-NEXT: s_nop 0143; GCN-NEXT: s_nop 0144; GCN-NEXT: s_setprio 2145; GCN-NEXT: .LBB9_2: ; %end146; GCN-NEXT: s_endpgm147 %cc = icmp eq i32 %flag, 0148 br i1 %cc, label %end, label %exp149 150exp:151 call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 false, i1 false)152 br label %end153 154end:155 ret void156}157 158define amdgpu_ps void @test_if_export_vm_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 {159; GCN-LABEL: test_if_export_vm_f32:160; GCN: ; %bb.0:161; GCN-NEXT: s_setprio 2162; GCN-NEXT: s_mov_b32 s0, exec_lo163; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0164; GCN-NEXT: s_cbranch_execz .LBB10_2165; GCN-NEXT: ; %bb.1: ; %exp166; GCN-NEXT: exp mrt0 v1, v2, v3, v4167; GCN-NEXT: s_setprio 0168; GCN-NEXT: s_waitcnt_expcnt null, 0x0169; GCN-NEXT: s_nop 0170; GCN-NEXT: s_nop 0171; GCN-NEXT: s_setprio 2172; GCN-NEXT: .LBB10_2: ; %end173; GCN-NEXT: s_endpgm174 %cc = icmp eq i32 %flag, 0175 br i1 %cc, label %end, label %exp176 177exp:178 call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 false, i1 true)179 br label %end180 181end:182 ret void183}184 185define amdgpu_ps void @test_if_export_done_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 {186; GCN-LABEL: test_if_export_done_f32:187; GCN: ; %bb.0:188; GCN-NEXT: s_setprio 2189; GCN-NEXT: s_mov_b32 s0, exec_lo190; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0191; GCN-NEXT: s_cbranch_execz .LBB11_2192; GCN-NEXT: ; %bb.1: ; %exp193; GCN-NEXT: exp mrt0 v1, v2, v3, v4 done194; GCN-NEXT: s_setprio 0195; GCN-NEXT: s_waitcnt_expcnt null, 0x0196; GCN-NEXT: s_nop 0197; GCN-NEXT: s_nop 0198; GCN-NEXT: s_setprio 2199; GCN-NEXT: .LBB11_2: ; %end200; GCN-NEXT: s_endpgm201 %cc = icmp eq i32 %flag, 0202 br i1 %cc, label %end, label %exp203 204exp:205 call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 true, i1 false)206 br label %end207 208end:209 ret void210}211 212define amdgpu_ps void @test_if_export_vm_done_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 {213; GCN-LABEL: test_if_export_vm_done_f32:214; GCN: ; %bb.0:215; GCN-NEXT: s_setprio 2216; GCN-NEXT: s_mov_b32 s0, exec_lo217; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0218; GCN-NEXT: s_cbranch_execz .LBB12_2219; GCN-NEXT: ; %bb.1: ; %exp220; GCN-NEXT: exp mrt0 v1, v2, v3, v4 done221; GCN-NEXT: s_setprio 0222; GCN-NEXT: s_waitcnt_expcnt null, 0x0223; GCN-NEXT: s_nop 0224; GCN-NEXT: s_nop 0225; GCN-NEXT: s_setprio 2226; GCN-NEXT: .LBB12_2: ; %end227; GCN-NEXT: s_endpgm228 %cc = icmp eq i32 %flag, 0229 br i1 %cc, label %end, label %exp230 231exp:232 call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 true, i1 true)233 br label %end234 235end:236 ret void237}238 239define amdgpu_ps void @test_export_pos_before_param_across_load(i32 %idx) #0 {240; GCN-LABEL: test_export_pos_before_param_across_load:241; GCN: ; %bb.0:242; GCN-NEXT: s_setprio 2243; GCN-NEXT: buffer_load_b32 v0, v0, s[0:3], 0 offen244; GCN-NEXT: v_mov_b32_e32 v1, 0245; GCN-NEXT: v_mov_b32_e32 v2, 1.0246; GCN-NEXT: v_mov_b32_e32 v3, 0.5247; GCN-NEXT: s_waitcnt vmcnt(0)248; GCN-NEXT: exp pos0 v1, v1, v1, v0 done249; GCN-NEXT: exp invalid_target_32 v2, v2, v2, v2250; GCN-NEXT: exp invalid_target_33 v2, v2, v2, v3251; GCN-NEXT: s_setprio 0252; GCN-NEXT: s_nop 0253; GCN-NEXT: s_nop 0254; GCN-NEXT: s_endpgm255 call void @llvm.amdgcn.exp.f32(i32 32, i32 15, float 1.0, float 1.0, float 1.0, float 1.0, i1 false, i1 false)256 call void @llvm.amdgcn.exp.f32(i32 33, i32 15, float 1.0, float 1.0, float 1.0, float 0.5, i1 false, i1 false)257 %load = call float @llvm.amdgcn.raw.ptr.buffer.load.f32(ptr addrspace(8) poison, i32 %idx, i32 0, i32 0)258 call void @llvm.amdgcn.exp.f32(i32 12, i32 15, float 0.0, float 0.0, float 0.0, float %load, i1 true, i1 false)259 ret void260}261 262define amdgpu_ps void @test_export_across_store_load(i32 %idx, float %v) #0 {263; GCN-LABEL: test_export_across_store_load:264; GCN: ; %bb.0:265; GCN-NEXT: s_setprio 2266; GCN-NEXT: v_mov_b32_e32 v2, 0267; GCN-NEXT: v_cmp_eq_u32_e32 vcc_lo, 1, v0268; GCN-NEXT: s_delay_alu instid0(VALU_DEP_2)269; GCN-NEXT: v_cndmask_b32_e32 v0, 16, v2, vcc_lo270; GCN-NEXT: v_mov_b32_e32 v2, 0271; GCN-NEXT: scratch_store_b32 v0, v1, off272; GCN-NEXT: scratch_load_b32 v0, off, off273; GCN-NEXT: v_mov_b32_e32 v1, 1.0274; GCN-NEXT: exp pos0 v2, v2, v2, v1 done275; GCN-NEXT: s_setprio 0276; GCN-NEXT: s_waitcnt_expcnt null, 0x0277; GCN-NEXT: s_nop 0278; GCN-NEXT: s_nop 0279; GCN-NEXT: s_setprio 2280; GCN-NEXT: s_waitcnt vmcnt(0)281; GCN-NEXT: exp invalid_target_32 v0, v2, v1, v2282; GCN-NEXT: exp invalid_target_33 v0, v2, v1, v2283; GCN-NEXT: s_setprio 0284; GCN-NEXT: s_nop 0285; GCN-NEXT: s_nop 0286; GCN-NEXT: s_endpgm287 %data0 = alloca <4 x float>, align 8, addrspace(5)288 %data1 = alloca <4 x float>, align 8, addrspace(5)289 %cmp = icmp eq i32 %idx, 1290 %data = select i1 %cmp, ptr addrspace(5) %data0, ptr addrspace(5) %data1291 store float %v, ptr addrspace(5) %data, align 8292 call void @llvm.amdgcn.exp.f32(i32 12, i32 15, float 0.0, float 0.0, float 0.0, float 1.0, i1 true, i1 false)293 %load0 = load float, ptr addrspace(5) %data0, align 8294 call void @llvm.amdgcn.exp.f32(i32 32, i32 15, float %load0, float 0.0, float 1.0, float 0.0, i1 false, i1 false)295 call void @llvm.amdgcn.exp.f32(i32 33, i32 15, float %load0, float 0.0, float 1.0, float 0.0, i1 false, i1 false)296 ret void297}298 299define amdgpu_ps void @test_export_in_callee(float %v) #0 {300; GCN-LABEL: test_export_in_callee:301; GCN: ; %bb.0:302; GCN-NEXT: s_setprio 2303; GCN-NEXT: s_getpc_b64 s[0:1]304; GCN-NEXT: s_add_u32 s0, s0, test_export_gfx@gotpcrel32@lo+4305; GCN-NEXT: s_addc_u32 s1, s1, test_export_gfx@gotpcrel32@hi+12306; GCN-NEXT: v_add_f32_e32 v0, 1.0, v0307; GCN-NEXT: s_load_b64 s[0:1], s[0:1], 0x0308; GCN-NEXT: s_mov_b32 s32, 0309; GCN-NEXT: s_waitcnt lgkmcnt(0)310; GCN-NEXT: s_swappc_b64 s[30:31], s[0:1]311; GCN-NEXT: s_endpgm312 %x = fadd float %v, 1.0313 call amdgpu_gfx void @test_export_gfx(float %x)314 ret void315}316 317define amdgpu_ps void @test_export_in_callee_prio(float %v) #0 {318; GCN-LABEL: test_export_in_callee_prio:319; GCN: ; %bb.0:320; GCN-NEXT: s_setprio 2321; GCN-NEXT: s_mov_b32 s32, 0322; GCN-NEXT: v_add_f32_e32 v0, 1.0, v0323; GCN-NEXT: s_setprio 2324; GCN-NEXT: s_getpc_b64 s[0:1]325; GCN-NEXT: s_add_u32 s0, s0, test_export_gfx@gotpcrel32@lo+4326; GCN-NEXT: s_addc_u32 s1, s1, test_export_gfx@gotpcrel32@hi+12327; GCN-NEXT: s_load_b64 s[0:1], s[0:1], 0x0328; GCN-NEXT: s_waitcnt lgkmcnt(0)329; GCN-NEXT: s_swappc_b64 s[30:31], s[0:1]330; GCN-NEXT: s_endpgm331 %x = fadd float %v, 1.0332 call void @llvm.amdgcn.s.setprio(i16 0)333 call amdgpu_gfx void @test_export_gfx(float %x)334 ret void335}336 337declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1338declare void @llvm.amdgcn.exp.i32(i32, i32, i32, i32, i32, i32, i1, i1) #1339declare float @llvm.amdgcn.raw.ptr.buffer.load.f32(ptr addrspace(8), i32, i32, i32) #2340declare void @llvm.amdgcn.s.setprio(i16)341 342attributes #0 = { nounwind }343attributes #1 = { nounwind inaccessiblememonly }344attributes #2 = { nounwind readnone }345