[clang] [HLSL] Implement the dst HLSL Function (PR #133828)

2025-04-07 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,57 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.2-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s + + +// CHECK-LABEL: linkonce_odr noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl8__detail8dst

[clang] [HLSL] Implement the dst HLSL Function (PR #133828)

2025-04-07 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,57 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.2-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s + + +// CHECK-LABEL: linkonce_odr noundef nofpclass(nan inf) <4 x float> @_ZN4hlsl8__detail8dst

[clang] [HLSL] Implement the dst HLSL Function (PR #133828)

2025-04-07 Thread Ashley Coleman via cfe-commits
@@ -174,6 +174,31 @@ const inline float distance(__detail::HLSL_FIXED_VECTOR X, __detail::HLSL_FIXED_VECTOR Y) { return __detail::distance_vec_impl(X, Y); } +//===--===//

[clang] [HLSL] Implement the dst HLSL Function (PR #133828)

2025-04-07 Thread Ashley Coleman via cfe-commits
@@ -174,6 +174,31 @@ const inline float distance(__detail::HLSL_FIXED_VECTOR X, __detail::HLSL_FIXED_VECTOR Y) { return __detail::distance_vec_impl(X, Y); } +//===--===// +// dst

[clang] [HLSL] Implement the dst HLSL Function (PR #133828)

2025-04-07 Thread Ashley Coleman via cfe-commits
@@ -174,6 +174,31 @@ const inline float distance(__detail::HLSL_FIXED_VECTOR X, __detail::HLSL_FIXED_VECTOR Y) { return __detail::distance_vec_impl(X, Y); } +//===--===// +// dst

[clang] [llvm] Hlsl asint16 intrinsic (PR #131900)

2025-04-05 Thread Ashley Coleman via cfe-commits
@@ -19,3 +20,12 @@ entry: %res = bitcast half %val2 to i16 ret i16 %res } + +define <4 x i16> @test_vector_half4(<4 x half> nofpclass(nan inf) %p1) { +entry: + ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#vec4_float_16]] + ; CHECK: %[[#Res1:]] = OpBitcast %[[#vec4_int_1

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

2025-04-03 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt closed https://github.com/llvm/llvm-project/pull/131237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

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

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

2025-03-28 Thread Ashley Coleman via cfe-commits
@@ -390,6 +390,18 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, getDotProductIntrinsic(CGM.getHLSLRuntime(), VecTy0->getElementType()), ArrayRef{Op0, Op1}, nullptr, "hlsl.dot"); } + case Builtin::BI__builtin_hlsl_dot2add: { +llvm::Tr

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

2025-03-28 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt edited https://github.com/llvm/llvm-project/pull/131237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

2025-03-28 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,78 @@ +// 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] [NFC][HLSL] Move emitter out of AMDGPU.cpp (PR #133251)

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

[clang] [HLSL][NFC] Refactor HLSLExternalSemaSource (PR #131032)

2025-03-25 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,96 @@ +//===--- HLSLBuiltinTypeDeclBuilder.h - HLSL Builtin Type Decl Builder ---===// +// +// 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] [llvm] Hlsl asuint16 function (PR #132315)

2025-03-21 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt commented: LGTM but I'll let Farzon approve https://github.com/llvm/llvm-project/pull/132315 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Hlsl asuint16 function (PR #132315)

2025-03-21 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt edited https://github.com/llvm/llvm-project/pull/132315 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Hlsl asuint16 function (PR #132315)

2025-03-21 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,52 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.2-library %s -fnative-half-type -verify + +uint16_t test_asuint16_less_argument() +{ +return asuint16(); + // expected-error@-1 {{no matching function for call to 'asuint16'}} + // ex

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

2025-03-21 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,8 @@ +; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-compute %s | FileCheck %s + +define noundef float @dot2add_simple(<2 x half> noundef %a, <2 x half> noundef %b, float %c) { +entry: +; CHECK: call float @dx.op.dot2AddHalf(i32 162, float %c, half %0, h

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

2025-03-20 Thread Ashley Coleman via cfe-commits
@@ -2472,6 +2472,33 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_dot2add: { +// Check number of arguments should be 3 V-FEXrt wrote: Nit: imo this c

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

2025-03-20 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -emit-llvm-only -disable-llvm-passes -verify + +bool test_too_few_arg() { + return __builtin_hlsl_dot2add(); + // expected-error@-1 {{too few arguments to function call, expe

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

2025-03-20 Thread Ashley Coleman via cfe-commits
@@ -19681,6 +19681,21 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, getDotProductIntrinsic(CGM.getHLSLRuntime(), VecTy0->getElementType()), ArrayRef{Op0, Op1}, nullptr, "hlsl.dot"); } + case Builtin::BI__builtin_hlsl_dot2add: { +llvm

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

2025-03-20 Thread Ashley Coleman via cfe-commits
@@ -19681,6 +19681,21 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, getDotProductIntrinsic(CGM.getHLSLRuntime(), VecTy0->getElementType()), ArrayRef{Op0, Op1}, nullptr, "hlsl.dot"); } + case Builtin::BI__builtin_hlsl_dot2add: { +llvm

[clang] [llvm] [HLSL] Implement dot2add intrinsic (PR #131237)

2025-03-20 Thread Ashley Coleman via cfe-commits
@@ -19681,6 +19681,21 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, getDotProductIntrinsic(CGM.getHLSLRuntime(), VecTy0->getElementType()), ArrayRef{Op0, Op1}, nullptr, "hlsl.dot"); } + case Builtin::BI__builtin_hlsl_dot2add: { +llvm

[clang] [HLSL][NFC] Refactor HLSLExternalSemaSource (PR #131032)

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

[clang] [llvm] Hlsl asint16 intrinsic (PR #131900)

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

[clang] [llvm] Hlsl asint16 intrinsic (PR #131900)

2025-03-19 Thread Ashley Coleman via cfe-commits
V-FEXrt wrote: I'm assuming this PR resolves an issue right? We typically add `Fixes #1234` (without the `) as part of the description so it will close the issue when the PR is merged https://github.com/llvm/llvm-project/pull/131900 ___ cfe-commits

[clang] [llvm] [HLSL] Implement explicit layout for default constant buffer ($Globals) (PR #128991)

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

[clang] [llvm] [HLSL] Implement explicit layout for default constant buffer ($Globals) (PR #128991)

2025-03-12 Thread Ashley Coleman via cfe-commits
@@ -174,21 +176,51 @@ createBufferHandleType(const HLSLBufferDecl *BufDecl) { return cast(QT.getTypePtr()); } +// Iterates over all declarations in the HLSL buffer and based on the +// packoffset or register(c#) annotations it fills outs the Layout +// vector with the user-s

[clang] [HLSL] Add "or" intrinsic (PR #128979)

2025-02-28 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt closed https://github.com/llvm/llvm-project/pull/128979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add "or" intrinsic (PR #128979)

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

[clang] [HLSL] Add "or" intrinsic (PR #128979)

2025-02-27 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify -DTEST_FUNC=__builtin_hlsl_or +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify -DTEST_FUNC=__builtin_hlsl_and + + ---

[clang] [HLSL] Add "or" intrinsic (PR #128979)

2025-02-27 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify -DTEST_FUNC=__builtin_hlsl_or +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify -DTEST_FUNC=__builtin_hlsl_and + + +bool t

[clang] [HLSL] Add "or" intrinsic (PR #128979)

2025-02-27 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,85 @@ +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -O1 -o - | FileCheck %s + +//CHECK-LABEL: define noundef i1 @_Z15test_and_scalarbb( +//CHECK-SAME: i1 noundef [[X:%.*]], i1 noundef [[Y:%.*]

[clang] [HLSL] Add "or" intrinsic (PR #128979)

2025-02-27 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify -DTEST_FUNC=__builtin_hlsl_or +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify -DTEST_FUNC=__builtin_hlsl_and + + ---

[clang] [HLSL] Add "or" intrinsic (PR #128979)

2025-02-27 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,85 @@ +// RUN: %clang_cc1 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -O1 -o - | FileCheck %s + +//CHECK-LABEL: define noundef i1 @_Z15test_and_scalarbb( +//CHECK-SAME: i1 noundef [[X:%.*]], i1 noundef [[Y:%.*]

[clang] [HLSL] Add "or" intrinsic (PR #128979)

2025-02-27 Thread Ashley Coleman via cfe-commits
@@ -290,6 +290,28 @@ _HLSL_BUILTIN_ALIAS(__builtin_hlsl_and) bool4 and(bool4 x, bool4 y); // clang-format on +//===--===// +// or builtins +//===

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-25 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt closed https://github.com/llvm/llvm-project/pull/128086 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-25 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt updated https://github.com/llvm/llvm-project/pull/128086 >From bebfc20fac6b27d02bca9af328d0568018672c71 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Thu, 20 Feb 2025 16:16:16 -0700 Subject: [PATCH 1/5] [hlsl][Sema] Fix Struct Size Calculation containing 16 and

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-25 Thread Ashley Coleman via cfe-commits
@@ -172,6 +172,23 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer, return Result; } +static unsigned calculateLegacyCbufferFieldAlign(const ASTContext &Context, + QualType T) { + // Arrays and Structs are

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-25 Thread Ashley Coleman via cfe-commits
@@ -172,6 +172,23 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer, return Result; } +static unsigned calculateLegacyCbufferFieldAlign(const ASTContext &Context, + QualType T) { + // Arrays and Structs are

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-24 Thread Ashley Coleman via cfe-commits
V-FEXrt wrote: @tex3d @hekota Okay PTAL when you have a moment! https://github.com/llvm/llvm-project/pull/128086 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-24 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt updated https://github.com/llvm/llvm-project/pull/128086 >From bebfc20fac6b27d02bca9af328d0568018672c71 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Thu, 20 Feb 2025 16:16:16 -0700 Subject: [PATCH 1/4] [hlsl][Sema] Fix Struct Size Calculation containing 16 and

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-21 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,60 @@ +// RUN: %clang_cc1 -std=hlsl2021 -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 --check-prefix=CHECK-HALF + +// RUN: %clang_cc1 -std=hlsl

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-21 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt updated https://github.com/llvm/llvm-project/pull/128086 >From bebfc20fac6b27d02bca9af328d0568018672c71 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Thu, 20 Feb 2025 16:16:16 -0700 Subject: [PATCH 1/3] [hlsl][Sema] Fix Struct Size Calculation containing 16 and

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-21 Thread Ashley Coleman via cfe-commits
@@ -172,6 +172,27 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer, return Result; } +static unsigned calculateLegacyCbufferFieldAlign(const ASTContext &Context, + QualType T) { + // Aggregate types are al

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-21 Thread Ashley Coleman via cfe-commits
@@ -172,6 +172,27 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer, return Result; } +static unsigned calculateLegacyCbufferFieldAlign(const ASTContext &Context, + QualType T) { + // Aggregate types are al

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-21 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt edited https://github.com/llvm/llvm-project/pull/128086 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-21 Thread Ashley Coleman via cfe-commits
@@ -172,6 +172,27 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer, return Result; } +static unsigned calculateLegacyCbufferFieldAlign(const ASTContext &Context, + QualType T) { + // Aggregate types are al

[clang] [HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars (PR #128086)

2025-02-20 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt created https://github.com/llvm/llvm-project/pull/128086 Fixes #119641 Update SemaHLSL to correctly calculate the alignment barrier for scalars that are not 4 bytes wide >From bebfc20fac6b27d02bca9af328d0568018672c71 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Da

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

2025-02-20 Thread Ashley Coleman via cfe-commits
@@ -20681,7 +20681,8 @@ ExprResult RebuildUnknownAnyExpr::VisitCallExpr(CallExpr *E) { const FunctionType *FnType = CalleeType->castAs(); // Verify that this is a legal result type of a function. - if (DestType->isArrayType() || DestType->isFunctionType()) { + if ((Dest

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

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

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

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

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

2025-02-14 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt approved this pull request. 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 intialization list support (PR #123141)

2025-02-14 Thread Ashley Coleman 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] Implement HLSL intialization list support (PR #123141)

2025-02-14 Thread Ashley Coleman 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 splatting (PR #118992)

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

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

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

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

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

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

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

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

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

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

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

2025-01-22 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,153 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace llvm { +namespace hlsl { +namespace root_signature { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO: extend for float support with or without hexadecimal/exponent

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `WaveActiveMax` intrinsic (PR #123428)

2025-01-22 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,46 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -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 -std=hlsl2021 -finclude-defaul

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `WaveActiveMax` intrinsic (PR #123428)

2025-01-22 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,46 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -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 -std=hlsl2021 -finclude-defaul

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

2025-01-22 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt edited https://github.com/llvm/llvm-project/pull/122981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-22 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,153 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace llvm { +namespace hlsl { +namespace root_signature { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO: extend for float support with or without hexadecimal/exponent

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

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

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

2025-01-22 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt approved this pull request. Personally happy with the code at a high level, though it would be best to have someone with domain knowledge also approve https://github.com/llvm/llvm-project/pull/122981 ___ cfe-commits mailing

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

2025-01-16 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt edited https://github.com/llvm/llvm-project/pull/122981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-16 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt edited https://github.com/llvm/llvm-project/pull/122981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-16 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,130 @@ +//=== 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] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-15 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt closed 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] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-01-15 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt edited https://github.com/llvm/llvm-project/pull/122981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-15 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,152 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace llvm { +namespace hlsl { +namespace root_signature { + +// Lexer Definitions + +static bool IsPreprocessorNumberChar(char C) { + // TODO: extend for float support with or without hexadecimal/exponent

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

2025-01-15 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,152 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace llvm { +namespace hlsl { +namespace root_signature { + +// Lexer Definitions + +static bool IsPreprocessorNumberChar(char C) { + // TODO: extend for float support with or without hexadecimal/exponent

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

2025-01-15 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,130 @@ +//=== 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][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-01-15 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,152 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace llvm { +namespace hlsl { +namespace root_signature { + +// Lexer Definitions + +static bool IsPreprocessorNumberChar(char C) { + // TODO: extend for float support with or without hexadecimal/exponent

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

2025-01-15 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,152 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace llvm { +namespace hlsl { +namespace root_signature { + +// Lexer Definitions + +static bool IsPreprocessorNumberChar(char C) { + // TODO: extend for float support with or without hexadecimal/exponent

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

2025-01-15 Thread Ashley Coleman via cfe-commits
@@ -0,0 +1,152 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace llvm { +namespace hlsl { +namespace root_signature { + +// Lexer Definitions + +static bool IsPreprocessorNumberChar(char C) { + // TODO: extend for float support with or without hexadecimal/exponent

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

2025-01-15 Thread Ashley Coleman 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-15 Thread Ashley Coleman 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] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-15 Thread Ashley Coleman via cfe-commits
V-FEXrt wrote: Yeah I figured they weren't broken by me but I had assumed I needed all green before merging so was waiting for the fix to make it into main but happy to merge as is if that's acceptable https://github.com/llvm/llvm-project/pull/116858 ___

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

2025-01-14 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt 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] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-13 Thread Ashley Coleman via cfe-commits
@@ -3181,136 +3193,250 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-10 Thread Ashley Coleman via cfe-commits
@@ -3181,136 +3193,250 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-10 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt edited 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] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-10 Thread Ashley Coleman via cfe-commits
@@ -3181,136 +3193,250 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-10 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt edited 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] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-10 Thread Ashley Coleman via cfe-commits
@@ -3181,136 +3193,250 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-10 Thread Ashley Coleman via cfe-commits
@@ -3181,136 +3193,250 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-08 Thread Ashley Coleman via cfe-commits
@@ -3178,98 +3178,74 @@ bool SPIRVInstructionSelector::selectFirstBitSet64Overflow( Register ResVReg, const SPIRVType *ResType, MachineInstr &I, Register SrcReg, unsigned BitSetOpcode, bool SwapPrimarySide) const { + // SPIR-V only allow vecs of size 2,3,4. Calling w

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-08 Thread Ashley Coleman via cfe-commits
@@ -3178,98 +3178,74 @@ bool SPIRVInstructionSelector::selectFirstBitSet64Overflow( Register ResVReg, const SPIRVType *ResType, MachineInstr &I, Register SrcReg, unsigned BitSetOpcode, bool SwapPrimarySide) const { + // SPIR-V only allow vecs of size 2,3,4. Calling w

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2025-01-08 Thread Ashley Coleman via cfe-commits
@@ -3178,98 +3178,74 @@ bool SPIRVInstructionSelector::selectFirstBitSet64Overflow( Register ResVReg, const SPIRVType *ResType, MachineInstr &I, Register SrcReg, unsigned BitSetOpcode, bool SwapPrimarySide) const { + // SPIR-V only allow vecs of size 2,3,4. Calling w

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-17 Thread Ashley Coleman via cfe-commits
@@ -3139,136 +3151,269 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-17 Thread Ashley Coleman via cfe-commits
@@ -3139,136 +3151,269 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-16 Thread Ashley Coleman via cfe-commits
@@ -3166,109 +3171,228 @@ bool SPIRVInstructionSelector::selectFirstBitHigh32(Register ResVReg, .constrainAllUses(TII, TRI, RBI); } -bool SPIRVInstructionSelector::selectFirstBitHigh64(Register ResVReg, -const SPIRVTyp

[clang] [llvm] [HLSL] Implement `WaveActiveAllTrue` Intrinsic (PR #117245)

2024-12-16 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt updated https://github.com/llvm/llvm-project/pull/117245 >From 1156d98a0ba25a92b4edbacb7c17e5ad6bb2b522 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Thu, 21 Nov 2024 08:42:31 -0700 Subject: [PATCH 1/2] [HLSL] Implement WaveActiveAllTrue Intrinsic --- clang/in

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-16 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt edited 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] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-16 Thread Ashley Coleman via cfe-commits
@@ -3166,109 +3171,228 @@ bool SPIRVInstructionSelector::selectFirstBitHigh32(Register ResVReg, .constrainAllUses(TII, TRI, RBI); } -bool SPIRVInstructionSelector::selectFirstBitHigh64(Register ResVReg, -const SPIRVTyp

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-16 Thread Ashley Coleman via cfe-commits
https://github.com/V-FEXrt updated https://github.com/llvm/llvm-project/pull/116858 >From a63e05d2e090edf7834fb62296bccd071a8e38b8 Mon Sep 17 00:00:00 2001 From: Ashley Coleman Date: Thu, 14 Nov 2024 11:53:39 -0700 Subject: [PATCH 1/7] [HLSL] Implement elementwise firstbitlow builtin --- clan

  1   2   >