[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-09-19 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/106146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-09-19 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/106146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-09-19 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106146 >From 40224473a7b43bc4ffe2024ab51196c2130bedc7 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 25 Aug 2024 12:00:03 -0600 Subject: [PATCH 1/2] [DirectX] Remove trivially dead functions at linkage finalize

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-09-20 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106146 >From 40224473a7b43bc4ffe2024ab51196c2130bedc7 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 25 Aug 2024 12:00:03 -0600 Subject: [PATCH 1/3] [DirectX] Remove trivially dead functions at linkage finalize

[clang] [llvm] Add cross builtins and cross HLSL function to DirectX and SPIR-V backend (PR #109180)

2024-10-02 Thread Greg Roth via cfe-commits
https://github.com/pow2clk approved this pull request. Looks good to me. I just have a couple nits that you might include if you create another commit for another reason. https://github.com/llvm/llvm-project/pull/109180 ___ cfe-commits mailing list c

[clang] [llvm] Add cross builtins and cross HLSL function to DirectX and SPIR-V backend (PR #109180)

2024-10-02 Thread Greg Roth via cfe-commits
@@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected pow2clk wrote: Is this producing or expected to produce unexpected diagnostics? I s

[clang] [llvm] Add cross builtins and cross HLSL function to DirectX and SPIR-V backend (PR #109180)

2024-10-02 Thread Greg Roth via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ +// RUN: --check-prefixes=CHECK,NATIVE_HALF \ +// RUN: -DFNATTRS=n

[clang] [llvm] Add cross builtins and cross HLSL function to DirectX and SPIR-V backend (PR #109180)

2024-10-02 Thread Greg Roth via cfe-commits
@@ -74,6 +75,42 @@ static Value *expandAbs(CallInst *Orig) { "dx.max"); } +static Value *expandCrossIntrinsic(CallInst *Orig) { + + VectorType *VT = cast(Orig->getType()); + if (cast(VT)->getNumElements() != 3) +report_fatal_error(Twine("

[clang] [llvm] Add cross builtins and cross HLSL function to DirectX and SPIR-V backend (PR #109180)

2024-10-02 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/109180 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_u8packed` intrinsic (PR #115068)

2024-11-06 Thread Greg Roth via cfe-commits
https://github.com/pow2clk commented: A nitpick, a comment, and a question. https://github.com/llvm/llvm-project/pull/115068 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_u8packed` intrinsic (PR #115068)

2024-11-06 Thread Greg Roth via cfe-commits
@@ -0,0 +1,65 @@ +; RUN: llc -O0 -mtriple=spirv1.5-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-EXP +; RUN: llc -O0 -mtriple=spirv1.6-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-DOT +; RUN: llc -O0 -mtriple=spirv-unknown-unknown -s

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_u8packed` intrinsic (PR #115068)

2024-11-06 Thread Greg Roth via cfe-commits
@@ -942,7 +942,13 @@ uint64_t dot(uint64_t4, uint64_t4); _HLSL_AVAILABILITY(shadermodel, 6.4) _HLSL_BUILTIN_ALIAS(__builtin_hlsl_dot4add_i8packed) -int dot4add_i8packed(unsigned int, unsigned int, int); +int dot4add_i8packed(uint, uint, int); pow2clk wrote: I

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_u8packed` intrinsic (PR #115068)

2024-11-06 Thread Greg Roth via cfe-commits
@@ -0,0 +1,18 @@ + +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-compute %s -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s -DTARGET=dx +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: spirv-pc-vulkan-co

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_u8packed` intrinsic (PR #115068)

2024-11-06 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/115068 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add Append/ConsumeStructuredBuffer definitions to HLSLExternalSemaSource (PR #113643)

2024-11-07 Thread Greg Roth via cfe-commits
@@ -0,0 +1,50 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY %s | FileCheck -check-prefix=EMPTY %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump %s | FileCheck %s + + +// This test tests two different AST ge

[clang] [HLSL] Add Append/ConsumeStructuredBuffer definitions to HLSLExternalSemaSource (PR #113643)

2024-11-07 Thread Greg Roth via cfe-commits
https://github.com/pow2clk commented: Looks good overall. I am worried about that typedbuffer enum though. Perhaps it doesn't have much impact as of yet, but perhaps we need to change some conditionals to accept structuredbuffer enums where appropriate. https://github.com/llvm/llvm-project/pul

[clang] [HLSL] Add Append/ConsumeStructuredBuffer definitions to HLSLExternalSemaSource (PR #113643)

2024-11-07 Thread Greg Roth via cfe-commits
@@ -530,6 +530,28 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() { .addArraySubscriptOperators() .completeDefinition(); }); + + Decl = + BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace, "AppendStructuredBuffer") + .addS

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

2024-11-07 Thread Greg Roth 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 Greg Roth 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)]]; + +void test_args(int x, bool b

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

2024-11-07 Thread Greg Roth 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 Greg Roth via cfe-commits
@@ -271,53 +246,70 @@ struct BuiltinTypeDeclBuilder { return *this; } + FieldDecl *getResourceHandleField() { +FieldDecl *FD = Fields["h"]; +assert(FD && FD->getType()->isHLSLAttributedResourceType() && + "record does not have resource handle"); +r

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

2024-11-07 Thread Greg Roth via cfe-commits
@@ -271,53 +246,70 @@ struct BuiltinTypeDeclBuilder { return *this; } + FieldDecl *getResourceHandleField() { +FieldDecl *FD = Fields["h"]; +assert(FD && FD->getType()->isHLSLAttributedResourceType() && + "record does not have resource handle"); +r

[clang] [HLSL] Add Append/ConsumeStructuredBuffer definitions to HLSLExternalSemaSource (PR #113643)

2024-11-07 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/113643 ___ 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 Greg Roth via cfe-commits
https://github.com/pow2clk commented: #113648 is merged. Should probably update the description as I think the corresponding inclusion of ROV buffers went in too. I haven't finished my review, but I thought I'd get these two points in quickly. https://github.com/llvm/llvm-project/pull/114148 _

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

2024-11-07 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited 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 Greg Roth 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, Const]; po

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

2024-11-07 Thread Greg Roth via cfe-commits
@@ -0,0 +1,771 @@ +//===--- HLSLExternalSemaSource.cpp - HLSL Sema Source ===// pow2clk wrote: I don't think this file should be here. https://github.com/llvm/llvm-project/pull/114148 ___ cfe-commi

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-17 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106146 >From 40224473a7b43bc4ffe2024ab51196c2130bedc7 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 25 Aug 2024 12:00:03 -0600 Subject: [PATCH 1/6] [DirectX] Remove trivially dead functions at linkage finalize

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-17 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106146 >From 40224473a7b43bc4ffe2024ab51196c2130bedc7 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 25 Aug 2024 12:00:03 -0600 Subject: [PATCH 1/7] [DirectX] Remove trivially dead functions at linkage finalize

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

2024-11-19 Thread Greg Roth via cfe-commits
https://github.com/pow2clk approved this pull request. Thanks for the fixups! https://github.com/llvm/llvm-project/pull/115902 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] set alwaysinline on HLSL functions (PR #106588)

2024-09-17 Thread Greg Roth via cfe-commits
https://github.com/pow2clk closed https://github.com/llvm/llvm-project/pull/106588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] update StructuredBuffer subscript test for alwaysinline (PR #109023)

2024-09-17 Thread Greg Roth via cfe-commits
https://github.com/pow2clk created https://github.com/llvm/llvm-project/pull/109023 The Alwaysinline change made the mangled form of entry points get removed. The StructuredBuffer-subscript.hlsl test was introduced in the meantime depending on that version of the entry point. This revises it i

[clang] [HLSL] update StructuredBuffer subscript test for alwaysinline (PR #109023)

2024-09-17 Thread Greg Roth via cfe-commits
https://github.com/pow2clk closed https://github.com/llvm/llvm-project/pull/109023 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] set alwaysinline on HLSL functions (PR #106588)

2024-09-17 Thread Greg Roth via cfe-commits
pow2clk wrote: Sorry I didn't mention here that the fix was in. It looks like everything is clean now? https://github.com/llvm/llvm-project/pull/106588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

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

2024-11-15 Thread Greg Roth via cfe-commits
@@ -1949,6 +1952,22 @@ bool SPIRVInstructionSelector::selectSign(Register ResVReg, return Result; } +bool SPIRVInstructionSelector::selectWaveActiveAnyTrue(Register ResVReg, + const SPIRVType *ResType, +

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

2024-11-15 Thread Greg Roth via cfe-commits
@@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -finclude-default-header -fnative-half-type -triple \ +// RUN: dxil-pc-shadermodel6.3-compute %s -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK,CHECK-DXIL +// RUN: %clang_cc1 -finclude-default-header

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

2024-11-15 Thread Greg Roth via cfe-commits
@@ -1995,7 +2014,7 @@ bool SPIRVInstructionSelector::selectWaveReadLaneAt(Register ResVReg, TII.get(SPIRV::OpGroupNonUniformShuffle)) .addDef(ResVReg) .addUse(GR.getSPIRVTypeID(ResType)) - .addUse(GR.getOrCreateConstInt(3, I, IntTy, TII)) +

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

2024-11-15 Thread Greg Roth via cfe-commits
@@ -0,0 +1,17 @@ +; 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 %} + +; CHECK: %[[#bool:]] = OpTypeBool +; CHECK: %[[#uint:]] = OpType

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

2024-11-15 Thread Greg Roth via cfe-commits
@@ -0,0 +1,17 @@ +; 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 %} + +; CHECK: %[[#bool:]] = OpTypeBool +; CHECK: %[[#uint:]] = OpType

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

2025-01-06 Thread Greg Roth via cfe-commits
https://github.com/pow2clk commented: I think we require descriptions and not just titles. https://github.com/llvm/llvm-project/pull/121611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

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

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

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

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

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

2025-01-06 Thread Greg Roth via cfe-commits
pow2clk wrote: Thanks for the description. I would find some justification useful even if it just repeats the reasoning we've established for all such changes. https://github.com/llvm/llvm-project/pull/121611 ___ cfe-commits mailing list cfe-commits@l

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

2025-01-06 Thread Greg Roth via cfe-commits
@@ -1,73 +1,151 @@ -// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ -// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ -// RUN: --check-prefixes=CHECK,NATIVE_HALF -// RUN: %clang_cc1 -

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

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

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

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

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

2025-01-06 Thread Greg Roth via cfe-commits
pow2clk wrote: Will this go in with no description? https://github.com/llvm/llvm-project/pull/121611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    1   2   3