[clang] [HLSL] Implement support for HLSL intrinsic - select (PR #107129)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 5 11:55:48 PDT 2024
================
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
+// RUN: -o - | FileCheck %s --check-prefixes=CHECK
+
+// CHECK: %hlsl.select = select i1
+// CHECK: ret i32 %hlsl.select
+int test_select_bool_int(bool cond0, int tVal, int fVal) {
+ return select<int>(cond0, tVal, fVal); }
+
+struct S { int a; };
+// CHECK: %hlsl.select = select i1
+// CHECK: store ptr %hlsl.select
+// CHECK: ret void
+struct S test_select_infer(bool cond0, struct S tVal, struct S fVal) {
+ return select(cond0, tVal, fVal); }
+
+// CHECK: %hlsl.select = select i1
+// CHECK: ret <2 x i32> %hlsl.select
+vector<int,2> test_select_bool_vector(bool cond0, vector<int, 2> tVal,
+ vector<int, 2> fVal) {
+ return select<vector<int,2> >(cond0, tVal, fVal); }
----------------
farzonl wrote:
is there a reason you aren't using hlsl vector form `int2` here and other places in these tests?
https://github.com/llvm/llvm-project/pull/107129
More information about the cfe-commits
mailing list