[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

2024-12-22 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/118569 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

2024-12-22 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. This mostly looks good to me. I have a few style nits to use more idomatic patterns and conform better to LLVM coding standards. https://github.com/llvm/llvm-project/pull/118569 ___ cfe-commits

[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

2024-12-22 Thread Chris B via cfe-commits
@@ -761,7 +762,37 @@ void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, return false; if (!isInsideMainFile(FixIt.RemoveRange.getBegin(), SM)) return false; - Edits.push_back(toTextEdit(FixIt, SM, *LangOpts)); + + auto R = too

[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

2024-12-22 Thread Chris B via cfe-commits
@@ -149,26 +149,12 @@ class ErrorReporter { Repl.getLength(), Repl.getReplacementText()); auto &Entry = FileReplacements[R.getFilePath()]; Replacements &Replacements = Entry.Replaces; -llvm::Error Err = Rep

[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

2024-12-22 Thread Chris B via cfe-commits
@@ -342,6 +342,20 @@ llvm::Error Replacements::add(const Replacement &R) { return llvm::Error::success(); } +llvm::Error Replacements::addOrMerge(const Replacement &R) { + auto Err = add(R); + if (Err) { llvm-beanz wrote: nit: You could rewrite this as: `

[clang] [llvm] Revert #116331 & #121852 (PR #122105)

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

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

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

[clang] [llvm] Revert #116331 & #121852 (PR #122105)

2025-01-08 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/122105 #116331 introduced a regression in DXIL testing, and did not address all PR feedback before merging. @joaosaffran is looking at the regression tracked in #122052 and will re-land these changes with that fix

[clang] Deprecate order file instrumentation (PR #121514)

2025-01-08 Thread Chris B via cfe-commits
@@ -8010,15 +8010,19 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } } - if (Args.hasArg(options::OPT_forder_file_instrumentation)) { - CmdArgs.push_back("-forder-file-instrumentation"); - // Enable order file instrumentation when ThinLTO is

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes with test fixes (PR #122157)

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

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

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

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

2025-01-09 Thread Chris B via cfe-commits
llvm-beanz wrote: > No failures. We would need to have tests for all intrinsics that if its not > SM 6.2 or greater uses of half would error, but we never did that for any of > the other intrinsics so we should probably discuss what the test coverage > should be and apply it broadly. In pract

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

2025-01-22 Thread Chris B 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-23 Thread Chris B 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][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-01-23 Thread Chris B via cfe-commits
@@ -0,0 +1,96 @@ +//===--- ParseHLSLRootSignature.h ---*- C++ -*-===// +// +// 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][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-01-23 Thread Chris B via cfe-commits
llvm-beanz wrote: As I said in your other PR, I believe not including error reporting and the appropriate testing makes it significantly more difficult to review the subsequent commit since not all the appropriate code will even be in the PR. https://github.c

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-01-23 Thread Chris B via cfe-commits
@@ -0,0 +1,133 @@ +//=== 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. +// SPDX-License-Identifier: Ap

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

2025-01-23 Thread Chris B via cfe-commits
@@ -1461,6 +1552,7 @@ static bool castPreservesZero(const CastExpr *CE) { case CK_NonAtomicToAtomic: case CK_AtomicToNonAtomic: case CK_HLSLVectorTruncation: + case CK_HLSLAggregateCast: // TODO does CK_HLSLAggregateCast preserve zero? llvm-beanz wrote:

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

2025-01-23 Thread Chris B via cfe-commits
@@ -707,6 +707,7 @@ ExprResult Sema::ImpCastExprToType(Expr *E, QualType Ty, case CK_ToVoid: case CK_NonAtomicToAtomic: case CK_HLSLArrayRValue: +case CK_HLSLAggregateCast: llvm-beanz wrote: Nope, this cast should not ever be implicit. https:/

[clang] [HLSL] Implement D3DCOLORtoUBYTE4 intrinsic (PR #122202)

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

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

2025-01-14 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: We talked about this yesterday in a call with @Keenuts and @s-perron. I think one of the problems we have with HLSL is that we haven't had explicit address space annotations except for `groupshared` in the past. We do need to do that in the future, but

[clang] [HLSL] cbuffer: Create host layout struct and add resource handle to AST (PR #122820)

2025-01-14 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: The one design question I have here is: should we be bothering to create a handle for the cbuffer in the frontend at all? My thought had been that we would instead emit the cbuffer member declarations as constant address space (2 for DXIL) declarations

[clang] [HLSL] cbuffer: Create host layout struct and add resource handle to AST (PR #122820)

2025-01-14 Thread Chris B via cfe-commits
https://github.com/llvm-beanz 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 struct and add resource handle to AST (PR #122820)

2025-01-14 Thread Chris B via cfe-commits
@@ -253,12 +257,253 @@ 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 elementwise firstbitlow builtin (PR #116858)

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

[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

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

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

2025-01-14 Thread Chris B via cfe-commits
@@ -2752,7 +2787,17 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { llvm::Value *Zero = llvm::Constant::getNullValue(CGF.SizeTy); return Builder.CreateExtractElement(Vec, Zero, "cast.vtrunc"); } + case CK_HLSLAggregateCast: { +RValue RV = CGF.EmitAnyEx

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

2025-01-14 Thread Chris B via cfe-commits
@@ -491,6 +491,81 @@ static bool isTrivialFiller(Expr *E) { return false; } +// emit a flat cast where the RHS is a scalar, including vector +static void EmitHLSLScalarFlatCast(CodeGenFunction &CGF, Address DestVal, + QualType DestTy, llvm::

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

2025-01-14 Thread Chris B via cfe-commits
@@ -6358,3 +6359,89 @@ RValue CodeGenFunction::EmitPseudoObjectRValue(const PseudoObjectExpr *E, LValue CodeGenFunction::EmitPseudoObjectLValue(const PseudoObjectExpr *E) { return emitPseudoObjectExpr(*this, E, true, AggValueSlot::ignored()).LV; } + +void CodeGenFunction::Fl

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

2025-01-14 Thread Chris B via cfe-commits
@@ -2412,6 +2412,102 @@ bool SemaHLSL::CheckCompatibleParameterABI(FunctionDecl *New, return HadError; } +// Generally follows PerformScalarCast, with cases reordered for +// clarity of what types are supported +bool SemaHLSL::CanPerformScalarCast(QualType SrcTy, QualType D

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

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

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

2025-01-14 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: I want to spend a little more time going over the tests, but I had a few small comments. This seems to be mostly right from my initial review. https://github.com/llvm/llvm-project/pull/118842 ___ cfe-commits ma

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

2025-01-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/123141 This PR implements HLSL's initialization list behvaior as specified in the draft language specifcation under [*Decl.Init.Agg*](https://microsoft.github.io/hlsl-specs/specs/hlsl.html #Decl.Init.Agg). This be

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

2025-01-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited 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 HLSL Flat casting (excluding splat cases) (PR #118842)

2025-01-16 Thread Chris B via cfe-commits
@@ -2412,6 +2412,102 @@ bool SemaHLSL::CheckCompatibleParameterABI(FunctionDecl *New, return HadError; } +// Generally follows PerformScalarCast, with cases reordered for +// clarity of what types are supported +bool SemaHLSL::CanPerformScalarCast(QualType SrcTy, QualType D

[clang] [HLSL] cbuffer: Create host layout struct and add resource handle to AST (PR #122820)

2025-01-16 Thread Chris B via cfe-commits
llvm-beanz wrote: > I was kind of hoping we might be able to generate the accesses off a handle > during codegen when the global is accessed. I'm not sure if that's possible > though. I'm concerned that this will be more complex to make work with the other CBV syntaxes. For example, the impli

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

2025-01-16 Thread Chris B via cfe-commits
llvm-beanz wrote: A couple notes for myself: * I need to write some AST tests * Also need to write tests to cover bit fields and unions. https://github.com/llvm/llvm-project/pull/123141 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[clang] [HLSL] Make bool in hlsl i32 (PR #122977)

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

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

2025-02-12 Thread Chris B via cfe-commits
llvm-beanz wrote: > > How does it not duplicate sub-expressions while also not creating temporary > > variables to capture results? > > The way I thought of to comprehensively solve this in a clear general way was > to: > > * create a new temporary with an anonymous struct type containing the

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-12 Thread Chris B via cfe-commits
@@ -0,0 +1,166 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace clang { +namespace hlsl { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO(#126565): extend for float support exponents + return isdigit(C); // integer support +} + +bool RootS

[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 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 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 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
@@ -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] [llvm] [HLSL] [DXIL] Implement the AddUint64 HLSL function and the UAddc DXIL op (PR #127137)

2025-02-14 Thread Chris B via cfe-commits
@@ -2229,6 +2241,41 @@ static bool CheckResourceHandle( // returning an ExprError bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { switch (BuiltinID) { + case Builtin::BI__builtin_hlsl_adduint64: { +if (SemaRef.checkArgCount(TheCall, 2))

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

2025-02-14 Thread Chris B via cfe-commits
@@ -10655,6 +10655,8 @@ def err_second_argument_to_cwsc_not_pointer : Error< def err_vector_incorrect_num_elements : Error< "%select{too many|too few}0 elements in vector %select{initialization|operand}3 (expected %1 elements, have %2)">; +def err_invalid_even_odd_vector_el

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

2025-02-14 Thread Chris B via cfe-commits
@@ -2229,6 +2241,41 @@ static bool CheckResourceHandle( // returning an ExprError bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { switch (BuiltinID) { + case Builtin::BI__builtin_hlsl_adduint64: { +if (SemaRef.checkArgCount(TheCall, 2))

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

2025-02-14 Thread Chris B via cfe-commits
https://github.com/llvm-beanz 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-14 Thread Chris B via cfe-commits
@@ -2064,6 +2064,9 @@ llvm::Value *CodeGenFunction::EmitToMemory(llvm::Value *Value, QualType Ty) { if (Ty->isExtVectorBoolType()) { llvm::Type *StoreTy = convertTypeForLoadStore(Ty, Value->getType()); +if (getLangOpts().HLSL) llvm-beanz wrote: Do

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

2025-02-14 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: I commented on the first two that I saw, but I think there are a lot of places left where you're conditionalizing the CodeGen behavior on HLSL, that we could instead make the condition based on the types involved requiring conversions. https://github.co

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

2025-02-14 Thread Chris B via cfe-commits
@@ -2081,6 +2084,9 @@ llvm::Value *CodeGenFunction::EmitToMemory(llvm::Value *Value, QualType Ty) { llvm::Value *CodeGenFunction::EmitFromMemory(llvm::Value *Value, QualType Ty) { if (Ty->isExtVectorBoolType()) { const auto *RawIntTy = Value->getType(); +if (getLangO

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

2025-02-14 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] 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
@@ -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

[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] 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] 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] 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 HLSL intialization list support (PR #123141)

2025-02-11 Thread Chris B via cfe-commits
@@ -2576,3 +2576,162 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) { } } } + +static bool CastInitializer(Sema &S, ASTContext &Ctx, Expr *E, +llvm::SmallVectorImpl &List, +llvm::SmallVectorImpl &DestT

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

2025-02-11 Thread Chris B via cfe-commits
llvm-beanz wrote: I did find a bug in this for handling data structures with resources... I'm working on it and will update the PR when I have a fix. https://github.com/llvm/llvm-project/pull/123141 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[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
@@ -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 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] 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] 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] [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] [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] [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] 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] 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] 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] 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 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 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] [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] 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] 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] [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] [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 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] 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 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] 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] 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] 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] 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] 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] 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] [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] 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] 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-17 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/6] [HLSL] Handle incomplete array types This refactors the

[clang] [HLSL][RootSignature] Define and integrate rootsig clang attr and decl (PR #137690)

2025-04-30 Thread Chris B via cfe-commits
@@ -949,6 +950,23 @@ void SemaHLSL::emitLogicalOperatorFixIt(Expr *LHS, Expr *RHS, << NewFnName << FixItHint::CreateReplacement(FullRange, OS.str()); } +void SemaHLSL::handleRootSignatureAttr(Decl *D, const ParsedAttr &AL) { + if (AL.getNumArgs() != 1) { +Diag(AL.g

[clang] [HLSL][RootSignature] Define and integrate rootsig clang attr and decl (PR #137690)

2025-04-30 Thread Chris B via cfe-commits
@@ -3037,6 +3037,11 @@ void TextNodeDumper::VisitHLSLBufferDecl(const HLSLBufferDecl *D) { dumpName(D); } +void TextNodeDumper::VisitHLSLRootSignatureDecl( +const HLSLRootSignatureDecl *D) { + dumpName(D); llvm-beanz wrote: We should think through how

<    4   5   6   7   8   9   10   >