Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / fast-math-arithmetic.f90
blobfe90fdc3e6246074049241d59821527198db4a96
1 ! RUN: %flang_fc1 -emit-fir -ffp-contract=fast %s -o - 2>&1 | FileCheck --check-prefixes=CONTRACT,ALL %s
2 ! RUN: %flang_fc1 -emit-fir -menable-no-infs -ffp-contract=off %s -o - 2>&1 | FileCheck --check-prefixes=NINF,ALL %s
3 ! RUN: %flang_fc1 -emit-fir -menable-no-nans -ffp-contract=off %s -o - 2>&1 | FileCheck --check-prefixes=NNAN,ALL %s
4 ! RUN: %flang_fc1 -emit-fir -fapprox-func -ffp-contract=off %s -o - 2>&1 | FileCheck --check-prefixes=AFN,ALL %s
5 ! RUN: %flang_fc1 -emit-fir -fno-signed-zeros -ffp-contract=off %s -o - 2>&1 | FileCheck --check-prefixes=NSZ,ALL %s
6 ! RUN: %flang_fc1 -emit-fir -mreassociate -ffp-contract=off %s -o - 2>&1 | FileCheck --check-prefixes=REASSOC,ALL %s
7 ! RUN: %flang_fc1 -emit-fir -freciprocal-math -ffp-contract=off %s -o - 2>&1 | FileCheck --check-prefixes=ARCP,ALL %s
8 ! RUN: %flang_fc1 -emit-fir -ffp-contract=fast -menable-no-infs -menable-no-nans -fapprox-func -fno-signed-zeros -mreassociate -freciprocal-math %s -o - 2>&1 | FileCheck --check-prefixes=FAST,ALL %s
9 ! RUN: %flang_fc1 -emit-fir -ffast-math %s -o - 2>&1 | FileCheck --check-prefixes=FAST,ALL %s
11 ! ALL-LABEL: func.func @_QPtest
12 subroutine test(x)
13 real x
14 ! CONTRACT: arith.mulf{{.*}}, {{.*}} fastmath<[[ATTRS:contract]]> : f32
15 ! NINF: arith.mulf{{.*}}, {{.*}} fastmath<[[ATTRS:ninf]]> : f32
16 ! NNAN: arith.mulf{{.*}}, {{.*}} fastmath<[[ATTRS:nnan]]> : f32
17 ! AFN: arith.mulf{{.*}}, {{.*}} fastmath<[[ATTRS:afn]]> : f32
18 ! NSZ: arith.mulf{{.*}}, {{.*}} fastmath<[[ATTRS:nsz]]> : f32
19 ! REASSOC: arith.mulf{{.*}}, {{.*}} fastmath<[[ATTRS:reassoc]]> : f32
20 ! ARCP: arith.mulf{{.*}}, {{.*}} fastmath<[[ATTRS:arcp]]> : f32
21 ! FAST: arith.mulf{{.*}}, {{.*}} fastmath<[[ATTRS:fast]]> : f32
22 ! ALL: arith.divf{{.*}}, {{.*}} fastmath<[[ATTRS]]> : f32
23 ! ALL: arith.addf{{.*}}, {{.*}} fastmath<[[ATTRS]]> : f32
24 ! ALL: arith.subf{{.*}}, {{.*}} fastmath<[[ATTRS]]> : f32
25 x = x * x + x / x - x
26 end subroutine test