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
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
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
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
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
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]+}}
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
50 declare float @llvm.fabs.f32(float) #1
51 declare float @llvm.amdgcn.fmul.legacy(float, float) #1
53 attributes #0 = { nounwind }
54 attributes #1 = { nounwind readnone }