[clang] [HLSL] Implement the dst HLSL Function (PR #133828)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 8 13:25:29 PDT 2025
================
@@ -0,0 +1,57 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.2-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+
+
+// CHECK-LABEL: define {{.*}} <4 x float> @{{[A-Za-z1-9_]+}}dst_impl{{[A-Za-z1-9_]*}}(
+// CHECK-SAME: <4 x float> {{[A-Za-z )(]*}} [[P:%.*]], <4 x float> {{[A-Za-z )(]*}} [[Q:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK: [[VECEXT:%.*]] = extractelement <4 x float> [[PADDR:%.*]], i32 1
+// CHECK: [[VECEXT1:%.*]] = extractelement <4 x float> [[QADDR:%.*]], i32 1
+// CHECK: [[MULRES:%.*]] = fmul {{[A-Za-z ]*}} float [[VECEXT]], [[VECEXT1]]
+// CHECK: [[VECINIT:%.*]] = insertelement <4 x float> <float 1.000000e+00, float poison, float poison, float poison>, float [[MULRES]], i32 1
+// CHECK: [[VECINIT2:%.*]] = extractelement <4 x float> [[PADDR2:%.*]], i32 2
+// CHECK: [[VECINIT3:%.*]] = insertelement <4 x float> [[VECINIT]], float [[VECINIT2]], i32 2
+// CHECK: [[VECINIT4:%.*]] = extractelement <4 x float> [[QADDR3:%.*]], i32 3
----------------
metkarpoonam wrote:
The two instructions are identical, they store results in different variables that are used differently later. This prevents using a single placeholder for both.
` %0 = load <4 x double>, ptr %Src0.addr, align 32
%vecext = extractelement <4 x double> %0, i32 1
%2 = load <4 x double>, ptr %Src0.addr, align 32
%vecext2 = extractelement <4 x double> %2, i32 2`
https://github.com/llvm/llvm-project/pull/133828
More information about the cfe-commits
mailing list