! RUN: %flang_fc1 -emit-hlfir -O3 %s -o - | FileCheck %s --check-prefix=CHECK-O3 ! RUN: %flang_fc1 -emit-hlfir -O3 -ffast-math %s -o - | FileCheck %s --check-prefix=CHECK-FAST ! RUN: %flang_fc1 -emit-hlfir -O3 -ffast-math -fno-protect-parens %s -o - | FileCheck %s --check-prefix=CHECK-FAST-NO-PROTECT real :: a, b, c, d, e b = 1.0 c = 2.0 d = 3.0 e = 4.0 a = b * (c * d * e) print *, a end ! With -O3, fastmath everywhere and protect parens ! CHECK-O3: arith.mulf {{.*}} fastmath ! CHECK-O3: arith.mulf {{.*}} fastmath ! CHECK-O3: hlfir.no_reassoc ! CHECK-O3: arith.mulf {{.*}} fastmath ! With -O3 -ffast-math, regulare computations have fastmath, but still ! protect parens, so the last multiplication is fastmath ! CHECK-FAST: arith.mulf {{.*}} fastmath ! CHECK-FAST: arith.mulf {{.*}} fastmath ! CHECK-FAST: hlfir.no_reassoc ! CHECK-FAST: arith.mulf {{.*}} fastmath<{{.*}}contract ! With -O3 -ffast-math -fno-protect-parens, fastmath everywhere ! (don't protect parens) ! CHECK-FAST-NO-PROTECT: arith.mulf {{.*}} fastmath ! CHECK-FAST-NO-PROTECT: arith.mulf {{.*}} fastmath ! CHECK-FAST-NO-PROTECT: hlfir.no_reassoc ! CHECK-FAST-NO-PROTECT: arith.mulf {{.*}} fastmath