xref: /llvm-project/flang/test/Lower/Intrinsics/fma.f90 (revision 68f55d78e3cd842f1bbdf9a112da7d86fd3a8d36)
1! RUN: bbc -emit-fir %s -o - | FileCheck --check-prefix=CHECK-FIR %s
2! RUN: %flang_fc1 -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-LLVMIR %s
3
4function test_real4(a, x, y)
5  use ieee_arithmetic, only: ieee_fma
6  real :: a, x, y
7  test_real4 = ieee_fma(a, x, y)
8end function
9
10! CHECK-LABEL: @_QPtest_real4
11! CHECK-FIR: {{%[A-Za-z0-9._]+}} = math.fma {{%[0-9]+}}, {{%[0-9]+}}, {{%[0-9]+}} {{.*}} : f32
12! CHECK-LLVMIR: {{%[A-Za-z0-9._]+}} = call {{.*}} float @llvm.fma.f32(float {{%[0-9]+}}, float {{%[0-9]+}}, float {{%[0-9]+}})
13
14function test_real8(a, x, y)
15  use ieee_arithmetic, only: ieee_fma
16  real(8) :: a, x, y
17  test_real8 = ieee_fma(a, x, y)
18end function
19
20! CHECK-LABEL: @_QPtest_real8
21! CHECK-FIR: {{%[A-Za-z0-9._]+}} = math.fma {{%[0-9]+}}, {{%[0-9]+}}, {{%[0-9]+}} {{.*}} : f64
22! CHECK-LLVMIR: {{%[A-Za-z0-9._]+}} = call {{.*}} double @llvm.fma.f64(double {{%[0-9]+}}, double {{%[0-9]+}}, double {{%[0-9]+}})
23