[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 14 15:06:54 PDT 2025
================
@@ -0,0 +1,100 @@
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir -DCIR_ONLY %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
+
+unsigned char cxxstaticcast_0(unsigned int x) {
+ return static_cast<unsigned char>(x);
+}
+
+// CIR: cir.func @cxxstaticcast_0
+// CIR: %0 = cir.alloca !cir.int<u, 32>, !cir.ptr<!cir.int<u, 32>>, ["x", init] {alignment = 4 : i64}
----------------
andykaylor wrote:
You should use pattern matching for %0 and similar values.
https://github.com/llvm/llvm-project/pull/130690
More information about the cfe-commits
mailing list