"__nv_atan");
populateOpPatterns<math::Atan2Op>(converter, patterns, "__nv_atan2f",
"__nv_atan2");
+ populateOpPatterns<math::CbrtOp>(converter, patterns, "__nv_cbrtf",
+ "__nv_cbrt");
populateOpPatterns<math::CeilOp>(converter, patterns, "__nv_ceilf",
"__nv_ceil");
populateOpPatterns<math::CosOp>(converter, patterns, "__nv_cosf", "__nv_cos");
"__ocml_atan_f64");
populateOpPatterns<math::Atan2Op>(converter, patterns, "__ocml_atan2_f32",
"__ocml_atan2_f64");
+ populateOpPatterns<math::CbrtOp>(converter, patterns, "__ocml_cbrt_f32",
+ "__ocml_cbrt_f64");
populateOpPatterns<math::CeilOp>(converter, patterns, "__ocml_ceil_f32",
"__ocml_ceil_f64");
populateOpPatterns<math::CosOp>(converter, patterns, "__ocml_cos_f32",
// -----
gpu.module @test_module {
+ // CHECK: llvm.func @__nv_cbrtf(f32) -> f32
+ // CHECK: llvm.func @__nv_cbrt(f64) -> f64
+ // CHECK-LABEL: func @gpu_cbrt
+ func.func @gpu_cbrt(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) {
+ %result32 = math.cbrt %arg_f32 : f32
+ // CHECK: llvm.call @__nv_cbrtf(%{{.*}}) : (f32) -> f32
+ %result64 = math.cbrt %arg_f64 : f64
+ // CHECK: llvm.call @__nv_cbrt(%{{.*}}) : (f64) -> f64
+ func.return %result32, %result64 : f32, f64
+ }
+}
+
+// -----
+
+gpu.module @test_module {
// CHECK: llvm.func @__nv_ceilf(f32) -> f32
// CHECK: llvm.func @__nv_ceil(f64) -> f64
// CHECK-LABEL: func @gpu_ceil
gpu.func @test_printf(%arg0: i32, %arg1: f32) {
// CHECK-NEXT: %[[FORMATSTR:.*]] = llvm.mlir.addressof @[[$PRINT_GLOBAL1]] : !llvm.ptr<array<11 x i8>>
// CHECK-NEXT: %[[FORMATSTART:.*]] = llvm.getelementptr %[[FORMATSTR]][0, 0] : (!llvm.ptr<array<11 x i8>>) -> !llvm.ptr<i8>
- // CHECK-NEXT: %[[EXT:.+]] = llvm.fpext %[[ARG1]] : f32 to f64
+ // CHECK-NEXT: %[[EXT:.+]] = llvm.fpext %[[ARG1]] : f32 to f64
// CHECK-NEXT: %[[O:.*]] = llvm.mlir.constant(1 : index) : i64
// CHECK-NEXT: %[[ALLOC:.*]] = llvm.alloca %[[O]] x !llvm.struct<(i32, f64)> : (i64) -> !llvm.ptr<struct<(i32, f64)>>
// CHECK-NEXT: %[[EL0:.*]] = llvm.getelementptr %[[ALLOC]][0, 0] : (!llvm.ptr<struct<(i32, f64)>>) -> !llvm.ptr<i32>
// -----
gpu.module @test_module {
+ // CHECK: llvm.func @__ocml_cbrt_f32(f32) -> f32
+ // CHECK: llvm.func @__ocml_cbrt_f64(f64) -> f64
+ // CHECK-LABEL: func @gpu_cbrt
+ func.func @gpu_cbrt(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) {
+ %result32 = math.cbrt %arg_f32 : f32
+ // CHECK: llvm.call @__ocml_cbrt_f32(%{{.*}}) : (f32) -> f32
+ %result64 = math.cbrt %arg_f64 : f64
+ // CHECK: llvm.call @__ocml_cbrt_f64(%{{.*}}) : (f64) -> f64
+ func.return %result32, %result64 : f32, f64
+ }
+}
+
+// -----
+
+gpu.module @test_module {
// CHECK: llvm.func @__ocml_ceil_f32(f32) -> f32
// CHECK: llvm.func @__ocml_ceil_f64(f64) -> f64
// CHECK-LABEL: func @gpu_ceil