[clang] [CIR] Upstream TernaryOp for VectorType (PR #142393)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 2 15:54:15 PDT 2025


================
@@ -1069,4 +1069,19 @@ void foo17() {
 
 // OGCG: %[[VEC_A:.*]] = alloca <2 x double>, align 16
 // OGCG: %[[TMP:.*]] = load <2 x double>, ptr %[[VEC_A]], align 16
-// OGCG: %[[RES:.*]]= fptoui <2 x double> %[[TMP]] to <2 x i16>
\ No newline at end of file
+// OGCG: %[[RES:.*]]= fptoui <2 x double> %[[TMP]] to <2 x i16>
+
+void foo20() {
+  vi4 a;
+  vi4 b;
+  vi4 c;
+  vi4 r = c ? a : b;
----------------
andykaylor wrote:

I'd like to see a test case where the operands are expressions. Something like

`vi4 r = (a > b) ? (a - b) : (b - a);`

https://github.com/llvm/llvm-project/pull/142393


More information about the cfe-commits mailing list