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
90 lines
2.7 KiB
MLIR
90 lines
2.7 KiB
MLIR
// RUN: mlir-translate -mlir-to-cpp -declare-variables-at-top %s | FileCheck %s -check-prefix=CPP-DECLTOP
|
|
|
|
// simple(10, true) -> 20
|
|
// simple(10, false) -> 30
|
|
func.func @simple(i64, i1) -> i64 {
|
|
^bb0(%a: i64, %cond: i1):
|
|
cf.cond_br %cond, ^bb1, ^bb2
|
|
^bb1:
|
|
cf.br ^bb3(%a: i64)
|
|
^bb2:
|
|
%b = emitc.call_opaque "add"(%a, %a) : (i64, i64) -> i64
|
|
cf.br ^bb3(%b: i64)
|
|
^bb3(%c: i64):
|
|
cf.br ^bb4(%c, %a : i64, i64)
|
|
^bb4(%d : i64, %e : i64):
|
|
%0 = emitc.call_opaque "add"(%d, %e) : (i64, i64) -> i64
|
|
return %0 : i64
|
|
}
|
|
// CPP-DECLTOP: int64_t simple(int64_t [[A:[^ ]*]], bool [[COND:[^ ]*]]) {
|
|
// CPP-DECLTOP-NEXT: int64_t [[B:[^ ]*]];
|
|
// CPP-DECLTOP-NEXT: int64_t [[V0:[^ ]*]];
|
|
// CPP-DECLTOP-NEXT: int64_t [[C:[^ ]*]];
|
|
// CPP-DECLTOP-NEXT: int64_t [[D:[^ ]*]];
|
|
// CPP-DECLTOP-NEXT: int64_t [[E:[^ ]*]];
|
|
// CPP-DECLTOP-NEXT: if ([[COND]]) {
|
|
// CPP-DECLTOP-NEXT: goto [[BB1:[^ ]*]];
|
|
// CPP-DECLTOP-NEXT: } else {
|
|
// CPP-DECLTOP-NEXT: goto [[BB2:[^ ]*]];
|
|
// CPP-DECLTOP-NEXT: }
|
|
// CPP-DECLTOP-NEXT: [[BB1]]:
|
|
// CPP-DECLTOP-NEXT: [[C]] = [[A]];
|
|
// CPP-DECLTOP-NEXT: goto [[BB3:[^ ]*]];
|
|
// CPP-DECLTOP-NEXT: [[BB2]]:
|
|
// CPP-DECLTOP-NEXT: [[B]] = add([[A]], [[A]]);
|
|
// CPP-DECLTOP-NEXT: [[C]] = [[B]];
|
|
// CPP-DECLTOP-NEXT: goto [[BB3]];
|
|
// CPP-DECLTOP-NEXT: [[BB3]]:
|
|
// CPP-DECLTOP-NEXT: [[D]] = [[C]];
|
|
// CPP-DECLTOP-NEXT: [[E]] = [[A]];
|
|
// CPP-DECLTOP-NEXT: goto [[BB4:[^ ]*]];
|
|
// CPP-DECLTOP-NEXT: [[BB4]]:
|
|
// CPP-DECLTOP-NEXT: [[V0]] = add([[D]], [[E]]);
|
|
// CPP-DECLTOP-NEXT: return [[V0]];
|
|
|
|
|
|
func.func @block_labels0() {
|
|
^bb1:
|
|
cf.br ^bb2
|
|
^bb2:
|
|
return
|
|
}
|
|
// CPP-DECLTOP: void block_labels0() {
|
|
// CPP-DECLTOP-NEXT: goto label2;
|
|
// CPP-DECLTOP-NEXT: label2:
|
|
// CPP-DECLTOP-NEXT: return;
|
|
// CPP-DECLTOP-NEXT: }
|
|
|
|
|
|
// Repeat the same function to make sure the names of the block labels get reset.
|
|
func.func @block_labels1() {
|
|
^bb1:
|
|
cf.br ^bb2
|
|
^bb2:
|
|
return
|
|
}
|
|
// CPP-DECLTOP: void block_labels1() {
|
|
// CPP-DECLTOP-NEXT: goto label2;
|
|
// CPP-DECLTOP-NEXT: label2:
|
|
// CPP-DECLTOP-NEXT: return;
|
|
// CPP-DECLTOP-NEXT: }
|
|
|
|
emitc.func @expression_inlining(%0 : i32, %1 : i32) {
|
|
%2 = expression %0, %1 : (i32, i32) -> i1 {
|
|
%3 = cmp lt, %0, %1 : (i32, i32) -> i1
|
|
yield %3 : i1
|
|
}
|
|
cf.cond_br %2, ^bb1, ^bb1
|
|
^bb1: // 2 preds: ^bb0, ^bb0
|
|
return
|
|
}
|
|
// CPP-DECLTOP: void expression_inlining(int32_t [[v1:v.*]], int32_t [[v2:v.*]]) {
|
|
// CPP-DECLTOP-NEXT: if ([[v1]] < [[v2]]) {
|
|
// CPP-DECLTOP-NEXT: goto label2;
|
|
// CPP-DECLTOP-NEXT: } else {
|
|
// CPP-DECLTOP-NEXT: goto label2;
|
|
// CPP-DECLTOP-NEXT: }
|
|
// CPP-DECLTOP-NEXT: label2:
|
|
// CPP-DECLTOP-NEXT: return;
|
|
// CPP-DECLTOP-NEXT: }
|