Files
TheRock/compiler/amd-llvm/clang/test/CodeGenHLSL/convergence/while.hlsl
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

128 lines
4.6 KiB
HLSL

// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: spirv-pc-vulkan-library %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s
bool cond();
void foo();
void test1() {
while (cond()) {
}
}
// CHECK-LABEL: define hidden{{.*}} void @_Z5test1v()
// CHECK-SAME: [[A0:#[0-9]+]] {
// CHECK: entry:
// CHECK: [[T0:%[0-9]+]] = call token @llvm.experimental.convergence.entry()
// CHECK: while.cond:
// CHECK: [[T1:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T0]]) ]
// CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3:#[0-9]+]] [ "convergencectrl"(token [[T1]]) ]
void test2() {
while (cond()) {
foo();
}
}
// CHECK-LABEL: define hidden{{.*}} void @_Z5test2v()
// CHECK-SAME: [[A0]] {
// CHECK: entry:
// CHECK: [[T0:%[0-9]+]] = call token @llvm.experimental.convergence.entry()
// CHECK: while.cond:
// CHECK: [[T1:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T0]]) ]
// CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T1]]) ]
// CHECK: while.body:
// CHECK: call{{.*}} void @_Z3foov() [[A3]] [ "convergencectrl"(token [[T1]]) ]
void test3() {
while (cond()) {
if (cond())
break;
foo();
}
}
// CHECK-LABEL: define hidden{{.*}} void @_Z5test3v()
// CHECK-SAME: [[A0]] {
// CHECK: entry:
// CHECK: [[T0:%[0-9]+]] = call token @llvm.experimental.convergence.entry()
// CHECK: while.cond:
// CHECK: [[T1:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T0]]) ]
// CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T1]]) ]
// CHECK: if.then:
// CHECK: br label %while.end
// CHECK: if.end:
// CHECK: call{{.*}} void @_Z3foov() [[A3]] [ "convergencectrl"(token [[T1]]) ]
// CHECK: br label %while.cond
void test4() {
while (cond()) {
if (cond()) {
foo();
break;
}
}
}
// CHECK-LABEL: define hidden{{.*}} void @_Z5test4v()
// CHECK-SAME: [[A0]] {
// CHECK: entry:
// CHECK: [[T0:%[0-9]+]] = call token @llvm.experimental.convergence.entry()
// CHECK: while.cond:
// CHECK: [[T1:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T0]]) ]
// CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T1]]) ]
// CHECK: if.then:
// CHECK: call{{.*}} void @_Z3foov() [[A3]] [ "convergencectrl"(token [[T1]]) ]
// CHECK: br label %while.end
// CHECK: if.end:
// CHECK: br label %while.cond
void test5() {
while (cond()) {
while (cond()) {
if (cond()) {
foo();
break;
}
}
}
}
// CHECK-LABEL: define hidden{{.*}} void @_Z5test5v()
// CHECK-SAME: [[A0]] {
// CHECK: entry:
// CHECK: [[T0:%[0-9]+]] = call token @llvm.experimental.convergence.entry()
// CHECK: while.cond:
// CHECK: [[T1:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T0]]) ]
// CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T1]]) ]
// CHECK: while.cond2:
// CHECK: [[T2:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T1]]) ]
// CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T2]]) ]
// CHECK: if.then:
// CHECK: call{{.*}} void @_Z3foov() [[A3]] [ "convergencectrl"(token [[T2]]) ]
// CHECK: br label %while.end
void test6() {
while (cond()) {
while (cond()) {
}
if (cond()) {
foo();
break;
}
}
}
// CHECK-LABEL: define hidden{{.*}} void @_Z5test6v()
// CHECK-SAME: [[A0]] {
// CHECK: entry:
// CHECK: [[T0:%[0-9]+]] = call token @llvm.experimental.convergence.entry()
// CHECK: while.cond:
// CHECK: [[T1:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T0]]) ]
// CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T1]]) ]
// CHECK: while.cond2:
// CHECK: [[T2:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T1]]) ]
// CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T2]]) ]
// CHECK: if.then:
// CHECK: call{{.*}} void @_Z3foov() [[A3]] [ "convergencectrl"(token [[T1]]) ]
// CHECK: br label %while.end
// CHECK-DAG: attributes [[A0]] = { {{.*}}convergent{{.*}} }
// CHECK-DAG: attributes [[A3]] = { {{.*}}convergent{{.*}} }