[clang] [llvm] Add length HLSL function to DirectX Backend (PR #101256)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 10:42:01 PDT 2024


================
@@ -0,0 +1,73 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN:   dxil-pc-shadermodel6.3-library %s -fnative-half-type \
+// RUN:   -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ 
+// RUN:   --check-prefixes=CHECK,NATIVE_HALF
+// 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,NO_HALF
+
+// NATIVE_HALF: define noundef half @
+// NATIVE_HALF: call half @llvm.fabs.f16(half
+// NO_HALF: call float @llvm.fabs.f32(float
+// NATIVE_HALF: ret half
+// NO_HALF: ret float
+half test_length_half(half p0)
+{
+	return length(p0);
----------------
farzonl wrote:

spacing seems off on these tests for all the returns. Please normalize to two spaces per indent block.

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


More information about the llvm-commits mailing list