|
| 1 | +; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -O1 -global-isel=true < %s |
| 2 | + |
| 3 | +; Function Attrs: nounwind |
| 4 | +define amdgpu_kernel void @test_iglp_opt() #0 { |
| 5 | +entry: |
| 6 | + call void @llvm.amdgcn.iglp.opt(i32 0) #4 |
| 7 | + ret void |
| 8 | +} |
| 9 | + |
| 10 | +; Function Attrs: nounwind |
| 11 | +define amdgpu_kernel void @test_iglp_opt_mfma_gemm(ptr addrspace(3) noalias %in, ptr addrspace(3) noalias %out) #0 { |
| 12 | +entry: |
| 13 | + call void @llvm.amdgcn.iglp.opt(i32 0) |
| 14 | + %idx = call i32 @llvm.amdgcn.workitem.id.x() |
| 15 | + %load.0.addr = getelementptr <32 x float>, ptr addrspace(3) %in, i32 %idx |
| 16 | + %load.0 = load <32 x float>, ptr addrspace(3) %load.0.addr, align 128 |
| 17 | + %load.1.addr = getelementptr <32 x float>, ptr addrspace(3) %load.0.addr, i32 64 |
| 18 | + %load.1 = load <32 x float>, ptr addrspace(3) %load.1.addr, align 128 |
| 19 | + %load.2.addr = getelementptr <32 x float>, ptr addrspace(3) %load.1.addr, i32 128 |
| 20 | + %load.2 = load <32 x float>, ptr addrspace(3) %load.2.addr, align 128 |
| 21 | + %load.3.addr = getelementptr <32 x float>, ptr addrspace(3) %load.2.addr, i32 192 |
| 22 | + %load.3 = load <32 x float>, ptr addrspace(3) %load.3.addr, align 128 |
| 23 | + %load.4.addr = getelementptr <32 x float>, ptr addrspace(3) %load.3.addr, i32 256 |
| 24 | + %load.4 = load <32 x float>, ptr addrspace(3) %load.4.addr, align 128 |
| 25 | + %mai.0 = tail call <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float 1.000000e+00, float 2.000000e+00, <32 x float> %load.0, i32 0, i32 0, i32 0) |
| 26 | + %mai.1 = tail call <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float 1.000000e+00, float 2.000000e+00, <32 x float> %load.1, i32 0, i32 0, i32 0) |
| 27 | + %mai.2 = tail call <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float 1.000000e+00, float 2.000000e+00, <32 x float> %load.2, i32 0, i32 0, i32 0) |
| 28 | + %mai.3 = tail call <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float 1.000000e+00, float 2.000000e+00, <32 x float> %load.3, i32 0, i32 0, i32 0) |
| 29 | + %mai.4 = tail call <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float 1.000000e+00, float 2.000000e+00, <32 x float> %load.4, i32 0, i32 0, i32 0) |
| 30 | + %store.0.addr = getelementptr <32 x float>, ptr addrspace(3) %out, i32 %idx |
| 31 | + store <32 x float> %mai.0, ptr addrspace(3) %store.0.addr, align 128 |
| 32 | + %store.1.addr = getelementptr <32 x float>, ptr addrspace(3) %out, i32 64 |
| 33 | + store <32 x float> %mai.1, ptr addrspace(3) %store.1.addr, align 128 |
| 34 | + %store.2.addr = getelementptr <32 x float>, ptr addrspace(3) %out, i32 128 |
| 35 | + store <32 x float> %mai.2, ptr addrspace(3) %store.2.addr, align 128 |
| 36 | + %store.3.addr = getelementptr <32 x float>, ptr addrspace(3) %out, i32 192 |
| 37 | + store <32 x float> %mai.3, ptr addrspace(3) %store.3.addr, align 128 |
| 38 | + %store.4.addr = getelementptr <32 x float>, ptr addrspace(3) %out, i32 256 |
| 39 | + store <32 x float> %mai.4, ptr addrspace(3) %store.4.addr, align 128 |
| 40 | + ret void |
| 41 | +} |
| 42 | + |
| 43 | +; Function Attrs: nounwind |
| 44 | +define amdgpu_kernel void @test_iglp_opt_rev_mfma_gemm(ptr addrspace(3) noalias %in, ptr addrspace(3) noalias %out) #0 { |
| 45 | +entry: |
| 46 | + call void @llvm.amdgcn.iglp.opt(i32 1) |
| 47 | + %idx = call i32 @llvm.amdgcn.workitem.id.x() |
| 48 | + %load.0.addr = getelementptr <32 x float>, ptr addrspace(3) %in, i32 %idx |
| 49 | + %load.0 = load <32 x float>, ptr addrspace(3) %load.0.addr, align 128 |
| 50 | + %load.1.addr = getelementptr <32 x float>, ptr addrspace(3) %load.0.addr, i32 64 |
| 51 | + %load.1 = load <32 x float>, ptr addrspace(3) %load.1.addr, align 128 |
| 52 | + %load.2.addr = getelementptr <32 x float>, ptr addrspace(3) %load.1.addr, i32 128 |
| 53 | + %load.2 = load <32 x float>, ptr addrspace(3) %load.2.addr, align 128 |
| 54 | + %load.3.addr = getelementptr <32 x float>, ptr addrspace(3) %load.2.addr, i32 192 |
| 55 | + %L = load <1 x i64>, ptr addrspace(3) %load.3.addr, align 8 |
| 56 | + %load.3 = load <32 x float>, ptr addrspace(3) %load.3.addr, align 128 |
| 57 | + %load.4.addr = getelementptr <32 x float>, ptr addrspace(3) %load.3.addr, i32 256 |
| 58 | + %L1 = load <1 x i64>, ptr addrspace(3) %load.4.addr, align 8 |
| 59 | + %load.4 = load <32 x float>, ptr addrspace(3) %load.4.addr, align 128 |
| 60 | + %B = urem <1 x i64> %L, %L1 |
| 61 | + %mai.0 = tail call <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float 1.000000e+00, float 2.000000e+00, <32 x float> %load.0, i32 0, i32 0, i32 0) |
| 62 | + %mai.1 = tail call <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float 1.000000e+00, float 2.000000e+00, <32 x float> %load.1, i32 0, i32 0, i32 0) |
| 63 | + %mai.2 = tail call <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float 1.000000e+00, float 2.000000e+00, <32 x float> %load.2, i32 0, i32 0, i32 0) |
| 64 | + %mai.3 = tail call <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float 1.000000e+00, float 2.000000e+00, <32 x float> %load.3, i32 0, i32 0, i32 0) |
| 65 | + %mai.4 = tail call <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float 1.000000e+00, float 2.000000e+00, <32 x float> %load.4, i32 0, i32 0, i32 0) |
| 66 | + %store.0.addr = getelementptr <32 x float>, ptr addrspace(3) %out, i32 %idx |
| 67 | + store <32 x float> %mai.0, ptr addrspace(3) %store.0.addr, align 128 |
| 68 | + %store.1.addr = getelementptr <32 x float>, ptr addrspace(3) %out, i32 64 |
| 69 | + store <32 x float> %mai.1, ptr addrspace(3) %store.1.addr, align 128 |
| 70 | + %store.2.addr = getelementptr <32 x float>, ptr addrspace(3) %out, i32 128 |
| 71 | + store <32 x float> %mai.2, ptr addrspace(3) %store.2.addr, align 128 |
| 72 | + %store.3.addr = getelementptr <32 x float>, ptr addrspace(3) %out, i32 192 |
| 73 | + store <32 x float> %mai.3, ptr addrspace(3) %store.3.addr, align 128 |
| 74 | + %store.4.addr = getelementptr <32 x float>, ptr addrspace(3) %out, i32 256 |
| 75 | + store <32 x float> %mai.4, ptr addrspace(3) %store.4.addr, align 128 |
| 76 | + store <1 x i64> %B, ptr addrspace(3) %store.3.addr, align 8 |
| 77 | + ret void |
| 78 | +} |
| 79 | + |
| 80 | +; Function Attrs: convergent nocallback nofree nounwind willreturn |
| 81 | +declare void @llvm.amdgcn.iglp.opt(i32 immarg) #1 |
| 82 | + |
| 83 | +; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) |
| 84 | +declare i32 @llvm.amdgcn.workitem.id.x() #2 |
| 85 | + |
| 86 | +; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none) |
| 87 | +declare <32 x float> @llvm.amdgcn.mfma.f32.32x32x1f32(float, float, <32 x float>, i32 immarg, i32 immarg, i32 immarg) #3 |
| 88 | + |
| 89 | +attributes #0 = { nounwind "amdgpu-flat-work-group-size"="1,256" } |
| 90 | +attributes #1 = { convergent nocallback nofree nounwind willreturn } |
| 91 | +attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } |
| 92 | +attributes #3 = { convergent nocallback nofree nosync nounwind willreturn memory(none) } |
| 93 | +attributes #4 = { convergent nounwind } |
0 commit comments