|
1 | 1 | ! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s |
2 | 2 |
|
3 | 3 | module mod1 |
4 | | - type int |
5 | | - real :: inf, sup |
6 | | - end type int |
| 4 | + type retf |
| 5 | + real :: inf, sup, near, zero |
| 6 | + end type retf |
| 7 | + type retd |
| 8 | + real(8) :: inf, sup, near, zero |
| 9 | + end type retd |
7 | 10 | contains |
8 | 11 | attributes(global) subroutine fadd(c, a, b) |
9 | | - type (int) :: c, a, b |
10 | | - c%inf = __fadd_rd(a%inf, b%inf) |
11 | | - c%sup = __fadd_ru(a%sup, b%sup) |
| 12 | + real(4) :: a, b |
| 13 | + type (retf) :: c |
| 14 | + c%near = __fadd_rn(a, b) |
| 15 | + c%zero = __fadd_rz(a, b) |
| 16 | + c%inf = __fadd_rd(a, b) |
| 17 | + c%sup = __fadd_ru(a, b) |
12 | 18 | end subroutine |
| 19 | + attributes(global) subroutine dadd(c, a, b) |
| 20 | + real(8) :: a, b |
| 21 | + type (retd) :: c |
| 22 | + c%near = __dadd_rn(a, b) |
| 23 | + c%zero = __dadd_rz(a, b) |
| 24 | + c%inf = __dadd_rd(a, b) |
| 25 | + c%sup = __dadd_ru(a, b) |
| 26 | + end subroutine |
| 27 | + attributes(global) subroutine fmul(c, a, b) |
| 28 | + real(4) :: a, b |
| 29 | + type (retf) :: c |
| 30 | + c%near = __fmul_rn(a, b) |
| 31 | + c%zero = __fmul_rz(a, b) |
| 32 | + c%inf = __fmul_rd(a, b) |
| 33 | + c%sup = __fmul_ru(a, b) |
| 34 | + end subroutine |
| 35 | + attributes(global) subroutine dmul(c, a, b) |
| 36 | + real(8) :: a, b |
| 37 | + type (retf) :: c |
| 38 | + c%near = __dmul_rn(a, b) |
| 39 | + c%zero = __dmul_rz(a, b) |
| 40 | + c%inf = __dmul_rd(a, b) |
| 41 | + c%sup = __dmul_ru(a, b) |
| 42 | + end subroutine |
| 43 | + attributes(global) subroutine fmaf(c, a, b) |
| 44 | + real(4) :: a, b |
| 45 | + type (retf) :: c |
| 46 | + c%near = __fmaf_rn(a, b, b) |
| 47 | + c%zero = __fmaf_rz(a, b, b) |
| 48 | + c%inf = __fmaf_rd(a, b, b) |
| 49 | + c%sup = __fmaf_ru(a, b, b) |
| 50 | + end subroutine |
| 51 | + attributes(global) subroutine fma(c, a, b) |
| 52 | + real(8) :: a, b |
| 53 | + type (retd) :: c |
| 54 | + c%near = __fma_rn(a, b, b) |
| 55 | + c%zero = __fma_rz(a, b, b) |
| 56 | + c%inf = __fma_rd(a, b, b) |
| 57 | + c%sup = __fma_ru(a, b, b) |
| 58 | + end subroutine |
| 59 | + attributes(global) subroutine frcp(c,a) |
| 60 | + real(4) :: a |
| 61 | + type (retf) :: c |
| 62 | + c%near = __frcp_rn(a) |
| 63 | + c%zero = __frcp_rz(a) |
| 64 | + c%inf = __frcp_rd(a) |
| 65 | + c%sup = __frcp_ru(a) |
| 66 | + end subroutine |
| 67 | + attributes(global) subroutine fsqrt(c,a) |
| 68 | + real(4) :: a |
| 69 | + type (retf) :: c |
| 70 | + c%near = __fsqrt_rn(a) |
| 71 | + c%zero = __fsqrt_rz(a) |
| 72 | + c%inf = __fsqrt_rd(a) |
| 73 | + c%sup = __fsqrt_ru(a) |
| 74 | + end subroutine |
| 75 | + attributes(global) subroutine fdiv(c, a, b) |
| 76 | + real(4) :: a, b |
| 77 | + type (retf) :: c |
| 78 | + c%near = __fdiv_rn(a, b) |
| 79 | + c%zero = __fdiv_rz(a, b) |
| 80 | + c%inf = __fdiv_rd(a, b) |
| 81 | + c%sup = __fdiv_ru(a, b) |
| 82 | + end subroutine |
| 83 | + attributes(global) subroutine testsincosf(c, a, b) |
| 84 | + real(4) :: a, b, c |
| 85 | + call sincos(a, b, c) |
| 86 | + end subroutine |
| 87 | + attributes(global) subroutine testsincosd(c, a, b) |
| 88 | + real(8) :: a, b, c |
| 89 | + call sincos(a, b, c) |
| 90 | + end subroutine |
| 91 | + attributes(global) subroutine testsincospif(c, a, b) |
| 92 | + real(4) :: a, b, c |
| 93 | + call sincospi(a, b, c) |
| 94 | + end subroutine |
| 95 | + attributes(global) subroutine testsincospid(c, a, b) |
| 96 | + real(8) :: a, b, c |
| 97 | + call sincospi(a, b, c) |
| 98 | + end subroutine |
| 99 | + attributes(global) subroutine testmulhi(c, a, b) |
| 100 | + integer(4) :: a, b, c |
| 101 | + c = __mulhi(a, b) |
| 102 | + end subroutine |
| 103 | + attributes(global) subroutine testumulhi(c, a, b) |
| 104 | + integer(4) :: a, b, c |
| 105 | + c = __umulhi(a, b) |
| 106 | + end subroutine |
| 107 | + attributes(global) subroutine testmul64hi(c, a, b) |
| 108 | + integer(8) :: a, b, c |
| 109 | + c = __mul64hi(a, b) |
| 110 | + end subroutine |
| 111 | + attributes(global) subroutine testumul64hi(c, a, b) |
| 112 | + integer(8) :: a, b, c |
| 113 | + c = __umul64hi(a, b) |
| 114 | + end subroutine |
| 115 | + |
13 | 116 | end |
14 | 117 |
|
15 | 118 | ! CHECK-LABEL: func.func @_QMmod1Pfadd |
| 119 | +! CHECK: fir.call @__nv_fadd_rn |
| 120 | +! CHECK: fir.call @__nv_fadd_rz |
16 | 121 | ! CHECK: fir.call @__nv_fadd_rd |
17 | 122 | ! CHECK: fir.call @__nv_fadd_ru |
| 123 | + |
| 124 | +! CHECK-LABEL: func.func @_QMmod1Pdadd |
| 125 | +! CHECK: fir.call @__nv_dadd_rn |
| 126 | +! CHECK: fir.call @__nv_dadd_rz |
| 127 | +! CHECK: fir.call @__nv_dadd_rd |
| 128 | +! CHECK: fir.call @__nv_dadd_ru |
| 129 | + |
| 130 | +! CHECK-LABEL: func.func @_QMmod1Pfmul |
| 131 | +! CHECK: fir.call @__nv_fmul_rn |
| 132 | +! CHECK: fir.call @__nv_fmul_rz |
| 133 | +! CHECK: fir.call @__nv_fmul_rd |
| 134 | +! CHECK: fir.call @__nv_fmul_ru |
| 135 | + |
| 136 | +! CHECK-LABEL: func.func @_QMmod1Pdmul |
| 137 | +! CHECK: fir.call @__nv_dmul_rn |
| 138 | +! CHECK: fir.call @__nv_dmul_rz |
| 139 | +! CHECK: fir.call @__nv_dmul_rd |
| 140 | +! CHECK: fir.call @__nv_dmul_ru |
| 141 | + |
| 142 | +! CHECK-LABEL: func.func @_QMmod1Pfmaf |
| 143 | +! CHECK: fir.call @__nv_fmaf_rn |
| 144 | +! CHECK: fir.call @__nv_fmaf_rz |
| 145 | +! CHECK: fir.call @__nv_fmaf_rd |
| 146 | +! CHECK: fir.call @__nv_fmaf_ru |
| 147 | + |
| 148 | +! CHECK-LABEL: func.func @_QMmod1Pfma |
| 149 | +! CHECK: fir.call @__nv_fma_rn |
| 150 | +! CHECK: fir.call @__nv_fma_rz |
| 151 | +! CHECK: fir.call @__nv_fma_rd |
| 152 | +! CHECK: fir.call @__nv_fma_ru |
| 153 | + |
| 154 | +! CHECK-LABEL: func.func @_QMmod1Pfrcp |
| 155 | +! CHECK: fir.call @__nv_frcp_rn |
| 156 | +! CHECK: fir.call @__nv_frcp_rz |
| 157 | +! CHECK: fir.call @__nv_frcp_rd |
| 158 | +! CHECK: fir.call @__nv_frcp_ru |
| 159 | + |
| 160 | +! CHECK-LABEL: func.func @_QMmod1Pfsqrt |
| 161 | +! CHECK: fir.call @__nv_fsqrt_rn |
| 162 | +! CHECK: fir.call @__nv_fsqrt_rz |
| 163 | +! CHECK: fir.call @__nv_fsqrt_rd |
| 164 | +! CHECK: fir.call @__nv_fsqrt_ru |
| 165 | + |
| 166 | +! CHECK-LABEL: func.func @_QMmod1Pfdiv |
| 167 | +! CHECK: fir.call @__nv_fdiv_rn |
| 168 | +! CHECK: fir.call @__nv_fdiv_rz |
| 169 | +! CHECK: fir.call @__nv_fdiv_rd |
| 170 | +! CHECK: fir.call @__nv_fdiv_ru |
| 171 | + |
| 172 | +! CHECK-LABEL: func.func @_QMmod1Ptestsincosf |
| 173 | +! CHECK: fir.call @__nv_sincosf |
| 174 | + |
| 175 | +! CHECK-LABEL: func.func @_QMmod1Ptestsincosd |
| 176 | +! CHECK: fir.call @__nv_sincos |
| 177 | + |
| 178 | +! CHECK-LABEL: func.func @_QMmod1Ptestsincospif |
| 179 | +! CHECK: fir.call @__nv_sincospif |
| 180 | + |
| 181 | +! CHECK-LABEL: func.func @_QMmod1Ptestsincospid |
| 182 | +! CHECK: fir.call @__nv_sincospi |
| 183 | + |
| 184 | +! CHECK-LABEL: func.func @_QMmod1Ptestmulhi |
| 185 | +! CHECK: fir.call @__nv_mulhi |
| 186 | + |
| 187 | +! CHECK-LABEL: func.func @_QMmod1Ptestumulhi |
| 188 | +! CHECK: fir.call @__nv_umulhi |
| 189 | + |
| 190 | +! CHECK-LABEL: func.func @_QMmod1Ptestmul64hi |
| 191 | +! CHECK: fir.call @__nv_mul64hi |
| 192 | + |
| 193 | +! CHECK-LABEL: func.func @_QMmod1Ptestumul64hi |
| 194 | +! CHECK: fir.call @__nv_umul64hi |
0 commit comments