[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From e994824f3630ee8b224afceb6c14d980c9013112 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Dec 2024 05:14:17 + Subject: [PATCH 01/19] splat cast wip --- clang/include/clang/AST/OperationKinds.def

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/118992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Sarah Spall via cfe-commits
@@ -2527,7 +2527,7 @@ QualType Sema::BuildMatrixType(QualType ElementTy, Expr *NumRows, Expr *NumCols, } bool Sema::CheckFunctionReturnType(QualType T, SourceLocation Loc) { - if (T->isArrayType() || T->isFunctionType()) { + if ((!getLangOpts().HLSL && T->isArrayType()) ||

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Chris B via cfe-commits
@@ -4931,7 +4931,9 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // C99 6.7.5.3p1: The return type may not be a function or array type. // For conversion functions, we'll diagnose this particular error later. - if (!D.isInvali

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Chris B via cfe-commits
@@ -2527,7 +2527,7 @@ QualType Sema::BuildMatrixType(QualType ElementTy, Expr *NumRows, Expr *NumCols, } bool Sema::CheckFunctionReturnType(QualType T, SourceLocation Loc) { - if (T->isArrayType() || T->isFunctionType()) { + if ((!getLangOpts().HLSL && T->isArrayType()) ||

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt approved this pull request. https://github.com/llvm/llvm-project/pull/118992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From e994824f3630ee8b224afceb6c14d980c9013112 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Dec 2024 05:14:17 + Subject: [PATCH 01/18] splat cast wip --- clang/include/clang/AST/OperationKinds.def

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Sarah Spall via cfe-commits
@@ -2804,6 +2804,42 @@ bool SemaHLSL::ContainsBitField(QualType BaseTy) { return false; } +// Can perform an HLSL splat cast if the Dest is an aggregate and the +// Src is a scalar or a vector of length 1 +// Or if Dest is a vector and Src is a vector of length 1 +bool SemaH

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Sarah Spall via cfe-commits
@@ -2804,6 +2804,42 @@ bool SemaHLSL::ContainsBitField(QualType BaseTy) { return false; } +// Can perform an HLSL splat cast if the Dest is an aggregate and the +// Src is a scalar or a vector of length 1 +// Or if Dest is a vector and Src is a vector of length 1 +bool SemaH

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Sarah Spall via cfe-commits
@@ -2804,6 +2804,42 @@ bool SemaHLSL::ContainsBitField(QualType BaseTy) { return false; } +// Can perform an HLSL splat cast if the Dest is an aggregate and the +// Src is a scalar or a vector of length 1 +// Or if Dest is a vector and Src is a vector of length 1 +bool SemaH

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,87 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s + +// array splat +// CHECK-LABEL: define void {{.*}}call4 +// CHECK: [[B:%.*]] = alloca [2 x i32], align 4 +// CHE

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Sarah Spall via cfe-commits
@@ -370,6 +370,9 @@ CAST_OPERATION(HLSLArrayRValue) // Aggregate by Value cast (HLSL only). CAST_OPERATION(HLSLElementwiseCast) +// Splat cast for Aggregates (HLSL only). +CAST_OPERATION(HLSLSplatCast) spall wrote: This cast technically also splats vectors in

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-12 Thread Chris B via cfe-commits
@@ -370,6 +370,9 @@ CAST_OPERATION(HLSLArrayRValue) // Aggregate by Value cast (HLSL only). CAST_OPERATION(HLSLElementwiseCast) +// Splat cast for Aggregates (HLSL only). +CAST_OPERATION(HLSLSplatCast) llvm-beanz wrote: nit: can we call this `HLSLAggregateSpl

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-12 Thread Chris B via cfe-commits
@@ -2804,6 +2804,42 @@ bool SemaHLSL::ContainsBitField(QualType BaseTy) { return false; } +// Can perform an HLSL splat cast if the Dest is an aggregate and the +// Src is a scalar or a vector of length 1 +// Or if Dest is a vector and Src is a vector of length 1 +bool SemaH

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-12 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,87 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s + +// array splat +// CHECK-LABEL: define void {{.*}}call4 +// CHECK: [[B:%.*]] = alloca [2 x i32], align 4 +// CHE

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-12 Thread Ashley Coleman via cfe-commits
@@ -2804,6 +2804,42 @@ bool SemaHLSL::ContainsBitField(QualType BaseTy) { return false; } +// Can perform an HLSL splat cast if the Dest is an aggregate and the +// Src is a scalar or a vector of length 1 +// Or if Dest is a vector and Src is a vector of length 1 +bool SemaH

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-12 Thread Ashley Coleman via cfe-commits
@@ -2804,6 +2804,42 @@ bool SemaHLSL::ContainsBitField(QualType BaseTy) { return false; } +// Can perform an HLSL splat cast if the Dest is an aggregate and the +// Src is a scalar or a vector of length 1 +// Or if Dest is a vector and Src is a vector of length 1 +bool SemaH

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-12 Thread Ashley Coleman via cfe-commits
@@ -491,6 +491,31 @@ static bool isTrivialFiller(Expr *E) { return false; } +static void EmitHLSLSplatCast(CodeGenFunction &CGF, Address DestVal, + QualType DestTy, llvm::Value *SrcVal, + QualType SrcTy, SourceLocatio

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-10 Thread Sarah Spall via cfe-commits
https://github.com/spall ready_for_review https://github.com/llvm/llvm-project/pull/118992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-10 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From e994824f3630ee8b224afceb6c14d980c9013112 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Dec 2024 05:14:17 + Subject: [PATCH 01/13] splat cast wip --- clang/include/clang/AST/OperationKinds.def

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-10 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 2feced1df0aa01f78501720b98faa985bcec846a cadd309a7d7c61a592d11cb306d44139df8d15ee --e

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-10 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From e994824f3630ee8b224afceb6c14d980c9013112 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Dec 2024 05:14:17 + Subject: [PATCH 01/11] splat cast wip --- clang/include/clang/AST/OperationKinds.def

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-08 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From e994824f3630ee8b224afceb6c14d980c9013112 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Dec 2024 05:14:17 + Subject: [PATCH 1/9] splat cast wip --- clang/include/clang/AST/OperationKinds.def |

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2024-12-06 Thread Sarah Spall via cfe-commits
spall wrote: Work for this PR begins at 'splat cast wip' commit. https://github.com/llvm/llvm-project/pull/118992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2024-12-06 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From 2e932a57ccb992b856b58bec4c30c6b64f24f711 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 28 Nov 2024 16:23:57 + Subject: [PATCH 1/8] Flat casts WIP --- clang/include/clang/AST/OperationKinds.def

[clang] [HLSL] Implement HLSL splatting (PR #118992)

2024-12-06 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/118992 Implement HLSL Flat casting that handles splatting for arrays and structs, and vectors if splatting from a vec1. Closes #100609 and Closes #100619 Depends on #118842 >From 2e932a57ccb992b856b58bec4c30c6b64f24f7