Files
TheRock/compiler/amd-llvm/clang/test/CIR/CodeGen/three-way-compare-cleanup.cpp
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

48 lines
1.8 KiB
C++

// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
namespace std {
struct strong_ordering {
int v;
constexpr strong_ordering(int v) : v(v) {}
static const strong_ordering equal;
static const strong_ordering less;
static const strong_ordering greater;
};
inline constexpr strong_ordering strong_ordering::equal{0};
inline constexpr strong_ordering strong_ordering::less{-1};
inline constexpr strong_ordering strong_ordering::greater{1};
} // namespace std
struct Holder {
int v;
Holder(int x);
~Holder();
operator int() const;
};
auto three_way_cmp_with_temp(int a) {
return Holder(a).operator int() <=> 0;
}
// CIR-LABEL: cir.func {{.*}}three_way_cmp_with_temp
// CIR: cir.call @_ZN6HolderC1Ei
// CIR: cir.cleanup.scope {
// CIR: %[[CONV:.*]] = cir.call @_ZNK6HoldercviEv
// CIR: %[[ZERO:.*]] = cir.const #cir.int<0> : !s32i
// CIR: %[[LT:.*]] = cir.const #cir.int<-1> : !s32i
// CIR: %[[EQ:.*]] = cir.const #cir.int<0> : !s32i
// CIR: %[[GT:.*]] = cir.const #cir.int<1> : !s32i
// CIR: %[[CMP_LT:.*]] = cir.cmp lt %[[CONV]], %[[ZERO]]
// CIR: %[[SEL1:.*]] = cir.select if %[[CMP_LT]] then %[[LT]] else %[[GT]]
// CIR: %[[CMP_EQ:.*]] = cir.cmp eq %[[CONV]], %[[ZERO]]
// CIR: %[[RESULT:.*]] = cir.select if %[[CMP_EQ]] then %[[EQ]] else %[[SEL1]]
// CIR: %[[FIELD:.*]] = cir.get_member {{.*}}[0] {name = "v"}
// CIR: cir.store {{.*}} %[[RESULT]], %[[FIELD]]
// CIR: cir.yield
// CIR: } cleanup normal {
// CIR: cir.call @_ZN6HolderD1Ev
// CIR: cir.yield
// CIR: }
// CIR: cir.return