@@ -131,6 +131,60 @@ gpu.module @test_module {
131
131
132
132
// -----
133
133
134
+ gpu.module @test_module {
135
+ // CHECK-LABEL: func @gpu_sqrt
136
+ func.func @gpu_sqrt (%arg_f32 : f32 , %arg_f64 : f64 ) -> (f32 , f64 ) {
137
+ %result32 = math.sqrt %arg_f32 : f32
138
+ // CHECK: llvm.intr.sqrt(%{{.*}}) : (f32) -> f32
139
+ %result64 = math.sqrt %arg_f64 : f64
140
+ // CHECK: llvm.intr.sqrt(%{{.*}}) : (f64) -> f64
141
+ func.return %result32 , %result64 : f32 , f64
142
+ }
143
+ }
144
+
145
+ // -----
146
+
147
+ gpu.module @test_module {
148
+ // CHECK-LABEL: func @gpu_fabs
149
+ func.func @gpu_fabs (%arg_f32 : f32 , %arg_f64 : f64 ) -> (f32 , f64 ) {
150
+ %result32 = math.absf %arg_f32 : f32
151
+ // CHECK: llvm.intr.fabs(%{{.*}}) : (f32) -> f32
152
+ %result64 = math.absf %arg_f64 : f64
153
+ // CHECK: llvm.intr.fabs(%{{.*}}) : (f64) -> f64
154
+ func.return %result32 , %result64 : f32 , f64
155
+ }
156
+ }
157
+
158
+ // -----
159
+
160
+ gpu.module @test_module {
161
+ // CHECK: llvm.func @__ocml_exp_f64(f64) -> f64
162
+ // CHECK-LABEL: func @gpu_exp
163
+ func.func @gpu_exp (%arg_f32 : f32 , %arg_f64 : f64 ) -> (f32 , f64 ) {
164
+ %result32 = math.exp %arg_f32 : f32
165
+ // CHECK: llvm.intr.exp(%{{.*}}) : (f32) -> f32
166
+ %result64 = math.exp %arg_f64 : f64
167
+ // CHECK: llvm.call @__ocml_exp_f64(%{{.*}}) : (f64) -> f64
168
+ func.return %result32 , %result64 : f32 , f64
169
+ }
170
+ }
171
+
172
+ // -----
173
+
174
+ gpu.module @test_module {
175
+ // CHECK: llvm.func @__ocml_log_f64(f64) -> f64
176
+ // CHECK-LABEL: func @gpu_log
177
+ func.func @gpu_log (%arg_f32 : f32 , %arg_f64 : f64 ) -> (f32 , f64 ) {
178
+ %result32 = math.log %arg_f32 : f32
179
+ // CHECK: llvm.intr.log(%{{.*}}) : (f32) -> f32
180
+ %result64 = math.log %arg_f64 : f64
181
+ // CHECK: llvm.call @__ocml_log_f64(%{{.*}}) : (f64) -> f64
182
+ func.return %result32 , %result64 : f32 , f64
183
+ }
184
+ }
185
+
186
+ // -----
187
+
134
188
gpu.module @test_module {
135
189
// CHECK: llvm.func @__ocml_cbrt_f32(f32) -> f32
136
190
// CHECK: llvm.func @__ocml_cbrt_f64(f64) -> f64
0 commit comments