[clang] [llvm] [HLSL][RootSignature] Add infastructure to parse parameters (PR #133800)

2025-04-10 Thread Chris B via cfe-commits
@@ -89,37 +88,178 @@ bool RootSignatureParser::parseDescriptorTableClause() { CurToken.TokKind == TokenKind::kw_UAV || CurToken.TokKind == TokenKind::kw_Sampler) && "Expects to only be invoked starting at given keyword"); + TokenKind ParamKind = Cu

[clang] [HLSL] Add support for modulo of floating point scalar and vectors (PR #135125)

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

[clang] [HLSL] Add support for modulo of floating point scalar and vectors (PR #135125)

2025-04-10 Thread Chris B via cfe-commits
@@ -3964,6 +3964,8 @@ Value *ScalarExprEmitter::EmitRem(const BinOpInfo &Ops) { if (Ops.Ty->hasUnsignedIntegerRepresentation()) return Builder.CreateURem(Ops.LHS, Ops.RHS, "rem"); + else if (CGF.getLangOpts().HLSL && Ops.Ty->hasFloatingRepresentation()) +return Buil

[clang] [llvm] [HLSL][RootSignature] Add infastructure to parse parameters (PR #133800)

2025-04-09 Thread Chris B via cfe-commits
@@ -89,37 +88,178 @@ bool RootSignatureParser::parseDescriptorTableClause() { CurToken.TokKind == TokenKind::kw_UAV || CurToken.TokKind == TokenKind::kw_Sampler) && "Expects to only be invoked starting at given keyword"); + TokenKind ParamKind = Cu

[clang] [HLSL] Handle incomplete array types (PR #133508)

2025-04-08 Thread Chris B via cfe-commits
@@ -3249,166 +3249,204 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) { } } } - -static bool CastInitializer(Sema &S, ASTContext &Ctx, Expr *E, -llvm::SmallVectorImpl &List, -llvm::SmallVectorImpl &Des

[clang] [HLSL] Handle incomplete array types (PR #133508)

2025-04-08 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/133508 >From 6234f442adfebaaf73328d2c09ee443facc848b0 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 27 Mar 2025 09:26:31 -0500 Subject: [PATCH 1/5] [HLSL] Handle incomplete array types This refactors the

[clang] [HLSL] Handle incomplete array types (PR #133508)

2025-04-08 Thread Chris B via cfe-commits
@@ -3249,166 +3249,204 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) { } } } - -static bool CastInitializer(Sema &S, ASTContext &Ctx, Expr *E, -llvm::SmallVectorImpl &List, -llvm::SmallVectorImpl &Des

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

2025-04-08 Thread Chris B via cfe-commits
llvm-beanz wrote: > Given your feedback here it sounds like you want us to drop the template and > allow for implicit vector truncation so that the error will be ambiguous > instead of `call to deleted function 'lit'`? Yes, let's not add compatibility overloads unless we have driving reasons f

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

2025-04-08 Thread Chris B via cfe-commits
@@ -280,6 +280,17 @@ 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][RootSignature] Add infastructure to parse parameters (PR #133800)

2025-04-08 Thread Chris B via cfe-commits
@@ -89,37 +88,178 @@ bool RootSignatureParser::parseDescriptorTableClause() { CurToken.TokKind == TokenKind::kw_UAV || CurToken.TokKind == TokenKind::kw_Sampler) && "Expects to only be invoked starting at given keyword"); + TokenKind ParamKind = Cu

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

2025-04-08 Thread Chris B via cfe-commits
@@ -280,6 +280,17 @@ 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] Desugar ConstantArrayType when calculating cbuffer field layout (PR #134683)

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

[clang] [HLSL] Handle incomplete array types (PR #133508)

2025-04-04 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/133508 This refactors the initialization list transformation code to handle incomplete array types. Fixes #132958 >From 6234f442adfebaaf73328d2c09ee443facc848b0 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date:

[clang] [HLSL] Handle incomplete array types (PR #133508)

2025-03-28 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/133508 >From 6234f442adfebaaf73328d2c09ee443facc848b0 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 27 Mar 2025 09:26:31 -0500 Subject: [PATCH 1/4] [HLSL] Handle incomplete array types This refactors the

[clang] [HLSL] Handle incomplete array types (PR #133508)

2025-03-28 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/133508 >From 6234f442adfebaaf73328d2c09ee443facc848b0 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 27 Mar 2025 09:26:31 -0500 Subject: [PATCH 1/3] [HLSL] Handle incomplete array types This refactors the

[clang] [HLSL] Add WaveReadLaneAt unsigned integer overloads (PR #133520)

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

[clang] [HLSL] Handle incomplete array types (PR #133508)

2025-03-28 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/133508 >From 6234f442adfebaaf73328d2c09ee443facc848b0 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 27 Mar 2025 09:26:31 -0500 Subject: [PATCH 1/2] [HLSL] Handle incomplete array types This refactors the

[clang] [HLSL] add CustomTypeChecking to float builtins (PR #133441)

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

[clang] [HLSL] Add new int overloads for math builtins (PR #133162)

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

[clang] [HLSL] Add new double overloads for math builtins (PR #132979)

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

[clang] [HLSL] Add new double overloads for math builtins (PR #132979)

2025-03-25 Thread Chris B via cfe-commits
@@ -16,6 +16,84 @@ namespace hlsl { // unsigned integer and floating point. Keeping this ordering consistent will // help keep this file manageable as it grows. +#define _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(fn) \ + constexpr float fn(double V) {

[clang] [HLSL] Implement min and max overloads using templates (PR #131666)

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

[clang] [llvm] [HLSL] Add support to branch/flatten attributes to switch (PR #131739)

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

[clang] [HLSL] Finish exposing half types and intrinsics always (PR #132804)

2025-03-24 Thread Chris B via cfe-commits
llvm-beanz wrote: > Finish the work of #81782 Maybe instead: > Apply pattern of #81782 to intrinsics added in #95999. Also probably worth having a description of the problem this solves in the description so that it ends up in the final commit message. https://github.com/llvm/llvm-project/pu

[clang] [HLSL] Finish exposing half types and intrinsics always (PR #132804)

2025-03-24 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: this is not NFC, so we should verify that we can call these intrinsics with `half` values even if 16-bit types aren't enabled, and that they properly codegen to 32-bit variants. https://github.com/llvm/llvm-project/pull/132804 __

[clang] [llvm] [HLSL] Add support to branch/flatten attributes to switch (PR #131739)

2025-03-24 Thread Chris B via cfe-commits
@@ -2276,6 +2276,29 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { // failure. llvm::BasicBlock *DefaultBlock = createBasicBlock("sw.default"); SwitchInsn = Builder.CreateSwitch(CondV, DefaultBlock); + switch (HLSLControlFlowAttr) { + case HLSLControlFl

[clang] [HLSL] Implement min and max overloads using templates (PR #131666)

2025-03-17 Thread Chris B via cfe-commits
@@ -54,5 +54,67 @@ clamp(U p0, V p1, W p2) { return clamp(p0, (U)p1, (U)p2); } +//===--===// +// max builtin overloads +//===--===// + +tem

[clang] [HLSL] add extra scalar vector overloads for clamp (PR #129939)

2025-03-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: One small nit on formatting, otherwise looks good. https://github.com/llvm/llvm-project/pull/129939 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [HLSL] add extra scalar vector overloads for clamp (PR #129939)

2025-03-17 Thread Chris B via cfe-commits
@@ -0,0 +1,59 @@ +//===--- hlsl_compat_overloads.h - Additional HLSL overload definitions for +// intrinsics --===// llvm-beanz wrote: nit: shorten the summary so this fits on one line. https://github.com/llvm/llvm-project/pull/129939 ___

[clang] [HLSL] add extra scalar vector overloads for clamp (PR #129939)

2025-03-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/129939 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] select scalar overloads for vector conditions (PR #129396)

2025-03-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/129396 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] make semantic matching case insensitive (PR #129773)

2025-03-15 Thread Chris B via cfe-commits
@@ -141,6 +141,8 @@ void Parser::ParseHLSLAnnotations(ParsedAttributes &Attrs, return; } + II = PP.getIdentifierInfo(II->getName().lower()); llvm-beanz wrote: Can we keep the original identifier around and use that for the diagnostics so that the diag

[clang] [HLSL] make semantic matching case insensitive (PR #129773)

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

[clang] [HLSL] make semantic matching case insensitive (PR #129773)

2025-03-11 Thread Chris B via cfe-commits
llvm-beanz wrote: > > nit: is there a way to check that the spelling is consistent in the error > > messages? Asking since I am no familiar with this part of the code. > > I'm not sure I understand what you mean. I think the point (and my earlier comment) is to use the spelling as it is writt

[clang] [HLSL][SPIR-V] Add hlsl_private address space for HLSL/SPIR-V (PR #122103)

2025-03-10 Thread Chris B via cfe-commits
Nathan =?utf-8?q?Gauër?= Message-ID: In-Reply-To: llvm-beanz wrote: Is there a reason we can't do this in Sema? It would probably be ideal to have the AST represent the address spaces of values accurately. https://github.com/llvm/llvm-project/pull/122103 _

[clang] [HLSL][Driver] Use temporary files correctly (PR #130436)

2025-03-10 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/130436 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] select scalar overloads for vector conditions (PR #129396)

2025-03-09 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/129396 >From 7620f9fac9932a13f1da0468b02c1aeceb212a0b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 19 Feb 2025 17:18:20 -0600 Subject: [PATCH 1/5] [HLSL] select scalar overloads for vector conditions Th

[clang] [HLSL] select scalar overloads for vector conditions (PR #129396)

2025-03-09 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/129396 >From 7620f9fac9932a13f1da0468b02c1aeceb212a0b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 19 Feb 2025 17:18:20 -0600 Subject: [PATCH 1/6] [HLSL] select scalar overloads for vector conditions Th

[clang] [HLSL] Disallow virtual inheritance and functions (PR #127346)

2025-03-09 Thread Chris B via cfe-commits
@@ -1817,5 +1817,9 @@ def ext_hlsl_access_specifiers : ExtWarn< InGroup; def err_hlsl_unsupported_component : Error<"invalid component '%0' used; expected 'x', 'y', 'z', or 'w'">; def err_hlsl_packoffset_invalid_reg : Error<"invalid resource class specifier '%0' for packoff

[clang] [HLSL] Disallow virtual inheritance and functions (PR #127346)

2025-03-09 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/127346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] select scalar overloads for vector conditions (PR #129396)

2025-03-09 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/129396 >From 7620f9fac9932a13f1da0468b02c1aeceb212a0b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 19 Feb 2025 17:18:20 -0600 Subject: [PATCH 1/4] [HLSL] select scalar overloads for vector conditions Th

[clang] [HLSL] select scalar overloads for vector conditions (PR #129396)

2025-03-08 Thread Chris B via cfe-commits
@@ -0,0 +1,71 @@ +//===- hlsl_intrinsic_helpers.h - HLSL helpers intrinsics -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [HLSL][Driver] Use temporary files correctly (PR #130436)

2025-03-08 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/130436 This updates the DXV and Metal Converter actions to properly use temporary files created by the driver. I've abstracted away a check to determine if an action is the last in the sequence because we may have

[clang] [DXC] Add `-metal` flag to DXC driver (PR #130173)

2025-03-07 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/130173 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] select scalar overloads for vector conditions (PR #129396)

2025-03-07 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/129396 >From 7620f9fac9932a13f1da0468b02c1aeceb212a0b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 19 Feb 2025 17:18:20 -0600 Subject: [PATCH 1/3] [HLSL] select scalar overloads for vector conditions Th

[clang] [HLSL] make semantic matching case insensitive (PR #129773)

2025-03-07 Thread Chris B via cfe-commits
@@ -4790,7 +4790,7 @@ def HLSLPackOffset: HLSLAnnotationAttr { } def HLSLSV_DispatchThreadID: HLSLAnnotationAttr { - let Spellings = [HLSLAnnotation<"SV_DispatchThreadID">]; + let Spellings = [HLSLAnnotation<"sv_dispatchthreadid">]; llvm-beanz wrote: Can we

[clang] [HLSL] select scalar overloads for vector conditions (PR #129396)

2025-03-07 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/129396 >From 999c9253dc69c43f2d5d686bb4e9a9fd2f8783d4 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 19 Feb 2025 17:18:20 -0600 Subject: [PATCH 1/2] [HLSL] select scalar overloads for vector conditions Th

[clang] [DXC] Add `-metal` flag to DXC driver (PR #130173)

2025-03-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/130173 This adds a flag to the DXC driver to enable calling the metal shader converter if it is available to convert the final shader output for metal. >From 0e5a24665c3a9522263b2ddfbce5f46e6a0e33c9 Mon Sep 17 00:0

[clang] [HLSL] error on out of bounds vector accesses (PR #128952)

2025-03-05 Thread Chris B via cfe-commits
@@ -14017,6 +14017,24 @@ void Sema::CheckCastAlign(Expr *Op, QualType T, SourceRange TRange) { << TRange << Op->getSourceRange(); } +void Sema::CheckVectorAccess(const Expr *BaseExpr, const Expr *IndexExpr) { + const VectorType *VTy = BaseExpr->getType()->getAs(); + if

[clang] [HLSL] select scalar overloads for vector conditions (PR #129396)

2025-03-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/129396 This PR adds scalar/vector overloads for vector conditions to the `select` builtin, and updates the sema checking and codegen to allow scalars to extend to vectors. Fixes #126570 >From 999c9253dc69c43f2d5d

[clang] [llvm] [HLSL][RootSignature] Implement Parsing of Descriptor Tables (PR #122982)

2025-03-01 Thread Chris B via cfe-commits
@@ -0,0 +1,375 @@ +//=== ParseHLSLRootSignatureTest.cpp - Parse Root Signature tests -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. llvm-beanz wro

[clang] [llvm] [HLSL][RootSignature] Implement Parsing of Descriptor Tables (PR #122982)

2025-03-01 Thread Chris B via cfe-commits
@@ -0,0 +1,417 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" llvm-beanz wrote: This is the file with the missing license header that @bob80905 pointed out. https://github.com/llvm/llvm-project/pull/122982 ___ cfe

[clang-tools-extra] [clangd] Reduce superfluous rename conflicts (PR #121515)

2025-02-27 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/121515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] error on out of bounds vector accesses (PR #128952)

2025-02-27 Thread Chris B via cfe-commits
@@ -10635,6 +10635,12 @@ def err_block_on_vm : Error< def err_sizeless_nonlocal : Error< "non-local variable with sizeless type %0">; +def err_vector_index_out_of_range : Error< + "vector element index %0 is out of bounds">; +def warn_vector_index_out_of_range : Warning< +

[clang] [HLSL] error on out of bounds vector accesses (PR #128952)

2025-02-27 Thread Chris B via cfe-commits
@@ -14017,6 +14017,24 @@ void Sema::CheckCastAlign(Expr *Op, QualType T, SourceRange TRange) { << TRange << Op->getSourceRange(); } +void Sema::CheckVectorAccess(const Expr *BaseExpr, const Expr *IndexExpr) { + const VectorType *VTy = BaseExpr->getType()->getAs(); + if

[clang] [HLSL] error on out of bounds vector accesses (PR #128952)

2025-02-26 Thread Chris B via cfe-commits
@@ -14017,6 +14017,24 @@ void Sema::CheckCastAlign(Expr *Op, QualType T, SourceRange TRange) { << TRange << Op->getSourceRange(); } +void Sema::CheckVectorAccess(const Expr *BaseExpr, const Expr *IndexExpr) { + const VectorType *VTy = BaseExpr->getType()->getAs(); + if

[clang] Match .exe on Windows (PR #128894)

2025-02-26 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/128894 If you have zlib (not standard) on Windows, this test runs, and it was missing a match for the file extension on lld. >From da4f0de19daaed0a30b3dfe985e6920e89a07c7d Mon Sep 17 00:00:00 2001 From: Chris B Da

[clang] Add unsigned integer overloads for abs (PR #128257)

2025-02-26 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/128257 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add unsigned integer overloads for abs (PR #128257)

2025-02-26 Thread Chris B via cfe-commits
@@ -94,3 +122,60 @@ double3 test_abs_double3(double3 p0) { return abs(p0); } // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x double> @_Z16test_abs_double4 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x double> @llvm.fabs.v4f64( double4 test_abs_double4(double4 p0) {

[clang] [HLSL] Allow EmptyDecl in cbuffer/tbuffer (PR #128250)

2025-02-26 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/128250 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Allow arrays to be returned by value in HLSL (PR #127896)

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

[clang] [test] Remove `-emit-llvm` from the `and-errors.hlsl` test to avoid writing to a potentially write-protected directory (PR #128047)

2025-02-24 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/128047 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Allow arrays to be returned by value in HLSL (PR #127896)

2025-02-24 Thread Chris B via cfe-commits
@@ -2803,6 +2803,10 @@ class ASTContext : public RefCountedBase { return getUnqualifiedArrayType(T, Quals); } + // Determine whether an array is a valid return type + // Array is a valid return type for HLSL + bool isReturnableArrayType() const { return getLangOpts().

[clang] [HLSL] Allow arrays to be returned by value in HLSL (PR #127896)

2025-02-24 Thread Chris B via cfe-commits
@@ -20760,7 +20761,8 @@ ExprResult RebuildUnknownAnyExpr::VisitCallExpr(CallExpr *E) { ExprResult RebuildUnknownAnyExpr::VisitObjCMessageExpr(ObjCMessageExpr *E) { // Verify that this is a legal result type of a call. - if (DestType->isArrayType() || DestType->isFunctionTy

[clang] [HLSL] Allow arrays to be returned by value in HLSL (PR #127896)

2025-02-24 Thread Chris B via cfe-commits
@@ -2803,6 +2803,10 @@ class ASTContext : public RefCountedBase { return getUnqualifiedArrayType(T, Quals); } + // Determine whether an array is a valid return type + // Array is a valid return type for HLSL + bool isReturnableArrayType() const { return getLangOpts().

[clang-tools-extra] [clangd] Reduce superfluous rename conflicts (PR #121515)

2025-02-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. Looks reasonable to me, sorry for the review delay. https://github.com/llvm/llvm-project/pull/121515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] Add unsigned integer overloads for abs (PR #128257)

2025-02-21 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/128257 This seems silly, but DXC supports unsigned integer versions of abs that are just no-ops. This adds the overloads for source compatability because apparently users actually use them... Fixes #128249 >From

[clang] [HLSL] Allow EmptyDecl in cbuffer/tbuffer (PR #128250)

2025-02-21 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/128250 We do handle EmptyDecls in codegen already as of #124886, but we were blocking them in Sema. EmptyDecls tend to be caused by extra semicolons which are not illegal. Fixes #128238 >From 98d8a84c508d743cb366

[clang] [HLSL] add parentheses in assertion to eliminate -Wparentheses warning (PR #128246)

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

[clang] [Clang] Fix segmentation fault caused by `VarBypassDetector` stack overflow on deeply nested expressions (PR #124128)

2025-02-19 Thread Chris B via cfe-commits
@@ -0,0 +1,30 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - -Wstack-exhausted llvm-beanz wrote: What if rather than removing the test we just add a `REQUIRES: slow_tests` line, and have a CMake option to enable the "slow_tests" feature? That would be a really small

[clang] [llvm] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-02-18 Thread Chris B via cfe-commits
@@ -94,6 +94,11 @@ bool Qualifiers::isTargetAddressSpaceSupersetOf(LangAS A, LangAS B, (A == LangAS::Default && (B == LangAS::cuda_constant || B == LangAS::cuda_device || B == LangAS::cuda_shared)) || + // In HLSL, the this pointer for mem

[clang] [HLSL] Allow arrays to copy-initialize (PR #127557)

2025-02-18 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/127557 >From 54ba5ffea82a9613fd343750ec36242e1494f5e4 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 17 Feb 2025 20:41:18 -0600 Subject: [PATCH 1/2] [HLSL] Allow arrays to copy-initialize This change allo

[clang] [HLSL] Allow arrays to copy-initialize (PR #127557)

2025-02-18 Thread Chris B via cfe-commits
@@ -6585,6 +6585,18 @@ void InitializationSequence::InitializeFrom(Sema &S, } } +if (S.getLangOpts().HLSL && Initializer && isa(DestAT)) { llvm-beanz wrote: Looking at this a bit. `canPerformArrayCopy` fails in cases that would otherwise be va

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

2025-02-18 Thread Chris B via cfe-commits
@@ -12411,16 +12411,13 @@ def err_builtin_is_within_lifetime_invalid_arg : Error< "%select{non-|function }0pointer argument to '__builtin_is_within_lifetime' " "is not allowed">; -def err_builtin_invalid_arg_type: Error < - "%ordinal0 argument must be " - "%select{a vec

[clang] [HLSL] Allow arrays to copy-initialize (PR #127557)

2025-02-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/127557 This change allows array variables to copy-initialize from other arrays. It also corrects a small error in HLSL C-Style casting that did not error on casting to arrays if elementwise and splat conversions fa

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-17 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-17 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-17 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-17 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-17 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-17 Thread Chris B via cfe-commits
llvm-beanz wrote: For this issue I think there is a clear path forward to use the utilities that the `__builtin_hlsl_select` builtin uses to validate its arguments. I've filed https://github.com/llvm/llvm-project/issues/127512 to revisit all the other builtins that are using the pattern which

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-17 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-16 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-16 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/127098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-16 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-16 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-15 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-15 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-15 Thread Chris B via cfe-commits
@@ -2245,6 +2245,36 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

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

[clang] [HLSL] Disallow virtual inheritance and functions (PR #127346)

2025-02-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/127346 >From e62dc4bfc4f1cff2a624caf70fcc7bb0dc4a6236 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Sat, 15 Feb 2025 14:34:05 -0600 Subject: [PATCH 1/2] [HLSL] Disallow virtual inheritance and functions This

[clang] [HLSL] Disallow virtual inheritance and functions (PR #127346)

2025-02-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/127346 This PR disallows virtual inheritance and virtual functions in HLSL. >From e62dc4bfc4f1cff2a624caf70fcc7bb0dc4a6236 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Sat, 15 Feb 2025 14:34:05 -0600 Subject

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/123141 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-14 Thread Chris B via cfe-commits
@@ -2079,6 +2079,14 @@ static bool CheckFloatingOrIntRepresentation(Sema *S, CallExpr *TheCall) { checkAllSignedTypes); } +static bool CheckBoolRepresentation(Sema *S, CallExpr *TheCall) { + auto checkAllBoolTypes = [](clang::QualType Pass

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-14 Thread Chris B via cfe-commits
@@ -2245,6 +2245,17 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-14 Thread Chris B via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -O1 -verify + +bool test_too_few_arg(bool a) { + return __builtin_hlsl_and(a); + // expected-error@-1 {{too few arguments to function call

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-14 Thread Chris B via cfe-commits
@@ -2245,6 +2245,17 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } + case Builtin::BI__builtin_hlsl_and: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallArgs(&SemaRef, TheCal

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-14 Thread Chris B via cfe-commits
@@ -1462,6 +1462,14 @@ void CXXRecordDecl::addedMember(Decl *D) { if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal) data().HasInheritedAssignment = true; } + + // HLSL: All user-defined data types are aggregates and use aggregate + // initialization

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-14 Thread Chris B via cfe-commits
@@ -1730,6 +1731,16 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr( } #endif + // HLSL initialization lists in the AST are an expansion which can contain + // side-effecting expressions wrapped in opaque value expressions. To properly + // emit these we need to

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-14 Thread Chris B via cfe-commits
@@ -3173,9 +3173,18 @@ bool SemaHLSL::TransformInitList(const InitializedEntity &Entity, BuildFlattenedTypeList(InitTy, DestTypes); llvm::SmallVector ArgExprs; - for (Expr *Arg : Init->inits()) -if (!BuildInitializerList(SemaRef, Ctx, Arg, ArgExprs, DestTypes)) + fo

  1   2   3   4   5   6   7   8   9   10   >