Files
TheRock/compiler/amd-llvm/mlir/test/Conversion/MathToEmitC/math-to-emitc.mlir
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

133 lines
4.0 KiB
MLIR

// RUN: mlir-opt -convert-math-to-emitc=language-target=c99 %s | FileCheck %s --check-prefix=c99
// RUN: mlir-opt -convert-math-to-emitc=language-target=cpp11 %s | FileCheck %s --check-prefix=cpp11
func.func @absf(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "fabsf"
// c99-NEXT: emitc.call_opaque "fabs"
// cpp11: emitc.call_opaque "std::fabs"
// cpp11-NEXT: emitc.call_opaque "std::fabs"
%0 = math.absf %arg0 : f32
%1 = math.absf %arg1 : f64
return
}
func.func @floor(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "floorf"
// c99-NEXT: emitc.call_opaque "floor"
// cpp11: emitc.call_opaque "std::floor"
// cpp11-NEXT: emitc.call_opaque "std::floor"
%0 = math.floor %arg0 : f32
%1 = math.floor %arg1 : f64
return
}
func.func @sin(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "sinf"
// c99-NEXT: emitc.call_opaque "sin"
// cpp11: emitc.call_opaque "std::sin"
// cpp11-NEXT: emitc.call_opaque "std::sin"
%0 = math.sin %arg0 : f32
%1 = math.sin %arg1 : f64
return
}
func.func @cos(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "cosf"
// c99-NEXT: emitc.call_opaque "cos"
// cpp11: emitc.call_opaque "std::cos"
// cpp11-NEXT: emitc.call_opaque "std::cos"
%0 = math.cos %arg0 : f32
%1 = math.cos %arg1 : f64
return
}
func.func @asin(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "asinf"
// c99-NEXT: emitc.call_opaque "asin"
// cpp11: emitc.call_opaque "std::asin"
// cpp11-NEXT: emitc.call_opaque "std::asin"
%0 = math.asin %arg0 : f32
%1 = math.asin %arg1 : f64
return
}
func.func @acos(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "acosf"
// c99-NEXT: emitc.call_opaque "acos"
// cpp11: emitc.call_opaque "std::acos"
// cpp11-NEXT: emitc.call_opaque "std::acos"
%0 = math.acos %arg0 : f32
%1 = math.acos %arg1 : f64
return
}
func.func @atan2(%arg0: f32, %arg1: f32, %arg2: f64, %arg3: f64) {
// c99: emitc.call_opaque "atan2f"
// c99-NEXT: emitc.call_opaque "atan2"
// cpp11: emitc.call_opaque "std::atan2"
// cpp11-NEXT: emitc.call_opaque "std::atan2"
%0 = math.atan2 %arg0, %arg1 : f32
%1 = math.atan2 %arg2, %arg3 : f64
return
}
func.func @ceil(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "ceilf"
// c99-NEXT: emitc.call_opaque "ceil"
// cpp11: emitc.call_opaque "std::ceil"
// cpp11-NEXT: emitc.call_opaque "std::ceil"
%0 = math.ceil %arg0 : f32
%1 = math.ceil %arg1 : f64
return
}
func.func @sqrt(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "sqrtf"
// c99-NEXT: emitc.call_opaque "sqrt"
// cpp11: emitc.call_opaque "std::sqrt"
// cpp11-NEXT: emitc.call_opaque "std::sqrt"
%0 = math.sqrt %arg0 : f32
%1 = math.sqrt %arg1 : f64
return
}
func.func @exp(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "expf"
// c99-NEXT: emitc.call_opaque "exp"
// cpp11: emitc.call_opaque "std::exp"
// cpp11-NEXT: emitc.call_opaque "std::exp"
%0 = math.exp %arg0 : f32
%1 = math.exp %arg1 : f64
return
}
func.func @powf(%arg0: f32, %arg1: f32, %arg2: f64, %arg3: f64) {
// c99: emitc.call_opaque "powf"
// c99-NEXT: emitc.call_opaque "pow"
// cpp11: emitc.call_opaque "std::pow"
// cpp11-NEXT: emitc.call_opaque "std::pow"
%0 = math.powf %arg0, %arg1 : f32
%1 = math.powf %arg2, %arg3 : f64
return
}
func.func @round(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "roundf"
// c99-NEXT: emitc.call_opaque "round"
// cpp11: emitc.call_opaque "std::round"
// cpp11-NEXT: emitc.call_opaque "std::round"
%0 = math.round %arg0 : f32
%1 = math.round %arg1 : f64
return
}
func.func @roundeven(%arg0: f32, %arg1: f64) {
// c99: emitc.call_opaque "roundevenf"
// c99-NEXT: emitc.call_opaque "roundeven"
// cpp11: emitc.call_opaque "std::roundeven"
// cpp11-NEXT: emitc.call_opaque "std::roundeven"
%0 = math.roundeven %arg0 : f32
%1 = math.roundeven %arg1 : f64
return
}