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

2025-04-05 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/133508 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-04-05 Thread Sarah Spall via cfe-commits
@@ -91,6 +91,137 @@ if.end: ; preds = %if.else, %if.then %3 = load i32, ptr %resp, align 4 ret i32 %3 } + +; CHECK: define i32 @flatten_switch(i32 %X) +; CHECK-NOT: hlsl.controlflow.hint +; CHECK: switch i32 %0, label %sw.epil

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

2025-04-05 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/131666 >From 4d4541232fb8ada1a4a17701919809a2a727d52d Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 17 Mar 2025 12:01:11 -0700 Subject: [PATCH 1/2] remove Macros implementing overloads for min and max. Implement

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

2025-04-05 Thread Sarah Spall via cfe-commits
spall wrote: > this is not NFC, so we should verify that we can call these intrinsics with > `half` values even if 16-bit types aren't enabled, and that they properly > codegen to 32-bit varia > > > > > For example, for `abs`, it still depends on the > > > > > _HLSL_16BIT_AVAILABILITY availab

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

2025-03-25 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/132979 >From 5facb02ef4df5e0da31b6adef66f0b72309b99df Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 24 Mar 2025 17:15:54 -0700 Subject: [PATCH 1/5] new double overloads + tests --- clang/lib/Frontend/InitPrepro

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

2025-03-25 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/132979 >From 5facb02ef4df5e0da31b6adef66f0b72309b99df Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 24 Mar 2025 17:15:54 -0700 Subject: [PATCH 1/4] new double overloads + tests --- clang/lib/Frontend/InitPrepro

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

2025-03-25 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/132979 Add double overloads which cast the double to a float and call the float builtin. Makes these double overloads conditional on hlsl version 202x or earlier. Add tests Closes #128228 >From 5facb02ef4df5e0da31b6ade

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

2025-03-25 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/132979 >From 5facb02ef4df5e0da31b6adef66f0b72309b99df Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 24 Mar 2025 17:15:54 -0700 Subject: [PATCH 1/2] new double overloads + tests --- clang/lib/Frontend/InitPrepro

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

2025-03-26 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/132979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-27 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/132804 Finish the work of #81782 Closes #132793 >From 140b17c6972ac7f867dc342f29121d71e079c9db Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 24 Mar 2025 11:38:21 -0700 Subject: [PATCH] half overloads are defin

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

2025-03-25 Thread Sarah Spall via cfe-commits
spall wrote: > > this is not NFC, so we should verify that we can call these intrinsics with > > `half` values even if 16-bit types aren't enabled, and that they properly > > codegen to 32-bit varia > > > > > > > For example, for `abs`, it still depends on the > > > > > > _HLSL_16BIT_AVAILABI

[clang] [HLSL] Make it possible to assign an array from a cbuffer (PR #134174)

2025-04-07 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/134174 >From 5d81a4b7b034dd5999feb6ab37537270d6bae2a8 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Wed, 2 Apr 2025 12:04:18 -0700 Subject: [PATCH] compare unqualified canonical types and add an hlsl array rvalue cas

[clang] [HLSL] Make it possible to assign an array from a cbuffer (PR #134174)

2025-04-07 Thread Sarah Spall via cfe-commits
https://github.com/spall ready_for_review https://github.com/llvm/llvm-project/pull/134174 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

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

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

2025-04-10 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,110 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -fnative-half-type -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -triple spirv-unknown-vulkan-compu

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

2025-04-08 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,53 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion -Wconversion %s + spall wrote: Maybe you should add a test case for an array of arrays, like 'int2[2][]' https://github.com/llvm/llvm

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

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

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

2025-03-28 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/133520 Add WaveReadLaneAt unsigned integer overloads 2nd argument of WaveReadLaneAt should be a uint32_t and not an int32_t add tests Closes #133473 >From 69d23f1ba200ceab78d1c108b629875b108689c0 Mon Sep 17 00:00:00 200

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

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

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

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

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

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

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

2025-03-31 Thread Sarah Spall via cfe-commits
@@ -3249,33 +3249,42 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) { } } } +namespace { +class InitListTransformer { + Sema &S; + ASTContext &Ctx; + QualType InitTy; + QualType *DstIt = nullptr; + Expr **ArgIt = nullptr; + bool Wrap;

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

2025-03-15 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,63 @@ +//===--- hlsl_compat_overloads.h - Additional HLSL overload definitions for +// intrinsics --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-Licens

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

2025-03-15 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/129773 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add bounds checks for the HLSL `fmod` vector arguments and return types (PR #131035)

2025-03-17 Thread Sarah Spall via cfe-commits
https://github.com/spall approved this pull request. https://github.com/llvm/llvm-project/pull/131035 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-17 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/129939 >From 23debaf2084f953e60847b8f0814c5d1ee27c726 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Tue, 4 Mar 2025 09:53:56 -0800 Subject: [PATCH 01/16] extra scalar vector overloads for clamp --- .../lib/Headers/h

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

2025-03-17 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/129939 >From 23debaf2084f953e60847b8f0814c5d1ee27c726 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Tue, 4 Mar 2025 09:53:56 -0800 Subject: [PATCH 01/14] extra scalar vector overloads for clamp --- .../lib/Headers/h

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

2025-03-17 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/129939 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add bounds checks for the HLSL `fmod` vector arguments and return types (PR #131035)

2025-03-17 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/131035 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-17 Thread Sarah Spall via cfe-commits
spall wrote: > LGTM! Unfortunate about the macros not working out but this alternative is > pretty convenient. They would have worked if we didn't need even more overloads! https://github.com/llvm/llvm-project/pull/131666 ___ cfe-commits mailing list

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

2025-03-17 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/131666 Replace min and max overload implementation using macros with one using templates. Enable new overloads of the forms: vector min/max(vector p0, U p1) vector min/max(U p0, vector p1) vector min/max(vector p0, ve

[clang] [HLSL] Desugar ConstantArrayType when calculating cbuffer field layout (PR #134683)

2025-04-08 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/134683 >From 87308905daa9093caef9ffb920bf9968c0bfb597 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 7 Apr 2025 09:31:28 -0700 Subject: [PATCH 1/2] desguar constantarraytype --- clang/lib/CodeGen/HLSLBufferLayou

[clang] [Clang][DirectX] Always use Diagnostic Printer (PR #135655)

2025-04-14 Thread Sarah Spall via cfe-commits
@@ -605,13 +605,11 @@ void BackendConsumer::UnsupportedDiagHandler( // Context will be nullptr for IR input files, we will construct the diag // message from llvm::DiagnosticInfoUnsupported. - if (Context != nullptr) { + if (Context != nullptr) Loc = getBestLocation

[clang] [HLSL] Make it possible to assign an array from a cbuffer (PR #134174)

2025-04-18 Thread Sarah Spall via cfe-commits
@@ -2268,17 +2268,15 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType, // handling here. if (ToType->isArrayParameterType()) { FromType = S.Context.getArrayParameterType(FromType); - SCS.First = ICK_HLSL_Array_RValue; } else if (

[clang] [HLSL] Make it possible to assign an array from a cbuffer (PR #134174)

2025-04-18 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/134174 >From 5d81a4b7b034dd5999feb6ab37537270d6bae2a8 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Wed, 2 Apr 2025 12:04:18 -0700 Subject: [PATCH 1/2] compare unqualified canonical types and add an hlsl array rvalue

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

2025-04-22 Thread Sarah Spall via cfe-commits
https://github.com/spall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/133508 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reland "[HLSL][RootSignature] Define and integrate HLSLRootSignatureAttr" (PR #134293)

2025-04-22 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/134293 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reland "[HLSL][RootSignature] Define and integrate HLSLRootSignatureAttr" (PR #134293)

2025-04-22 Thread Sarah Spall via cfe-commits
https://github.com/spall approved this pull request. LGTM based on previous pr approval and looking at the change in the latest commit https://github.com/llvm/llvm-project/pull/134293 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[clang] [HLSL] Put tests for compatibility overloads for 'clamp', 'isinf', 'min', and 'max' in own files (PR #137004)

2025-04-23 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/137004 Put tests for compatibility overloads for 'clamp', 'isinf', 'min', and 'max' in own files which guarantee hlsl version 202x. Closes #133277 >From d0051512fc864c250a3734ac4df0ba09072669ef Mon Sep 17 00:00:00 2001

[clang] [HLSL] Desugar ConstantArrayType when calculating cbuffer field layout (PR #134683)

2025-04-10 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/134683 >From 87308905daa9093caef9ffb920bf9968c0bfb597 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 7 Apr 2025 09:31:28 -0700 Subject: [PATCH 1/3] desguar constantarraytype --- clang/lib/CodeGen/HLSLBufferLayou

[clang] [HLSL] Handle init list with OpaqueValueExprs in CGExprScalar (PR #138541)

2025-05-05 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/138541 When an HLSL Init list is producing a Scalar, handle OpaqueValueExprs in the Init List with 'emitInitListOpaqueValues' Copied from 'AggExprEmitter::VisitCXXParenListOrInitListExpr' Closes #136408 >From 24f4cf687

[clang] [HLSL] Handle init list with OpaqueValueExprs in CGExprScalar (PR #138541)

2025-05-05 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/138541 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-ser

[clang] [HLSL] Implement the `ldexp` intrinsic (PR #138182)

2025-05-01 Thread Sarah Spall via cfe-commits
@@ -303,6 +303,48 @@ fmod(__detail::HLSL_FIXED_VECTOR X, return __detail::fmod_vec_impl(X, Y); } +//===--===// +// ldexp builtins +//===--=

[clang] [HLSL] Implement the `ldexp` intrinsic (PR #138182)

2025-05-01 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify + +float test_double_inputs(double p0, double p1) { + return ldexp(p0, p1); + // expected-error@-1 {{no matc

[clang] [HLSL] Implement the `ldexp` intrinsic (PR #138182)

2025-05-01 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,49 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s spall wrote: A lot of the builtins that support half and float have tests with

[clang] [HLSL] Update Sema Checking Diagnostics for builtins (PR #138429)

2025-05-05 Thread Sarah Spall via cfe-commits
@@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %

[clang] [HLSL] Handle init list with OpaqueValueExprs in CGExprScalar (PR #138541)

2025-05-05 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/138541 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-ser

[clang] [HLSL] Handle init list with OpaqueValueExprs in CGExprScalar (PR #138541)

2025-05-05 Thread Sarah Spall via cfe-commits
@@ -2095,6 +2096,17 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { assert (Ignore == false && "init list ignored"); unsigned NumInitElements = E->getNumInits(); + // HLSL initialization lists in the AST are an expansion which can contain + // side-eff

[clang] [HLSL] Handle init list with OpaqueValueExprs in CGExprScalar (PR #138541)

2025-05-05 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/138541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Boolean in a RawBuffer should be i32 and Boolean vector in a RawBuffer should be <4 x i32> (PR #135848)

2025-04-15 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/135848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Boolean in a RawBuffer should be i32 and Boolean vector in a RawBuffer should be (PR #135848)

2025-04-15 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/135848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Boolean in a RawBuffer should be i32 and Boolean vector in a RawBuffer should be <4 x i32> (PR #135848)

2025-04-15 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/135848 Instead of converting the type in a RawBuffer to its HLSL type using 'ConvertType', use 'ConvertTypeForMem'. ConvertTypeForMem handles booleans being i32 and boolean vectors being . Add tests to show booleans and

[clang] [HLSL] Boolean in a RawBuffer should be i32 and Boolean vector in a RawBuffer should be (PR #135848)

2025-04-15 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/135848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Boolean in a RawBuffer should be i32 and Boolean vector in a RawBuffer should be (PR #135848)

2025-04-15 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/135848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Desugar ConstantArrayType when calculating cbuffer field layout (PR #134683)

2025-04-10 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/134683 When calculating the layout for a cbuffer field, if that field is a ConstantArrayType, desguar it before casting it to a ConstantArrayType. Closes #134668 >From 87308905daa9093caef9ffb920bf9968c0bfb597 Mon Sep 1

[clang] [HLSL] Put tests for compatibility overloads for 'clamp', 'isinf', 'min', and 'max' in own files (PR #137004)

2025-04-28 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/137004 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Update Sema Checking Diagnostics for builtins (PR #138429)

2025-05-03 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/138429 Update how Sema Checking is done for HLSL builtins to allow for better error messages, mainly using 'err_builtin_invalid_arg_type'. Try to follow the formula outlined in issue #134721 Closes #134721 >From 113910

[clang] [HLSL] Reland; Make it possible to assign an array from a cbuffer (PR #136580)

2025-04-21 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/136580 Reland #134174 Update Sema Checking to always do an HLSL Array RValue cast in the case we are dealing with hlsl constant array types Instead of comparing canonical types, compare canonical unqualified types Add a

[clang] [HLSL] Reland; Make it possible to assign an array from a cbuffer (PR #136580)

2025-04-21 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/136580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Make it possible to assign an array from a cbuffer (PR #134174)

2025-04-21 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/134174 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Make it possible to assign an array from a cbuffer (PR #134174)

2025-04-21 Thread Sarah Spall via cfe-commits
spall wrote: > Hi, this turned a few bots red. Can this be fixed forward or should we revert > in the meantime? Let me know if you need help with the bot setup / build > config. Thanks! It can be reverted https://github.com/llvm/llvm-project/pull/134174 ___

[clang] Revert "[HLSL] Make it possible to assign an array from a cbuffer" (PR #136576)

2025-04-21 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/136576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[HLSL] Make it possible to assign an array from a cbuffer" (PR #136576)

2025-04-21 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/136576 Reverts llvm/llvm-project#134174 Revert due to test error breaking a lot of bots. >From e35cf35feff443c6dd9fbc0b5ab00efa8e282fa0 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 21 Apr 2025 09:27:45 -0700 Su

[clang] [HLSL] Boolean in a RawBuffer should be i32 and Boolean vector in a RawBuffer should be (PR #135848)

2025-04-21 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/135848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Bug fix crash using Array Parameters when De-sugaring is the same as canonicalizing (PR #127670)

2025-02-18 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/127670 Fixes this crash: https://hlsl.godbolt.org/z/9aP74s4bP Which happens because the de-sugared type is the same as the canonicalized type. Check if the de-sugared type is canonical before getting the ArrayParameterT

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

2025-02-18 Thread Sarah Spall via cfe-commits
@@ -6585,6 +6585,18 @@ void InitializationSequence::InitializeFrom(Sema &S, } } +if (S.getLangOpts().HLSL && Initializer && isa(DestAT)) { spall wrote: Would be nice to consolidate this if statement with the one below, unless HLSL Arrays can a

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

2025-02-18 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/127557 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-02-18 Thread Sarah Spall via cfe-commits
https://github.com/spall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/127557 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Bug fix crash using Array Parameters when De-sugaring is the same as canonicalizing (PR #127670)

2025-02-18 Thread Sarah Spall via cfe-commits
spall wrote: > Looks fine to me, but this change doesn't only affect HLSL does it? The > function `getArrayParameterType` in `ASTContext.cpp` doesn't look like it is > HLSL-specific. I wonder if a similar bug occurs within C/C++. I believe this function is only called in an HLSL context. http

[clang] [HLSL] Bug fix crash using Array Parameters when De-sugaring is the same as canonicalizing (PR #127670)

2025-02-18 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/127670 ___ 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 Sarah Spall via cfe-commits
@@ -1817,5 +1817,9 @@ def ext_hlsl_access_specifiers : ExtWarn< InGroup; def err_hlsl_unsupported_component : Error<"invalid component '%0' used; expected 'x', 'y', 'z', or 'w'">; def err_hlsl_packoffset_invalid_reg : Error<"invalid resource class specifier '%0' for packoff

[clang] [HLSL] Add additional overloads for min and max to allow for mixed scalar and vector arguments (PR #129334)

2025-02-28 Thread Sarah Spall via cfe-commits
@@ -131,3 +157,9 @@ double3 test_min_double3(double3 p0, double3 p1) { return min(p0, p1); } // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x double> @_Z16test_min_double4 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x double> @llvm.minnum.v4f64 double4 test_min_dou

[clang] [HLSL] Add additional overloads for min and max to allow for mixed scalar and vector arguments (PR #129334)

2025-02-28 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/129334 >From ebaef38c40cba83d4b446a5320d57c86038f8286 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 28 Feb 2025 11:18:03 -0800 Subject: [PATCH 1/3] new max overloads + new min overloads --- clang/lib/Headers/hl

[clang] [HLSL] Add additional overloads for min and max to allow for mixed scalar and vector arguments (PR #129334)

2025-02-28 Thread Sarah Spall via cfe-commits
spall wrote: > Are there any error conditions that need testing as well? I don't think there were error tests for min and max originally. I could add some to make sure things like min(int4, int3) are still now allowed. https://github.com/llvm/llvm-project/pull/129334 __

[clang] [HLSL] Add additional overloads for min and max to allow for mixed scalar and vector arguments (PR #129334)

2025-02-28 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/129334 Add additional overloads for min and max to support min(vector, T) and min(T, vector) max(vector, T) and max(T, vector) Add tests Closes #128231 >From ebaef38c40cba83d4b446a5320d57c86038f8286 Mon Sep 17 00:00:00

[clang] [HLSL] Add additional overloads for min and max to allow for mixed scalar and vector arguments (PR #129334)

2025-02-28 Thread Sarah Spall via cfe-commits
@@ -1678,6 +1678,30 @@ half3 max(half3, half3); _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) half4 max(half4, half4); +_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) +constexpr half2 max(half2 p0, half p1) { spall wrote:

[clang] [HLSL] Add additional overloads for min and max to allow for mixed scalar and vector arguments (PR #129334)

2025-02-28 Thread Sarah Spall via cfe-commits
@@ -1678,6 +1678,30 @@ half3 max(half3, half3); _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) _HLSL_BUILTIN_ALIAS(__builtin_elementwise_max) half4 max(half4, half4); +_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) +constexpr half2 max(half2 p0, half p1) { spall wrote:

[clang] [HLSL] Add additional overloads for min and max to allow for mixed scalar and vector arguments (PR #129334)

2025-02-28 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/129334 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-07 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/129773 >From 6c2e22d2fa59f34401156ac6fd85c44730bf8c45 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Tue, 4 Mar 2025 12:58:13 -0800 Subject: [PATCH 1/3] make semantics case insensitive. update tests. add new tests --

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

2025-03-07 Thread Sarah Spall via cfe-commits
spall wrote: > nit: is there a way to check that the spelling is consistent in the error > messages? Asking since I am no familiar with this part of the code. I'm not sure I understand what you mean. https://github.com/llvm/llvm-project/pull/129773 _

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

2025-03-07 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/129773 >From 6c2e22d2fa59f34401156ac6fd85c44730bf8c45 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Tue, 4 Mar 2025 12:58:13 -0800 Subject: [PATCH 1/2] make semantics case insensitive. update tests. add new tests --

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

2025-03-08 Thread Sarah Spall via cfe-commits
https://github.com/spall converted_to_draft https://github.com/llvm/llvm-project/pull/129939 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-05 Thread Sarah Spall via cfe-commits
@@ -35,25 +35,48 @@ namespace hlsl { #define _HLSL_16BIT_AVAILABILITY_STAGE(environment, version, stage) #endif -#define GEN_VEC_SCALAR_OVERLOADS(FUNC_NAME, BASE_TYPE, AVAIL) \ - GEN_BOTH_OVERLOADS(FUNC_NAME, BASE_TYPE, BASE_TYPE##2, AVAIL) \

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

2025-03-05 Thread Sarah Spall via cfe-commits
@@ -35,25 +35,48 @@ namespace hlsl { #define _HLSL_16BIT_AVAILABILITY_STAGE(environment, version, stage) #endif -#define GEN_VEC_SCALAR_OVERLOADS(FUNC_NAME, BASE_TYPE, AVAIL) \ - GEN_BOTH_OVERLOADS(FUNC_NAME, BASE_TYPE, BASE_TYPE##2, AVAIL) \

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

2025-03-05 Thread Sarah Spall via cfe-commits
@@ -35,25 +35,48 @@ namespace hlsl { #define _HLSL_16BIT_AVAILABILITY_STAGE(environment, version, stage) #endif -#define GEN_VEC_SCALAR_OVERLOADS(FUNC_NAME, BASE_TYPE, AVAIL) \ - GEN_BOTH_OVERLOADS(FUNC_NAME, BASE_TYPE, BASE_TYPE##2, AVAIL) \

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

2025-03-06 Thread Sarah Spall via cfe-commits
@@ -141,6 +141,8 @@ void Parser::ParseHLSLAnnotations(ParsedAttributes &Attrs, return; } + II = PP.getIdentifierInfo(II->getName().lower()); spall wrote: Okay that might requirement a significant change. I'll look into it https://github.com/llvm/llvm

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Sarah Spall via cfe-commits
https://github.com/spall approved this pull request. https://github.com/llvm/llvm-project/pull/130724 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-11 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/129939 >From 23debaf2084f953e60847b8f0814c5d1ee27c726 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Tue, 4 Mar 2025 09:53:56 -0800 Subject: [PATCH 1/4] extra scalar vector overloads for clamp --- .../lib/Headers/hls

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

2025-03-11 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/129939 >From 23debaf2084f953e60847b8f0814c5d1ee27c726 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Tue, 4 Mar 2025 09:53:56 -0800 Subject: [PATCH 1/5] extra scalar vector overloads for clamp --- .../lib/Headers/hls

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

2025-03-11 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/128952 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Sarah Spall via cfe-commits
https://github.com/spall commented: Looks mostly good to me, a couple of questions though which applied to most of the templates in the code, but I only commented on the first instances I saw. 1. Do you need to check T is arithmetic if you're also checking its half? Wont' the half check suffice

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/130724 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Sarah Spall via cfe-commits
@@ -89,23 +89,31 @@ void asuint(double4, out uint4, out uint4); /// \param X The X input value. /// \param Y The Y input value. +template _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) -const inline half distance(half X, half Y) { +const inline __detail::enable_if_t<__detail::is

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Sarah Spall via cfe-commits
@@ -45,6 +45,10 @@ template struct is_arithmetic { static const bool Value = __is_arithmetic(T); }; +template +using HLSL_FIXED_VECTOR = +vector<__detail::enable_if_t<(N > 1 && N <= 4), T>, N>; spall wrote: should the enable_if_t not go around the ent

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Sarah Spall via cfe-commits
@@ -89,23 +89,31 @@ void asuint(double4, out uint4, out uint4); /// \param X The X input value. /// \param Y The Y input value. +template _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) -const inline half distance(half X, half Y) { +const inline __detail::enable_if_t<__detail::is

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Sarah Spall via cfe-commits
@@ -89,23 +89,31 @@ void asuint(double4, out uint4, out uint4); /// \param X The X input value. /// \param Y The Y input value. +template _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) -const inline half distance(half X, half Y) { +const inline __detail::enable_if_t<__detail::is

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/130724 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-02-27 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/128952 >From 656d6e87466bfc85246f7abaedfe6549e566717b Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Wed, 26 Feb 2025 14:37:06 -0800 Subject: [PATCH 1/4] error on out of bounds vector accesses --- .../clang/Basic/Dia

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

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

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

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

<    1   2   3   4   >