|
| 1 | +! Check that correct runtime calls are used. |
| 2 | +! RUN: bbc --math-runtime=precise -emit-fir %s -o - | FileCheck --check-prefixes=CHECK-RUNTIME %s |
| 3 | +! RUN: %flang_fc1 -mllvm -math-runtime=precise -emit-fir %s -o - | FileCheck --check-prefixes=CHECK-RUNTIME %s |
| 4 | + |
| 5 | +! Check that the correct math dialect operations are used. |
| 6 | +! RUN: bbc -emit-fir %s -o - | FileCheck --check-prefixes=CHECK-NORMAL %s |
| 7 | +! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK-NORMAL %s |
| 8 | + |
| 9 | +function test_real4(x) |
| 10 | + real :: x, test_real4 |
| 11 | + test_real4 = atan(x) |
| 12 | +end function |
| 13 | + |
| 14 | +! CHECK-RUNTIME: {{%[A-Za-z0-9._]+}} = fir.call @atanf({{.*}}) {{.*}}: (f32) -> f32 |
| 15 | +! CHECK-NORMAL: {{%[A-Za-z0-9._]+}} = math.atan {{.*}} {{.*}}: f32 |
| 16 | + |
| 17 | +function test_real8(x) |
| 18 | + real(8) :: x, test_real8 |
| 19 | + test_real8 = atan(x) |
| 20 | +end function |
| 21 | + |
| 22 | +! CHECK-RUNTIME: {{%[A-Za-z0-9._]+}} = fir.call @atan({{.*}}) {{.*}}: (f64) -> f64 |
| 23 | +! CHECK-NORMAL: {{%[A-Za-z0-9._]+}} = math.atan {{.*}} {{.*}}: f64 |
| 24 | + |
| 25 | +function test_complex4(x) |
| 26 | + complex :: x, test_complex4 |
| 27 | + test_complex4 = atan(x) |
| 28 | +end function |
| 29 | + |
| 30 | +! CHECK-RUNTIME: {{%[A-Za-z0-9._]+}} = fir.call @catanf({{.*}}) {{.*}}: (!fir.complex<4>) -> !fir.complex<4> |
| 31 | +! CHECK-NORMAL: {{%[A-Za-z0-9._]+}} = fir.call @catanf({{.*}}) {{.*}}: (!fir.complex<4>) -> !fir.complex<4> |
| 32 | + |
| 33 | +function test_complex8(x) |
| 34 | + complex(kind=8) :: x, test_complex8 |
| 35 | + test_complex8 = atan(x) |
| 36 | +end function |
| 37 | + |
| 38 | +! CHECK-RUNTIME: {{%[A-Za-z0-9._]+}} = fir.call @catan({{.*}}) {{.*}}: (!fir.complex<8>) -> !fir.complex<8> |
| 39 | +! CHECK-NORMAL: {{%[A-Za-z0-9._]+}} = fir.call @catan({{.*}}) {{.*}}: (!fir.complex<8>) -> !fir.complex<8> |
| 40 | + |
| 41 | +function test_real4_2(y, x) |
| 42 | + real :: y, x, test_real4_2 |
| 43 | + test_real4_2 = atan(y, x) |
| 44 | +end function |
| 45 | + |
| 46 | +! CHECK-RUNTIME: {{%[A-Za-z0-9._]+}} = fir.call @atan2f({{.*}}) {{.*}}: (f32, f32) -> f32 |
| 47 | +! CHECK-NORMAL: {{%[A-Za-z0-9._]+}} = math.atan2 {{.*}} {{.*}}: f32 |
| 48 | + |
| 49 | +function test_real8_2(y, x) |
| 50 | + real(8) :: y, x, test_real8_2 |
| 51 | + test_real8_2 = atan(y, x) |
| 52 | +end function |
| 53 | + |
| 54 | +! CHECK-RUNTIME: {{%[A-Za-z0-9._]+}} = fir.call @atan2({{.*}}) {{.*}}: (f64, f64) -> f64 |
| 55 | +! CHECK-NORMAL: {{%[A-Za-z0-9._]+}} = math.atan2 {{.*}} {{.*}}: f64 |
0 commit comments