1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s 2 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s 3 4 5 ; GCN-LABEL: {{^}}test_mul_legacy_f32: 6 ; GCN: v_mul_legacy_f32_e32 v{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}} 7 define amdgpu_kernel void @test_mul_legacy_f32(float addrspace(1)* %out, float %a, float %b) #0 { 8 %result = call float @llvm.amdgcn.fmul.legacy(float %a, float %b) 9 store float %result, float addrspace(1)* %out, align 4 10 ret void 11 } 12 13 ; GCN-LABEL: {{^}}test_mul_legacy_undef0_f32: 14 ; GCN: v_mul_legacy_f32_e32 15 define amdgpu_kernel void @test_mul_legacy_undef0_f32(float addrspace(1)* %out, float %a) #0 { 16 %result = call float @llvm.amdgcn.fmul.legacy(float undef, float %a) 17 store float %result, float addrspace(1)* %out, align 4 18 ret void 19 } 20 21 ; GCN-LABEL: {{^}}test_mul_legacy_undef1_f32: 22 ; GCN: v_mul_legacy_f32_e32 23 define amdgpu_kernel void @test_mul_legacy_undef1_f32(float addrspace(1)* %out, float %a) #0 { 24 %result = call float @llvm.amdgcn.fmul.legacy(float %a, float undef) 25 store float %result, float addrspace(1)* %out, align 4 26 ret void 27 } 28 29 ; GCN-LABEL: {{^}}test_mul_legacy_fabs_f32: 30 ; GCN: v_mul_legacy_f32_e64 v{{[0-9]+}}, |s{{[0-9]+}}|, |v{{[0-9]+}}| 31 define amdgpu_kernel void @test_mul_legacy_fabs_f32(float addrspace(1)* %out, float %a, float %b) #0 { 32 %a.fabs = call float @llvm.fabs.f32(float %a) 33 %b.fabs = call float @llvm.fabs.f32(float %b) 34 %result = call float @llvm.amdgcn.fmul.legacy(float %a.fabs, float %b.fabs) 35 store float %result, float addrspace(1)* %out, align 4 36 ret void 37 } 38 39 ; TODO: Should match mac_legacy/mad_legacy 40 ; GCN-LABEL: {{^}}test_mad_legacy_f32: 41 ; GCN: v_mul_legacy_f32_e32 v{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}} 42 ; GCN: v_add_f32_e32 43 define amdgpu_kernel void @test_mad_legacy_f32(float addrspace(1)* %out, float %a, float %b, float %c) #0 { 44 %mul = call float @llvm.amdgcn.fmul.legacy(float %a, float %b) 45 %add = fadd float %mul, %c 46 store float %add, float addrspace(1)* %out, align 4 47 ret void 48 } 49 50 declare float @llvm.fabs.f32(float) #1 51 declare float @llvm.amdgcn.fmul.legacy(float, float) #1 52 53 attributes #0 = { nounwind } 54 attributes #1 = { nounwind readnone } 55