[clang] Adding `asuint` implementation to hlsl (PR #107292)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 6 12:07:22 PDT 2024
================
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+
+
+// CHECK-LABEL: test_asuint4_uint
+// CHECK: ret i32 %0
+export uint test_asuint4_uint(uint p0) {
+ return asuint(p0);
+}
+
+// CHECK-LABEL: test_asuint4_int
+// CHECK: %splat.splatinsert = insertelement <4 x i32> poison, i32 %0, i64 0
+export uint4 test_asuint4_int(int p0) {
----------------
bogner wrote:
This test takes an int input but returns a uint4 - I don't think it's doing what you intend. There is an implicit cast *after* the asuint call to convert to a vector of 4 elements.
https://github.com/llvm/llvm-project/pull/107292
More information about the cfe-commits
mailing list