[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2025-01-06 Thread Farzon Lotfi via cfe-commits
farzonl wrote: > I'd definitely suggest you reduce the scope - maybe always expand the > reduction serially in the frontend and not create the llvm intrinsic at all? Between @Il-Capitano and @RKSimon comments I think it makes the most sense to do a sequential reduction in the frontend. Thats

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2025-01-06 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/120367 >From e46ef6592aec6a1a0b3f7509eb260bb1e9bda692 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Wed, 18 Dec 2024 01:44:42 -0500 Subject: [PATCH 1/3] [Clang] Add float type support to __builtin_reduce_add and _

[clang] [llvm] [NFC] fix up typos (PR #121842)

2025-01-06 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl created https://github.com/llvm/llvm-project/pull/121842 Fix Tablegen typo to indicate SPIRV and not HLSL Fix miscellaneous test case typos. >From 269b25fae5ea78c3c851bd041966d2eff4c01eb1 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Mon, 6 Jan 2025 16:45:14 -050

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/121611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/121611 >From 7044e856bcd89de7318f7f4970c53beb0fc4 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Tue, 17 Dec 2024 18:30:23 -0500 Subject: [PATCH 1/3] [HLSL] Move length intrinsic to the header --- clang/includ

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/121611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
farzonl wrote: > Thanks for the description. I would find some justification useful even if it > just repeats the reasoning we've established for all such changes. @pow2clk added a justification. https://github.com/llvm/llvm-project/pull/121611 ___ c

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
@@ -33,6 +41,21 @@ constexpr enable_if_t bit_cast(T F) { return __builtin_bit_cast(U, F); } +template +constexpr enable_if_t::value || is_same::value, T> +length_impl(T X) { + return __builtin_elementwise_abs(X); +} + +template +enable_if_t::value || is_same::value, T> +

[clang] [llvm] [NFC] fix up typos (PR #121842)

2025-01-06 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl closed https://github.com/llvm/llvm-project/pull/121842 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
@@ -1297,27 +1297,16 @@ float4 lerp(float4, float4, float4); /// /// Length is based on the following formula: sqrt(x[0]^2 + x[1]^2 + ...). -_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) -_HLSL_BUILTIN_ALIAS(__builtin_hlsl_length) -half length(half); -_HLSL_16BIT_AVAILABILITY(sha

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
@@ -1,73 +1,151 @@ -// 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 -

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
@@ -1,32 +1,53 @@ -// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected - +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-h

[clang] [llvm] [SPIRV] Add Target Builtins using Distance ext as an example (PR #121598)

2025-01-03 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl created https://github.com/llvm/llvm-project/pull/121598 - Update pr labeler so new SPIRV files get properly labeled. - Add distance target builtin to BuiltinsSPIRV.td. - Update TargetBuiltins.h to account for spirv builtins. - Update clang basic CMakeLists.txt to buil

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-03 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl created https://github.com/llvm/llvm-project/pull/121611 None >From 2de0c4911dfbc67b9492eb4f13bcd162e79c3d37 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Tue, 17 Dec 2024 18:30:23 -0500 Subject: [PATCH 1/2] [HLSL] Move length intrinsic to the header --- clang/

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-03 Thread Farzon Lotfi via cfe-commits
@@ -33,6 +41,23 @@ constexpr enable_if_t bit_cast(T F) { return __builtin_bit_cast(U, F); } +template +constexpr enable_if_t::value || is_same::value, T> +length_impl(T X) { + return __builtin_elementwise_abs(X); +} + +template +enable_if_t::value || is_same::value, T> +

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-03 Thread Farzon Lotfi via cfe-commits
@@ -1,73 +1,151 @@ -// 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 -

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-03 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/121611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-03 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/121611 >From 2de0c4911dfbc67b9492eb4f13bcd162e79c3d37 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Tue, 17 Dec 2024 18:30:23 -0500 Subject: [PATCH 1/2] [HLSL] Move length intrinsic to the header --- clang/includ

[clang] [llvm] [SPIRV] Add Target Builtins using Distance ext as an example (PR #121598)

2025-01-06 Thread Farzon Lotfi via cfe-commits
@@ -20440,6 +20442,26 @@ Value *CodeGenFunction::EmitAMDGPUBuiltinExpr(unsigned BuiltinID, } } +Value *CodeGenFunction::EmitSPIRVBuiltinExpr(unsigned BuiltinID, + const CallExpr *E) { + switch (BuiltinID) { + case SPIRV::BI__bui

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
@@ -33,6 +41,23 @@ constexpr enable_if_t bit_cast(T F) { return __builtin_bit_cast(U, F); } +template +constexpr enable_if_t::value || is_same::value, T> +length_impl(T X) { + return __builtin_elementwise_abs(X); +} + +template +enable_if_t::value || is_same::value, T> +

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
@@ -33,6 +41,21 @@ constexpr enable_if_t bit_cast(T F) { return __builtin_bit_cast(U, F); } +template +constexpr enable_if_t::value || is_same::value, T> +length_impl(T X) { + return __builtin_elementwise_abs(X); +} + +template +enable_if_t::value || is_same::value, T> +

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/121611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SPIRV] Add Target Builtins using Distance ext as an example (PR #121598)

2025-01-06 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/121598 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SPIRV] Add Target Builtins using Distance ext as an example (PR #121598)

2025-01-06 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl closed https://github.com/llvm/llvm-project/pull/121598 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SPIRV] Add Target Builtins using Distance ext as an example (PR #121598)

2025-01-06 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/121598 >From 74f86806bbdf1397973f70043ce0856bc6a4a4a7 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Fri, 3 Jan 2025 14:52:31 -0500 Subject: [PATCH 1/2] [SPIRV] Add Target Builtins using Distance ext as an example

[clang] [llvm] [SPIRV] Add Target Builtins using Distance ext as an example (PR #121598)

2025-01-06 Thread Farzon Lotfi via cfe-commits
farzonl wrote: @Endilll It looks like you are the code owner for `/clang/include/clang/Sema/Sema.h` Are you happy with these changes? https://github.com/llvm/llvm-project/pull/121598 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://list

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2024-12-27 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/120367 >From d72983f1666cc6952edd9a721a4f1dc2d1a5a8ed Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Wed, 18 Dec 2024 01:44:42 -0500 Subject: [PATCH 1/2] [Clang] Add float type support to __builtin_reduce_add and _

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2024-12-26 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/120367 >From d72983f1666cc6952edd9a721a4f1dc2d1a5a8ed Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Wed, 18 Dec 2024 01:44:42 -0500 Subject: [PATCH 1/2] [Clang] Add float type support to __builtin_reduce_add and _

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2024-12-26 Thread Farzon Lotfi via cfe-commits
@@ -4274,12 +4274,37 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, *this, E, GetIntrinsicID(E->getArg(0)->getType()), "rdx.min")); } - case Builtin::BI__builtin_reduce_add: + case Builtin::BI__builtin_reduce_add: { +// Not

[clang] [clang] Improve diagnostics for vector builtins (PR #125673)

2025-02-04 Thread Farzon Lotfi via cfe-commits
farzonl wrote: This PR has me thinking about a related problem. In HLSL we have elementwise builtins like `__builtin_hlsl_elementwise_frac`. We do not add the `CustomTypeChecking` attribute to these builtins. This puts us down the variadic type check rules for scalar inputs to these builtins

[clang] [clang] Improve diagnostics for vector builtins (PR #125673)

2025-02-04 Thread Farzon Lotfi via cfe-commits
@@ -2393,8 +2395,10 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { if (CheckVectorElementCallArgs(&SemaRef, TheCall)) return true; if (SemaRef.BuiltinElementwiseTernaryMath( -TheCall, /*CheckForFloatArgs*/ -

[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

2025-02-04 Thread Farzon Lotfi via cfe-commits
@@ -10623,7 +10623,7 @@ def err_second_argument_to_cwsc_not_pointer : Error< "second argument to __builtin_call_with_static_chain must be of pointer type">; def err_vector_incorrect_num_elements : Error< - "%select{too many|too few}0 elements in vector %select{initializat

[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

2025-02-04 Thread Farzon Lotfi via cfe-commits
@@ -19105,6 +19105,51 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, return nullptr; switch (BuiltinID) { + case Builtin::BI__builtin_hlsl_adduint64: { farzonl wrote: So while HLSL does not support pointers we do have a concept of

[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

2025-02-04 Thread Farzon Lotfi via cfe-commits
@@ -10623,7 +10623,7 @@ def err_second_argument_to_cwsc_not_pointer : Error< "second argument to __builtin_call_with_static_chain must be of pointer type">; def err_vector_incorrect_num_elements : Error< - "%select{too many|too few}0 elements in vector %select{initializat

[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

2025-02-07 Thread Farzon Lotfi via cfe-commits
@@ -19105,6 +19105,51 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, return nullptr; switch (BuiltinID) { + case Builtin::BI__builtin_hlsl_adduint64: { farzonl wrote: So the downside of what I suggested is that it would be a hybrid

[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

2025-02-07 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl deleted https://github.com/llvm/llvm-project/pull/125319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

2025-02-05 Thread Farzon Lotfi via cfe-commits
@@ -12553,6 +12553,8 @@ def err_std_initializer_list_malformed : Error< "%0 layout not recognized. Must be a non-polymorphic class type with no bases and two fields: a 'const E *' and either another 'const E *' or a 'std::size_t'">; // HLSL Diagnostics +def err_hlsl_adduin

[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

2025-02-05 Thread Farzon Lotfi via cfe-commits
@@ -10623,7 +10623,7 @@ def err_second_argument_to_cwsc_not_pointer : Error< "second argument to __builtin_call_with_static_chain must be of pointer type">; def err_vector_incorrect_num_elements : Error< - "%select{too many|too few}0 elements in vector %select{initializat

[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

2025-02-05 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/125319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Change clang Driver Options to not set CXXOperatorNames (PR #126758)

2025-02-11 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl created https://github.com/llvm/llvm-project/pull/126758 - Disable `CXXOperatorNames` for HLSL - Add tests to confirm we can use the alt names as functions >From 3b7e458bfeb2abab799789d30ebaa4b214e4168e Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Tue, 11 Feb 20

[clang] [HLSL] Change clang Driver Options to not set CXXOperatorNames (PR #126758)

2025-02-11 Thread Farzon Lotfi via cfe-commits
farzonl wrote: Is it ok to keep the tests as check-label? Tests are still passing with Label? Or should this change to `// CHECK: FunctionDecl {{.*}} NAME void ()` Which is how it seems other tests are setup. https://github.com/llvm/llvm-project/pull/126758

[clang] [HLSL] Change clang Driver Options to not set CXXOperatorNames (PR #126758)

2025-02-11 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/126758 >From 3b7e458bfeb2abab799789d30ebaa4b214e4168e Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Tue, 11 Feb 2025 11:07:23 -0500 Subject: [PATCH 1/2] [HLSL] Change clang Driver Options to not set CXXOperatorNam

[clang] [llvm] Reland "[HLSL] Implement the reflect HLSL function" (PR #125599)

2025-02-11 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,177 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -O1 -o - | FileChe

[clang] [HLSL] Change clang Driver Options to not set CXXOperatorNames (PR #126758)

2025-02-11 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/126758 >From 3b7e458bfeb2abab799789d30ebaa4b214e4168e Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Tue, 11 Feb 2025 11:07:23 -0500 Subject: [PATCH 1/3] [HLSL] Change clang Driver Options to not set CXXOperatorNam

[clang] [HLSL] Change clang Driver Options to not set CXXOperatorNames (PR #126758)

2025-02-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl closed https://github.com/llvm/llvm-project/pull/126758 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Set Shader Flag DisableOptimizations (PR #126813)

2025-02-12 Thread Farzon Lotfi via cfe-commits
@@ -212,20 +230,24 @@ PreservedAnalyses ShaderFlagsAnalysisPrinter::run(Module &M, bool ShaderFlagsAnalysisWrapper::runOnModule(Module &M) { DXILResourceTypeMap &DRTM = getAnalysis().getResourceTypeMap(); + const ModuleMetadataInfo MMDI = + getAnalysis().getModul

[clang] [llvm] [DirectX] Set Shader Flag DisableOptimizations (PR #126813)

2025-02-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl approved this pull request. https://github.com/llvm/llvm-project/pull/126813 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Set Shader Flag DisableOptimizations (PR #126813)

2025-02-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/126813 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl deleted https://github.com/llvm/llvm-project/pull/123977 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Set Shader Flag DisableOptimizations (PR #126813)

2025-02-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl approved this pull request. https://github.com/llvm/llvm-project/pull/126813 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/123977 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/123977 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-12 Thread Farzon Lotfi via cfe-commits
@@ -2064,6 +2064,9 @@ llvm::Value *CodeGenFunction::EmitToMemory(llvm::Value *Value, QualType Ty) { if (Ty->isExtVectorBoolType()) { farzonl wrote: you replaced a bunch of `isExtVectorBoolType()` with `isPackedVectorBoolType`. We are only doing HLSL modif

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/123977 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Set Shader Flag DisableOptimizations (PR #126813)

2025-02-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/126813 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-12 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl deleted https://github.com/llvm/llvm-project/pull/123977 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-12 Thread Farzon Lotfi via cfe-commits
@@ -2064,6 +2064,9 @@ llvm::Value *CodeGenFunction::EmitToMemory(llvm::Value *Value, QualType Ty) { if (Ty->isExtVectorBoolType()) { farzonl wrote: you replaced a bunch of `isExtVectorBoolType()` with `isPackedVectorBoolType`. We are only doing HLSL modif

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2024-12-18 Thread Farzon Lotfi via cfe-commits
@@ -1754,6 +1755,17 @@ static bool interp__builtin_vector_reduce(InterpState &S, CodePtr OpPC, PrimType ElemT = *S.getContext().classify(ElemType); unsigned NumElems = Arg.getNumElems(); + if (ElemType->isRealFloatingType()) { +if (ID != Builtin::BI__builtin_reduce_a

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2024-12-18 Thread Farzon Lotfi via cfe-commits
farzonl wrote: @RKSimon It looks like you started this work with: 1. a23291b7db48670f7c57adcfb45877c826a97f22 2. 8a92c45e07dc81c83ca3afda3971d98c512429d4 If you have time could you take a look and let me know what you think? https://github.com/llvm/llvm-project/pull/120367 ___

[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)

2024-12-18 Thread Farzon Lotfi via cfe-commits
@@ -6,7 +6,7 @@ // CHECK: %conv2 = fptrunc double %hlsl.dot to float // CHECK: ret float %conv2 float builtin_bool_to_float_type_promotion ( float p0, bool p1 ) { - return __builtin_hlsl_dot ( p0, p1 ); + return __builtin_hlsl_dot ( (double)p0, (double)p1 );

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2024-12-18 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/120367 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2024-12-17 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl created https://github.com/llvm/llvm-project/pull/120367 None >From bcc2e3e36bd179047237da3ca495220a542dc742 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Wed, 18 Dec 2024 01:44:42 -0500 Subject: [PATCH] [Clang] Add float type support to __builtin_reduce_add and

[clang] [NFC][HLSL] Allow target intrinsic switching to optionally be set. (PR #117648)

2024-12-17 Thread Farzon Lotfi via cfe-commits
@@ -30,22 +30,36 @@ #include #include +#define GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(FunctionName, \ + IntrinsicPostfix) \ + GENERATE_HLSL_INTRINSIC_FUNCTION(FunctionName, IntrinsicPostfix, 1,

[clang] [NFC][HLSL] Allow target intrinsic switching to optionally be set. (PR #117648)

2024-12-17 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl closed https://github.com/llvm/llvm-project/pull/117648 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2024-12-17 Thread Farzon Lotfi via cfe-commits
@@ -1754,6 +1755,17 @@ static bool interp__builtin_vector_reduce(InterpState &S, CodePtr OpPC, PrimType ElemT = *S.getContext().classify(ElemType); unsigned NumElems = Arg.getNumElems(); + if (ElemType->isRealFloatingType()) { +if (ID != Builtin::BI__builtin_reduce_a

[clang] [llvm] [HLSL] Implement WaveActiveAnyTrue intrinsic (PR #115902)

2024-11-21 Thread Farzon Lotfi via cfe-commits
@@ -1949,24 +1949,36 @@ bool SPIRVInstructionSelector::selectSign(Register ResVReg, return Result; } +bool SPIRVInstructionSelector::selectWaveOpInst(Register ResVReg, +const SPIRVType *ResType, +

[clang] [HLSL] Implement a header only distance intrinsic (PR #117240)

2024-11-21 Thread Farzon Lotfi via cfe-commits
@@ -853,6 +853,45 @@ float3 degrees(float3); _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_degrees) float4 degrees(float4); +//===--===// +// distance builtins +//===--

[clang] [HLSL] Implement a header only distance intrinsic (PR #117240)

2024-11-21 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl created https://github.com/llvm/llvm-project/pull/117240 - For the HLSL intrinsic used `const inline` because that seems to be the pattern `countbits` - For the helper functions the pattern in `hlsl_detail.h` was to do `constexpr` like with `bit_cast` and `enable_

[clang] [HLSL] Implement the HLSL distance intrinsic (PR #122357)

2025-01-09 Thread Farzon Lotfi via cfe-commits
@@ -871,6 +871,34 @@ float3 degrees(float3); _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_degrees) float4 degrees(float4); +//===--===// +// distance builtins +//===--

[clang] [llvm] [HLSL] Reapply Move length support out of the DirectX Backend (#121611) (PR #122337)

2025-01-09 Thread Farzon Lotfi via cfe-commits
farzonl wrote: @llvm-beanz I'm really confused what is going on here The length test case passes in the github action: https://github.com/llvm/llvm-project/actions/runs/12699150463?pr=122337 It passes locally on: 1. MacOS Intel (Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz) 2. MacOS Apple M3 Max

[clang] [llvm] [HLSL] Reapply Move length support out of the DirectX Backend (#121611) (PR #122337)

2025-01-09 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/122337 >From a7323e97f09db476e622bee9800e1b3e15441beb Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Thu, 9 Jan 2025 13:11:52 -0500 Subject: [PATCH 1/2] [HLSL] Move length support out of the DirectX Backend (#1216

[clang] [HLSL] Implement the HLSL distance intrinsic (PR #122357)

2025-01-09 Thread Farzon Lotfi via cfe-commits
@@ -871,6 +871,34 @@ float3 degrees(float3); _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_degrees) float4 degrees(float4); +//===--===// +// distance builtins +//===--

[clang] [HLSL] Implement the HLSL distance intrinsic (PR #122357)

2025-01-09 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122357 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the HLSL distance intrinsic (PR #122357)

2025-01-09 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/122357 >From 88e0035ca1c5b326a1579bc777c926c3c48c5c89 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Thu, 9 Jan 2025 14:55:40 -0500 Subject: [PATCH] [HLSL] Implement the HLSL distance intrinsic - Hook of SPIRV buil

[clang] [HLSL] Implement the HLSL distance intrinsic (PR #122357)

2025-01-09 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122357 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the HLSL distance intrinsic (PR #122357)

2025-01-09 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122357 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the HLSL distance intrinsic (PR #122357)

2025-01-09 Thread Farzon Lotfi via cfe-commits
@@ -871,6 +871,34 @@ float3 degrees(float3); _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_degrees) float4 degrees(float4); +//===--===// +// distance builtins +//===--

[clang] [HLSL] cbuffer: Create host layout structs (PR #122820)

2025-01-22 Thread Farzon Lotfi via cfe-commits
@@ -253,12 +257,229 @@ static void validatePackoffset(Sema &S, HLSLBufferDecl *BufDecl) { } } +// Returns true if the array has a zero size = if any of the dimensions is 0 +static bool isZeroSizedArray(const ConstantArrayType *CAT) { + while (CAT && !CAT->isZeroSize()) +

[clang] [HLSL] cbuffer: Create host layout structs (PR #122820)

2025-01-22 Thread Farzon Lotfi via cfe-commits
@@ -253,12 +257,229 @@ static void validatePackoffset(Sema &S, HLSLBufferDecl *BufDecl) { } } +// Returns true if the array has a zero size = if any of the dimensions is 0 +static bool isZeroSizedArray(const ConstantArrayType *CAT) { + while (CAT && !CAT->isZeroSize()) +

[clang] [HLSL] cbuffer: Create host layout structs (PR #122820)

2025-01-22 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] cbuffer: Create host layout structs (PR #122820)

2025-01-22 Thread Farzon Lotfi via cfe-commits
@@ -253,12 +257,229 @@ static void validatePackoffset(Sema &S, HLSLBufferDecl *BufDecl) { } } +// Returns true if the array has a zero size = if any of the dimensions is 0 +static bool isZeroSizedArray(const ConstantArrayType *CAT) { + while (CAT && !CAT->isZeroSize()) +

[clang] [llvm] Reland "[HLSL] Implement the `reflect` HLSL function" (PR #123853)

2025-01-22 Thread Farzon Lotfi via cfe-commits
farzonl wrote: @inbelic look into lit `UNSUPPORTED` or `REQUIRES:` There is likely one or a combination of both we can do to avoid the asan tests. https://github.com/llvm/llvm-project/pull/123853 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-21 Thread Farzon Lotfi via cfe-commits
@@ -34,6 +34,7 @@ #include "llvm/IR/IntrinsicsSPIRV.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" farzonl wrote: Not sure why you need an include your changes to `selectExtInst` are the same

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-21 Thread Farzon Lotfi via cfe-commits
@@ -3030,6 +3031,15 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, return selectExtInst(ResVReg, ResType, I, CL::fract, GL::Fract); case Intrinsic::spv_normalize: return selectExtInst(ResVReg, ResType, I, CL::normalize, GL::Normalize); + case In

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-21 Thread Farzon Lotfi via cfe-commits
@@ -3030,6 +3039,8 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, return selectExtInst(ResVReg, ResType, I, CL::fract, GL::Fract); case Intrinsic::spv_normalize: return selectExtInst(ResVReg, ResType, I, CL::normalize, GL::Normalize); + case Int

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-21 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl approved this pull request. LGTM, but I want to see the `[[maybe_unused]]` and the `#include "llvm/Support/raw_ostream.h"` removed before you merge. https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing li

[clang] [HLSL] cbuffer: Create host layout structs (PR #122820)

2025-01-22 Thread Farzon Lotfi via cfe-commits
@@ -253,12 +257,229 @@ static void validatePackoffset(Sema &S, HLSLBufferDecl *BufDecl) { } } +// Returns true if the array has a zero size = if any of the dimensions is 0 +static bool isZeroSizedArray(const ConstantArrayType *CAT) { + while (CAT && !CAT->isZeroSize()) +

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
farzonl wrote: > Will a follow-up issue be created to move the useful `Sema` helpers into a > common file? I'm fine if you want to do this as a follow up. https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@list

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
farzonl wrote: > This pr LGTM once the graceful exit comment is handled. > > With respect to [this > comment](https://github.com/llvm/llvm-project/pull/122992#discussion_r1917127000). > Is the final solution to just gracefully exit or is this an intermediate > step and an issue will be used t

[clang] [HLSL][Sema] Fixed Diagnostics that assumed only two arguments (PR #122772)

2025-01-17 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl closed https://github.com/llvm/llvm-project/pull/122772 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-18 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,22 @@ +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o /dev/null 2>&1 | FileCheck %s +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o /dev/null 2>&1 | FileCheck %s +; RUN: not %if spirv-tools %{ llc -O0 -

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl edited https://github.com/llvm/llvm-project/pull/122992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,22 @@ +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o /dev/null 2>&1 | FileCheck %s +; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o /dev/null 2>&1 | FileCheck %s +; RUN: not %if spirv-tools %{ llc -O0 -

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
@@ -3030,6 +3031,15 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, return selectExtInst(ResVReg, ResType, I, CL::fract, GL::Fract); case Intrinsic::spv_normalize: return selectExtInst(ResVReg, ResType, I, CL::normalize, GL::Normalize); + case In

[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)

2025-01-17 Thread Farzon Lotfi via cfe-commits
@@ -0,0 +1,32 @@ +// 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 farzonl wrote: The clang codgen tests should be suf

[clang] [llvm] [SPIRV] add pre legalization instruction combine (PR #122839)

2025-01-17 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl closed https://github.com/llvm/llvm-project/pull/122839 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SPIRV] add pre legalization instruction combine (PR #122839)

2025-01-17 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/122839 >From fb1c27ea34d42b9c141fe9a2d1a5ad8584dfa0a0 Mon Sep 17 00:00:00 2001 From: Farzon Lotfi Date: Thu, 9 Jan 2025 19:19:27 -0500 Subject: [PATCH 1/7] [SPIRV] add pre legalization instruction combine - Add the bo

[clang] [llvm] Reland "[HLSL] Implement the `reflect` HLSL function" (PR #123853)

2025-01-21 Thread Farzon Lotfi via cfe-commits
farzonl wrote: redundant is not the right word here. Irrelevant or not necessary makes more sense in this context. https://github.com/llvm/llvm-project/pull/123853 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [llvm] Reland "[HLSL] Implement the `reflect` HLSL function" (PR #123853)

2025-01-21 Thread Farzon Lotfi via cfe-commits
https://github.com/farzonl approved this pull request. I'm only reviewing commit def10ad82c6e527ba5c3aa29b76041dc94acff1d The reasoning for the change\fix makes sense. Although I don't like the commit message. You don't need to amend the commit, but use the github ui to fix up the commit mess

<    5   6   7   8   9   10   11   12   13   14   >