[clang] [llvm] [HLSL] Implement SV_GroupThreadId semantic (PR #117781)

2024-12-09 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. I think it's good, with minor nit about unnecessary comments. https://github.com/llvm/llvm-project/pull/117781 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [llvm] [HLSL] Implement SV_GroupThreadId semantic (PR #117781)

2024-12-09 Thread Tex Riddell via cfe-commits
@@ -2851,7 +2851,21 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, .constrainAllUses(TII, TRI, RBI); break; case Intrinsic::spv_thread_id: -return selectSpvThreadId(ResVReg, ResType, I); +// The HLSL SV_DispatchThreadID semantic is

[clang] [llvm] [HLSL] Implement SV_GroupThreadId semantic (PR #117781)

2024-12-06 Thread Tex Riddell via cfe-commits
@@ -3606,6 +3613,32 @@ bool SPIRVInstructionSelector::selectSpvThreadId(Register ResVReg, return Result && MIB.constrainAllUses(TII, TRI, RBI); } +bool SPIRVInstructionSelector::selectSpvThreadId(Register ResVReg, + const SPIR

[clang] [llvm] [HLSL] Implement SV_GroupThreadId semantic (PR #117781)

2024-12-06 Thread Tex Riddell via cfe-commits
@@ -3606,6 +3613,32 @@ bool SPIRVInstructionSelector::selectSpvThreadId(Register ResVReg, return Result && MIB.constrainAllUses(TII, TRI, RBI); } +bool SPIRVInstructionSelector::selectSpvThreadId(Register ResVReg, + const SPIR

[clang] [llvm] [HLSL] Implement SV_GroupThreadId semantic (PR #117781)

2024-12-06 Thread Tex Riddell via cfe-commits
@@ -3606,6 +3613,32 @@ bool SPIRVInstructionSelector::selectSpvThreadId(Register ResVReg, return Result && MIB.constrainAllUses(TII, TRI, RBI); } +bool SPIRVInstructionSelector::selectSpvThreadId(Register ResVReg, + const SPIR

[clang] [HLSL] Implement SV_GroupThreadId semantic (PR #117781)

2024-12-04 Thread Tex Riddell via cfe-commits
@@ -2,15 +2,18 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-mesh -hlsl-entry CSMain -x hlsl -finclude-default-header -verify -o - %s [numthreads(8,8,1)] -// expected-error@+3 {{attribute 'SV_GroupIndex' is unsupported in 'mesh' shaders, requires compute}} -// expect

[clang] [HLSL] Implement SV_GroupThreadId semantic (PR #117781)

2024-12-04 Thread Tex Riddell via cfe-commits
@@ -49,3 +49,28 @@ void CSMain3_GID(uint3 : SV_GroupID) { // CHECK-NEXT: ParmVarDecl 0x{{[0-9a-fA-F]+}} <{{.*}}> col:24 'uint3' // CHECK-NEXT: HLSLSV_GroupIDAttr } + +[numthreads(8,8,1)] +void CSMain_GThreadID(uint ID : SV_GroupThreadID) { +// CHECK: FunctionDecl 0x{{[0-9a-fA-F

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

2024-12-02 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. LGTM. 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] [HLSL] Forward arguments in BuiltinTypeMethodBuilder::callBuiltin. NFC (PR #117789)

2024-11-26 Thread Tex Riddell via cfe-commits
@@ -564,9 +585,9 @@ struct BuiltinTypeMethodBuilder { OK_Ordinary); } - BuiltinTypeMethodBuilder & - callBuiltin(StringRef BuiltinName, ArrayRef CallParms, - bool AddResourceHandleAsFirstArg = true) { + template + Built

[clang] [HLSL] Forward arguments in BuiltinTypeMethodBuilder::callBuiltin. NFC (PR #117789)

2024-11-26 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. Looks good. https://github.com/llvm/llvm-project/pull/117789 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement SV_GroupID semantic (PR #115911)

2024-11-26 Thread Tex Riddell via cfe-commits
https://github.com/tex3d closed https://github.com/llvm/llvm-project/pull/115911 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-25 Thread Tex Riddell via cfe-commits
@@ -271,53 +246,70 @@ struct BuiltinTypeDeclBuilder { return *this; } + FieldDecl *getResourceHandleField() { +FieldDecl *FD = Fields["h"]; tex3d wrote: I thought `lookup` was right: https://github.com/llvm/llvm-project/blob/30af6fb163add17a6be5152

[clang] [HLSL] Implement SV_GroupID semantic (PR #115911)

2024-11-25 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. I think this will do for now, since most of this will have to be reworked for general semantics support anyway. https://github.com/llvm/llvm-project/pull/115911 ___ cfe-commits mailing list cfe-comm

[clang] [llvm] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-12 Thread Tex Riddell via cfe-commits
https://github.com/tex3d closed https://github.com/llvm/llvm-project/pull/113636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-12 Thread Tex Riddell via cfe-commits
https://github.com/tex3d edited https://github.com/llvm/llvm-project/pull/113636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-11 Thread Tex Riddell via cfe-commits
https://github.com/tex3d updated https://github.com/llvm/llvm-project/pull/113636 >From 661bd4ceba1e60bc12e1e85bffc53edfd13f5494 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 15 Oct 2024 16:18:44 -0700 Subject: [PATCH 1/6] Emit constrained atan2 intrinsic for clang builtin This change

[clang] [llvm] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-11 Thread Tex Riddell via cfe-commits
https://github.com/tex3d updated https://github.com/llvm/llvm-project/pull/113636 >From a6776121bb118fe4083ccb94fa582cca1aef7f9b Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 15 Oct 2024 16:18:44 -0700 Subject: [PATCH 1/6] Emit constrained atan2 intrinsic for clang builtin This change

[clang] [llvm] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-11 Thread Tex Riddell via cfe-commits
https://github.com/tex3d updated https://github.com/llvm/llvm-project/pull/113636 >From a6776121bb118fe4083ccb94fa582cca1aef7f9b Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 15 Oct 2024 16:18:44 -0700 Subject: [PATCH 1/4] Emit constrained atan2 intrinsic for clang builtin This change

[clang] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-11 Thread Tex Riddell via cfe-commits
tex3d wrote: @farzonl > Here are just a handful of tests that we might want to update, but there are > others: I'm updating these tests that were called out. What others do I need to look for? How do I know if I've found all the tests I need to update? https://github.com/llvm/llvm-project/

[clang] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-11 Thread Tex Riddell via cfe-commits
@@ -13,7 +13,7 @@ using size_t = unsigned long; #endif // SPIR } // namespace std -float __builtin_atan2f(float, float); +float __builtin_erff(float); tex3d wrote: Right, I hope I captured that in the PR description above. If that's not clear enough let me

[clang] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-08 Thread Tex Riddell via cfe-commits
https://github.com/tex3d edited https://github.com/llvm/llvm-project/pull/113636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -553,3 +748,20 @@ void HLSLExternalSemaSource::CompleteType(TagDecl *Tag) { return; It->second(Record); } + +static FunctionDecl *lookupBuiltinFunction(Sema &S, StringRef Name) { + IdentifierInfo &II = + S.getASTContext().Idents.get(Name, tok::TokenKind::identifi

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -35,6 +35,9 @@ def int_dx_typedBufferLoad_checkbit def int_dx_typedBufferStore : DefaultAttrsIntrinsic<[], [llvm_any_ty, llvm_i32_ty, llvm_anyvector_ty]>; +def int_dx_bufferUpdateCounter +: DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_any_ty, llvm_i32_ty], [IntrWrite

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -emit-llvm-only -disable-llvm-passes -verify + +using handle_t = __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(int)]]; tex3d wrote:

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -2161,6 +2186,22 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_buffer_update_counter: { +if (SemaRef.checkArgCount(TheCall, 2) || +CheckResourceHandle(&Sema

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
https://github.com/tex3d deleted https://github.com/llvm/llvm-project/pull/114148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
https://github.com/tex3d deleted https://github.com/llvm/llvm-project/pull/114148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -2161,6 +2186,22 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_buffer_update_counter: { +if (SemaRef.checkArgCount(TheCall, 2) || +CheckResourceHandle(&Sema

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -1880,6 +1880,31 @@ static bool CheckVectorSelect(Sema *S, CallExpr *TheCall) { return false; } +static bool CheckResourceHandle(Sema *S, CallExpr *TheCall, unsigned ArgIndex) { + assert(TheCall->getNumArgs() >= ArgIndex); + QualType ArgType = TheCall->getArg(ArgIndex

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -2161,6 +2186,22 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_buffer_update_counter: { +if (SemaRef.checkArgCount(TheCall, 2) || +CheckResourceHandle(&Sema

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -553,3 +748,20 @@ void HLSLExternalSemaSource::CompleteType(TagDecl *Tag) { return; It->second(Record); } + +static FunctionDecl *lookupBuiltinFunction(Sema &S, StringRef Name) { + IdentifierInfo &II = + S.getASTContext().Idents.get(Name, tok::TokenKind::identifi

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -343,27 +336,224 @@ struct TemplateParameterListBuilder { Params.clear(); QualType T = Builder.Template->getInjectedClassNameSpecialization(); -T = S.Context.getInjectedClassNameType(Builder.Record, T); +T = AST.getInjectedClassNameType(Builder.Record, T);

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -343,27 +336,224 @@ struct TemplateParameterListBuilder { Params.clear(); QualType T = Builder.Template->getInjectedClassNameSpecialization(); -T = S.Context.getInjectedClassNameType(Builder.Record, T); +T = AST.getInjectedClassNameType(Builder.Record, T);

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -343,27 +336,224 @@ struct TemplateParameterListBuilder { Params.clear(); QualType T = Builder.Template->getInjectedClassNameSpecialization(); -T = S.Context.getInjectedClassNameType(Builder.Record, T); +T = AST.getInjectedClassNameType(Builder.Record, T);

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -271,53 +246,70 @@ struct BuiltinTypeDeclBuilder { return *this; } + FieldDecl *getResourceHandleField() { +FieldDecl *FD = Fields["h"]; tex3d wrote: Won't this add "h" when accessed this way? How about: ```suggestion FieldDecl *FD = Fields.

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -109,22 +116,16 @@ struct BuiltinTypeDeclBuilder { } BuiltinTypeDeclBuilder & - addHandleMember(Sema &S, ResourceClass RC, ResourceKind RK, bool IsROV, - bool RawBuffer, + addHandleMember(ResourceClass RC, ResourceKind RK, bool IsROV, bool RawBuffer,

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -4883,6 +4882,12 @@ def HLSLRadians : LangBuiltin<"HLSL_LANG"> { let Prototype = "void(...)"; } +def HLSLBufferUpdateCounter : LangBuiltin<"HLSL_LANG"> { + let Spellings = ["__builtin_hlsl_buffer_update_counter"]; + let Attributes = [NoThrow]; + let Prototype = "uint32

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-07 Thread Tex Riddell via cfe-commits
@@ -343,27 +336,224 @@ struct TemplateParameterListBuilder { Params.clear(); QualType T = Builder.Template->getInjectedClassNameSpecialization(); -T = S.Context.getInjectedClassNameType(Builder.Record, T); +T = AST.getInjectedClassNameType(Builder.Record, T);

[clang] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-06 Thread Tex Riddell via cfe-commits
https://github.com/tex3d updated https://github.com/llvm/llvm-project/pull/113636 >From a6776121bb118fe4083ccb94fa582cca1aef7f9b Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 15 Oct 2024 16:18:44 -0700 Subject: [PATCH 1/3] Emit constrained atan2 intrinsic for clang builtin This change

[clang] [HLSL][NFC] Cleanup - removed unused function, includes and param, fix typos (PR #113649)

2024-11-04 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. https://github.com/llvm/llvm-project/pull/113649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-04 Thread Tex Riddell via cfe-commits
https://github.com/tex3d edited https://github.com/llvm/llvm-project/pull/113636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-11-04 Thread Tex Riddell via cfe-commits
https://github.com/tex3d edited https://github.com/llvm/llvm-project/pull/113636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add CHECK-LABEL to avoid source tree path sensitivity in test (PR #112461)

2024-10-31 Thread Tex Riddell via cfe-commits
https://github.com/tex3d closed https://github.com/llvm/llvm-project/pull/112461 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-10-28 Thread Tex Riddell via cfe-commits
https://github.com/tex3d updated https://github.com/llvm/llvm-project/pull/113636 >From 7c7b72b48e07e0f34c2ee65e11e70db37f8c88b3 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 15 Oct 2024 16:18:44 -0700 Subject: [PATCH 1/3] Emit constrained atan2 intrinsic for clang builtin This change

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-25 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,126 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-25 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,133 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-24 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-10-24 Thread Tex Riddell via cfe-commits
https://github.com/tex3d updated https://github.com/llvm/llvm-project/pull/113636 >From 0c9dfb67a7371b9c4087d7b54e6f93e780038117 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 15 Oct 2024 16:18:44 -0700 Subject: [PATCH 1/3] Emit constrained atan2 intrinsic for clang builtin This change

[clang] Emit constrained atan2 intrinsic for clang builtin (PR #113636)

2024-10-24 Thread Tex Riddell via cfe-commits
https://github.com/tex3d created https://github.com/llvm/llvm-project/pull/113636 This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - `Builtins.td` - Add f16 support for libm atan2 builtin - `CGBuiltin.cpp` - Emit constraint atan2 intrinsic fo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-24 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -verify + +void test_no_second_arg(double D) { + __builtin_hlsl_elementwise_splitdouble(D); + // expected-error@-1 {{too few arguments to function call, exp

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-24 Thread Tex Riddell via cfe-commits
https://github.com/tex3d requested changes to this pull request. https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -2074,6 +2083,19 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_elementwise_splitdouble: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +if (Che

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,99 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,98 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,133 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [HLSL] Add RWStructuredBuffer definition to HLSLExternalSemaSource (PR #113477)

2024-10-23 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. Looks good. https://github.com/llvm/llvm-project/pull/113477 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,144 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,54 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; Make sure lowering is correctly generating spirv code. + +; CH

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,98 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,98 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-ll

[clang] [HLSL] Add RWStructuredBuffer definition to HLSLExternalSemaSource (PR #113477)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -17,7 +17,7 @@ // EMPTY-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <> Implicit final // There should be no more occurrances of StructuredBuffer -// EMPTY-NOT: StructuredBuffer +// EMPTY-NOT: {{^\W}}StructuredBuffer tex3d wrote: By the way, my suggestion of `{{[^W]

[clang] [HLSL] Add RWStructuredBuffer definition to HLSLExternalSemaSource (PR #113477)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -17,7 +17,7 @@ // EMPTY-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <> Implicit final // There should be no more occurrances of StructuredBuffer -// EMPTY-NOT: StructuredBuffer +// EMPTY-NOT: {{^\W}}StructuredBuffer tex3d wrote: This still doesn't look right. Did

[clang] [HLSL] Add RWStructuredBuffer definition to HLSLExternalSemaSource (PR #113477)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -17,7 +17,7 @@ // EMPTY-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <> Implicit final // There should be no more occurrances of StructuredBuffer -// EMPTY-NOT: StructuredBuffer +// EMPTY-NOT: {{/s}}StructuredBuffer tex3d wrote: Oh yeah, I think you could also use `

[clang] [HLSL] Add RWStructuredBuffer definition to HLSLExternalSemaSource (PR #113477)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,70 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-compute -finclude-default-header -fnative-half-type -emit-llvm -o - %s | FileCheck %s + +// NOTE: The number in type name and whether the struct is packed or not will mostly +// likely change once subscript oper

[clang] [HLSL] Add RWStructuredBuffer definition to HLSLExternalSemaSource (PR #113477)

2024-10-23 Thread Tex Riddell via cfe-commits
@@ -17,7 +17,7 @@ // EMPTY-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <> Implicit final // There should be no more occurrances of StructuredBuffer -// EMPTY-NOT: StructuredBuffer +// EMPTY-NOT: {{/s}}StructuredBuffer tex3d wrote: How do you know that "/s" is space?

[clang] [HLSL] Change StructuredBuffer resource class to SRV (PR #113397)

2024-10-23 Thread Tex Riddell via cfe-commits
https://github.com/tex3d approved this pull request. https://github.com/llvm/llvm-project/pull/113397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,50 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; Make sure lowering is correctly generating spirv code. + +; CH

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,102 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-l

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -2074,6 +2083,35 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_elementwise_splitdouble: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +Expr *O

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -5149,6 +5152,9 @@ class CodeGenFunction : public CodeGenTypeCache { SourceLocation ArgLoc, AbstractCallee AC, unsigned ParmNum); + /// EmitWriteback - Emit callbacks for function. + void EmitWritebacks(CodeGenFunction

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -4681,6 +4676,12 @@ void CallArg::copyInto(CodeGenFunction &CGF, Address Addr) const { IsUsed = true; } +void CodeGenFunction::EmitWritebacks(CodeGenFunction &CGF, + const CallArgList &args) { + for (const auto &I : args.writebacks())

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-22 Thread Tex Riddell via cfe-commits
@@ -95,6 +99,157 @@ static void initializeAlloca(CodeGenFunction &CGF, AllocaInst *AI, Value *Size, I->addAnnotationMetadata("auto-init"); } +static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) { + Value *Op0 = CGF->EmitScalarExpr(E->getArg(0)); +

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,50 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; Make sure lowering is correctly generating spirv code. ---

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -1698,18 +1698,27 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) { return true; } -static bool CheckArgsTypesAreCorrect( +bool CheckArgTypeIsIncorrect( tex3d wrote: This switches the naming pattern from the existing convention. W

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -0,0 +1,50 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; Make sure lowering is correctly generating spirv code. ---

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -438,6 +438,24 @@ template constexpr uint asuint(T F) { return __detail::bit_cast(F); } +//===--===// +// asuint splitdouble builtins +//===---

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -4871,6 +4871,12 @@ def HLSLRadians : LangBuiltin<"HLSL_LANG"> { let Prototype = "void(...)"; } +def HLSLSplitDouble: LangBuiltin<"HLSL_LANG"> { + let Spellings = ["__builtin_hlsl_splitdouble"]; tex3d wrote: Are we inconsistent on the use of "elementwis

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -2074,6 +2083,35 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_splitdouble: { +if (SemaRef.checkArgCount(TheCall, 3)) + return true; + +Expr *Op0 = TheCall

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { + +assert((E->getArg(0)->getType()->hasFlo

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -18952,6 +18955,142 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_splitdouble: { tex3d wrote: This is quite a

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -4681,6 +4601,87 @@ void CallArg::copyInto(CodeGenFunction &CGF, Address Addr) const { IsUsed = true; } +/// Emit the actual writing-back of a writeback. +void CodeGenFunction::EmitWriteback(CodeGenFunction &CGF, tex3d wrote: Moving this function makes

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-10-18 Thread Tex Riddell via cfe-commits
@@ -5149,6 +5152,12 @@ class CodeGenFunction : public CodeGenTypeCache { SourceLocation ArgLoc, AbstractCallee AC, unsigned ParmNum); + /// EmitWriteback - Emit callbacks for function. + void EmitWritebacks(CodeGenFunctio

[clang] Add CHECK-LABEL to avoid source tree path sensitivity in test (PR #112461)

2024-10-15 Thread Tex Riddell via cfe-commits
https://github.com/tex3d created https://github.com/llvm/llvm-project/pull/112461 The test `clang/test/CodeGen/2004-02-20-Builtins.c` will erroneously fail if "builtin" is in the path to your source tree. This change adds a `CHECK-LABEL !llvm.ident` after the `CHECK-NOT` to avoid searching in

[clang] [llvm] [HLSL] Implement `WaveReadLaneAt` intrinsic (PR #111010)

2024-10-07 Thread Tex Riddell via cfe-commits
@@ -2015,6 +2015,13 @@ _HLSL_AVAILABILITY(shadermodel, 6.0) _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_is_first_lane) __attribute__((convergent)) bool WaveIsFirstLane(); +// \brief Returns the value of the expression for the given lane index within +// the specified wave. +templa

[clang] [Clang] Add __builtin_(elementwise|reduce)_(max|min)imum (PR #110198)

2024-10-01 Thread Tex Riddell via cfe-commits
tex3d wrote: > But IIUC, the diagnostic message change from this PR might be unintentional. > The expected error message in > [793ded7](https://github.com/llvm/llvm-project/commit/793ded7d0b7f1407636a98007f83074b8dd5f765) > doesn't align to the error message from other tests in the same file.

[clang] [Clang] Add __builtin_(elementwise|reduce)_(max|min)imum (PR #110198)

2024-10-01 Thread Tex Riddell via cfe-commits
tex3d wrote: Unfortunately, I didn't see your revert, and my pull didn't show any changes from main before I quickly committed the test change. So my test change would also break the build with your revert. So I reverted the test change just now! Revert: 5d308af894ccc3f7a288d6abd6f9097b4cbc8

[clang] [Clang] Add __builtin_(elementwise|reduce)_(max|min)imum (PR #110198)

2024-10-01 Thread Tex Riddell via cfe-commits
tex3d wrote: Test fix has re-landed: fea18afeed39fe4435d67eee1834f0f34b23013d. https://github.com/llvm/llvm-project/pull/110198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] fea18af - Fix failing test caused by b70d327

2024-10-01 Thread Tex Riddell via cfe-commits
Author: Tex Riddell Date: 2024-10-01T18:26:05-07:00 New Revision: fea18afeed39fe4435d67eee1834f0f34b23013d URL: https://github.com/llvm/llvm-project/commit/fea18afeed39fe4435d67eee1834f0f34b23013d DIFF: https://github.com/llvm/llvm-project/commit/fea18afeed39fe4435d67eee1834f0f34b23013d.diff L

[clang] [Clang] Add __builtin_(elementwise|reduce)_(max|min)imum (PR #110198)

2024-10-01 Thread Tex Riddell via cfe-commits
tex3d wrote: I just pushed a fix for the test: https://github.com/llvm/llvm-project/commit/793ded7d0b7f1407636a98007f83074b8dd5f765 https://github.com/llvm/llvm-project/pull/110198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [Clang] Add __builtin_(elementwise|reduce)_(max|min)imum (PR #110198)

2024-10-01 Thread Tex Riddell via cfe-commits
tex3d wrote: Oh dang. That's why I didn't see an update. Because the revert wasn't pushed to llvm/main, it was a revert on another repo. Looks like I could re-apply the test fix again unless you're planning on doing a revert on llvm/main. https://github.com/llvm/llvm-project/pull/110198 ___

[clang] [Clang] Add __builtin_(elementwise|reduce)_(max|min)imum (PR #110198)

2024-10-01 Thread Tex Riddell via cfe-commits
tex3d wrote: You should be able to re-land your change if you add the test fix to it. https://github.com/llvm/llvm-project/pull/110198 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   >