[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
@@ -22,56 +22,144 @@ // // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ +// RUN: -emit-llvm -o - | FileCheck %s \ // RUN: -DFNATTRS

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/130320 >From bdb66b5a68090e304647ddbbeb403ac408fcea65 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 25 Feb 2025 14:50:09 -0800 Subject: [PATCH 1/8] start implementation --- clang/lib/Headers/hlsl/hlsl_detail.h | 14

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
@@ -22,56 +22,144 @@ // // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ +// RUN: -emit-llvm -o - | FileCheck %s \ // RUN: -DFNATTRS

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng created https://github.com/llvm/llvm-project/pull/130320 Replaced the current `fmod` definition with a templatized version, implemented `fmod` algorithm for DirectX targets that matches the DXC implementation, added corresponding tests in `clang/test/CodeGenHLSL/built

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
@@ -22,56 +22,144 @@ // // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ +// RUN: -emit-llvm -o - | FileCheck %s \ // RUN: -DFNATTRS

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
@@ -22,56 +22,136 @@ // // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ -// RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTY

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/130320 >From bdb66b5a68090e304647ddbbeb403ac408fcea65 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 25 Feb 2025 14:50:09 -0800 Subject: [PATCH 1/9] start implementation --- clang/lib/Headers/hlsl/hlsl_detail.h | 14

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
@@ -22,56 +22,144 @@ // // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ +// RUN: -emit-llvm -o - | FileCheck %s \ // RUN: -DFNATTRS

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/130320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
@@ -22,56 +22,144 @@ // // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ +// RUN: -emit-llvm -o - | FileCheck %s \ // RUN: -DFNATTRS

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/130320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-07 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/130320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-10 Thread Kaitlin Peng via cfe-commits
@@ -22,56 +22,136 @@ // // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ // RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ -// RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTY

[clang] Implement the `fmod` intrinsic (PR #130320)

2025-03-10 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/130320 >From fd3db87977a52d7560d9eec15522c8afb85c9171 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 25 Feb 2025 14:50:09 -0800 Subject: [PATCH 01/10] start implementation --- clang/lib/Headers/hlsl/hlsl_detail.h |

[clang] [HLSL] Add bounds checks for the HLSL `fmod` vector arguments and return types (PR #131035)

2025-03-12 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng created https://github.com/llvm/llvm-project/pull/131035 Fixes #131024. - Fixes template for scalar and vector `fmod` intrinsic overloads - Fixes `fmod` Sema test >From b33ab9d6a3c87c59ca9b2d3e8e5001f1d79bb620 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 11 Mar 20

[clang] [HLSL] Add bounds checks for the HLSL `fmod` vector arguments and return types (PR #131035)

2025-03-17 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/131035 >From 72625f987846d33c11e57ec4e42e98bf211f3389 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 11 Mar 2025 16:47:27 -0700 Subject: [PATCH] add bounds checks for the hlsl fmod vector arguments and return types

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-21 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng deleted https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-20 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng created https://github.com/llvm/llvm-project/pull/132288 Closes #99156. Tasks completed: - Implement `smoothstep` using HLSL source in `hlsl_intrinsics.h` - Implement the `smoothstep` SPIR-V target built-in in `clang/include/clang/Basic/BuiltinsSPIRV.td` - Add sema c

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-21 Thread Kaitlin Peng via cfe-commits
@@ -101,6 +101,44 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID, TheCall->setType(RetTy); break; } + case SPIRV::BI__builtin_spirv_smoothstep: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +ExprResult A = TheCall->getA

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-21 Thread Kaitlin Peng via cfe-commits
@@ -0,0 +1,44 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 + +// RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -emit-llvm -o - | FileCheck %s + +typedef float float2 __attribute__((ext_vector_type(2))); +typedef

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-21 Thread Kaitlin Peng via cfe-commits
@@ -101,6 +101,44 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID, TheCall->setType(RetTy); break; } + case SPIRV::BI__builtin_spirv_smoothstep: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +ExprResult A = TheCall->getA

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-21 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng deleted https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-21 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/132288 >From 0a5da660c5aae053d87d556e59f98c121d916b79 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 18 Mar 2025 13:25:10 -0700 Subject: [PATCH 1/6] create int_spv_smoothstep intrinsic, create smoothstep lowering & m

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-21 Thread Kaitlin Peng via cfe-commits
@@ -20955,6 +20955,25 @@ Value *CodeGenFunction::EmitSPIRVBuiltinExpr(unsigned BuiltinID, /*ReturnType=*/I->getType(), Intrinsic::spv_reflect, ArrayRef{I, N}, nullptr, "spv.reflect"); } + case SPIRV::BI__builtin_spirv_smoothstep: { +Value *Min = EmitScal

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-21 Thread Kaitlin Peng via cfe-commits
@@ -20955,6 +20955,25 @@ Value *CodeGenFunction::EmitSPIRVBuiltinExpr(unsigned BuiltinID, /*ReturnType=*/I->getType(), Intrinsic::spv_reflect, ArrayRef{I, N}, nullptr, "spv.reflect"); } + case SPIRV::BI__builtin_spirv_smoothstep: { +Value *Min = EmitScal

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-04 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-25 Thread Kaitlin Peng via cfe-commits
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 %s -triple spirv-pc-vulkan-compute -verify + +typedef float float2 __attribute__((ext_vector_type(2))); + +float2 test_no_second_arg(float2 p0) { + return __builtin_spirv_smoothstep(p0); + // expected-error@-1 {{too few arguments to function

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-25 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/132288 >From 0a5da660c5aae053d87d556e59f98c121d916b79 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 18 Mar 2025 13:25:10 -0700 Subject: [PATCH 1/7] create int_spv_smoothstep intrinsic, create smoothstep lowering & m

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-02 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-02 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng created https://github.com/llvm/llvm-project/pull/134171 Closes #99135. Tasks completed: - Wrote implementation in `hlsl_intrinsics.h`/`hlsl_intrinsic_helpers.h` that matches DXC - Created overloads in `hlsl_compat_overloads.h` that take doubles/ints and explicitly

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng deleted https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
@@ -280,6 +280,22 @@ constexpr bool4 isinf(double4 V) { return isinf((float4)V); } _DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp) _DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp) +//===--===// +// lit builtins overloa

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/134171 >From 719bb94279f64f134c826faa22898e4e549bb23c Mon Sep 17 00:00:00 2001 From: kmpeng Date: Thu, 27 Mar 2025 14:39:27 -0700 Subject: [PATCH 1/7] finished lit implementation, added codegen and sema tests --- .../

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
@@ -253,6 +253,37 @@ const inline float length(__detail::HLSL_FIXED_VECTOR X) { return __detail::length_vec_impl(X); } +//===--===// +// lit builtins +//===--

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
@@ -0,0 +1,36 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s + +// CHECK

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
@@ -101,6 +101,16 @@ constexpr vector smoothstep_vec_impl(vector Min, vector Max, #endif } +template constexpr vector lit_impl(T NDotL, T NDotH, T M) { + bool DiffuseCond = NDotL < 0; + T Diffuse = select(DiffuseCond, 0, NDotL); + vector Result = {1, Diffuse, 0, 1}; + bo

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/134171 >From 719bb94279f64f134c826faa22898e4e549bb23c Mon Sep 17 00:00:00 2001 From: kmpeng Date: Thu, 27 Mar 2025 14:39:27 -0700 Subject: [PATCH 1/9] finished lit implementation, added codegen and sema tests --- .../

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
@@ -253,6 +253,37 @@ const inline float length(__detail::HLSL_FIXED_VECTOR X) { return __detail::length_vec_impl(X); } +//===--===// +// lit builtins +//===--

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
@@ -280,6 +280,22 @@ constexpr bool4 isinf(double4 V) { return isinf((float4)V); } _DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp) _DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp) +//===--===// +// lit builtins overloa

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Kaitlin Peng via cfe-commits
@@ -280,6 +280,22 @@ constexpr bool4 isinf(double4 V) { return isinf((float4)V); } _DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp) _DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp) +//===--===// +// lit builtins overloa

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-25 Thread Kaitlin Peng via cfe-commits
@@ -101,6 +101,52 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID, TheCall->setType(RetTy); break; } + case SPIRV::BI__builtin_spirv_smoothstep: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +// check if the all argument

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-25 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/132288 >From 0a5da660c5aae053d87d556e59f98c121d916b79 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 18 Mar 2025 13:25:10 -0700 Subject: [PATCH 1/8] create int_spv_smoothstep intrinsic, create smoothstep lowering & m

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-25 Thread Kaitlin Peng via cfe-commits
@@ -0,0 +1,183 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -O1 -o - |

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-25 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-25 Thread Kaitlin Peng via cfe-commits
@@ -101,6 +101,52 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID, TheCall->setType(RetTy); break; } + case SPIRV::BI__builtin_spirv_smoothstep: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +// check if the all argument

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-25 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/132288 >From 0a5da660c5aae053d87d556e59f98c121d916b79 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 18 Mar 2025 13:25:10 -0700 Subject: [PATCH 1/7] create int_spv_smoothstep intrinsic, create smoothstep lowering & m

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng deleted https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
@@ -0,0 +1,60 @@ +; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} kmpeng wrote: Seems like this change produces thi

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/132288 >From 1d28510653b39fcabe45ad37197674bdd0217add Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 18 Mar 2025 13:25:10 -0700 Subject: [PATCH 01/10] create int_spv_smoothstep intrinsic, create smoothstep lowering &

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
@@ -0,0 +1,60 @@ +; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} kmpeng wrote: Code updated with `--target-env vul

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
@@ -101,6 +101,52 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID, TheCall->setType(RetTy); break; } + case SPIRV::BI__builtin_spirv_smoothstep: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +// check if the all argument

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
@@ -0,0 +1,60 @@ +; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} kmpeng wrote: Would you also like this added to t

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/132288 >From 7853b27b8fffa6d2c0393a4004abaac9a7954608 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 18 Mar 2025 13:25:10 -0700 Subject: [PATCH 01/10] create int_spv_smoothstep intrinsic, create smoothstep lowering &

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
@@ -101,6 +101,52 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID, TheCall->setType(RetTy); break; } + case SPIRV::BI__builtin_spirv_smoothstep: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +// check if the all argument

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/132288 >From 7853b27b8fffa6d2c0393a4004abaac9a7954608 Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 18 Mar 2025 13:25:10 -0700 Subject: [PATCH 1/8] create int_spv_smoothstep intrinsic, create smoothstep lowering & m

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-27 Thread Kaitlin Peng via cfe-commits
@@ -0,0 +1,60 @@ +; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} kmpeng wrote: @s-perron Changing the target envir

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-27 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-28 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/132288 >From 1d28510653b39fcabe45ad37197674bdd0217add Mon Sep 17 00:00:00 2001 From: kmpeng Date: Tue, 18 Mar 2025 13:25:10 -0700 Subject: [PATCH 01/11] create int_spv_smoothstep intrinsic, create smoothstep lowering &

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-05 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng updated https://github.com/llvm/llvm-project/pull/134171 >From 719bb94279f64f134c826faa22898e4e549bb23c Mon Sep 17 00:00:00 2001 From: kmpeng Date: Thu, 27 Mar 2025 14:39:27 -0700 Subject: [PATCH 1/8] finished lit implementation, added codegen and sema tests --- .../

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-04-05 Thread Kaitlin Peng via cfe-commits
@@ -322,5 +322,53 @@ reflect(__detail::HLSL_FIXED_VECTOR I, __detail::HLSL_FIXED_VECTOR N) { return __detail::reflect_vec_impl(I, N); } + +//===--===// +// smoothstep builtin +//===---

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-04 Thread Kaitlin Peng via cfe-commits
@@ -253,6 +253,37 @@ const inline float length(__detail::HLSL_FIXED_VECTOR X) { return __detail::length_vec_impl(X); } +//===--===// +// lit builtins +//===--

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-04 Thread Kaitlin Peng via cfe-commits
@@ -101,6 +101,16 @@ constexpr vector smoothstep_vec_impl(vector Min, vector Max, #endif } +template constexpr vector lit_impl(T NDotL, T NDotH, T M) { + bool DiffuseCond = NDotL < 0; + T Diffuse = select(DiffuseCond, 0, NDotL); + vector Result = {1, Diffuse, 0, 1}; + bo

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-07 Thread Kaitlin Peng via cfe-commits
kmpeng wrote: I currently don't have `-fnative-half-type` enabled in that file, so yes this test case ends up having `float` input/return types (though it's not necessarily being converted in the function, if that's what you're asking). With `-fnative-half-ty

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-07 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-07 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-07 Thread Kaitlin Peng via cfe-commits
https://github.com/kmpeng edited https://github.com/llvm/llvm-project/pull/134171 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits