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

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

[clang] [HLSL] Move where ZExt happens in 'EmitStoreThroughExtVectorComponentLValue' to handle bug with hlsl boolean vector swizzles (PR #140627)

2025-05-19 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/140627 In 'EmitStoreThroughExtVectorComponentLValue', move the code which ZExts in the case the Destination Scalar Type is larger than the Source Scalar Type, to the top of the function, to ensure each condition is hand

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

2025-05-19 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/138429 >From 1139101e277f8f4d327fd7b422959dc4a3a43dbe Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Tue, 18 Mar 2025 11:04:11 -0700 Subject: [PATCH 1/3] update error messaging --- .../clang/Basic/DiagnosticSemaKinds

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

2025-05-15 Thread Sarah Spall via cfe-commits
@@ -2507,13 +2441,9 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } case Builtin::BI__builtin_hlsl_dot: { -if (SemaRef.checkArgCount(TheCall, 2)) spall wrote: BuiltinVectorToScalarMath checks that the a

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

2025-05-15 Thread Sarah Spall via cfe-commits
@@ -2446,37 +2376,41 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { case Builtin::BI__builtin_hlsl_any: { if (SemaRef.checkArgCount(TheCall, 1)) return true; +if (CheckAnyScalarOrVector(&SemaRef, TheCall, 0)) + return t

[clang] [HLSL] Add various overloads for MiniEngine (PR #139800)

2025-05-13 Thread Sarah Spall via cfe-commits
@@ -158,6 +158,42 @@ namespace hlsl { return fn((float4)V1, (float4)V2, (float4)V3); \ } +#define _DXC_COMPAT_BINARY_VECTOR_SCALAR_OVERLOADS(fn) \ + template \ + cons

[clang] [HLSL] Add various overloads for MiniEngine (PR #139800)

2025-05-13 Thread Sarah Spall via cfe-commits
@@ -158,6 +158,42 @@ namespace hlsl { return fn((float4)V1, (float4)V2, (float4)V3); \ } +#define _DXC_COMPAT_BINARY_VECTOR_SCALAR_OVERLOADS(fn) \ + template \ + cons

[clang] [HLSL] Add various overloads for MiniEngine (PR #139800)

2025-05-13 Thread Sarah Spall via cfe-commits
@@ -179,3 +179,41 @@ half3 test_lerp_half_scalar(half3 x, half3 y, half s) { return lerp(x, y, s); } float3 test_lerp_float_scalar(float3 x, float3 y, float s) { return lerp(x, y, s); } + +// CHECK: define [[FNATTRS]] <2 x float> @_Z23test_lerp_float_scalar1Dv2_ff( +// CHECK

[clang] [HLSL] Add various overloads for MiniEngine (PR #139800)

2025-05-13 Thread Sarah Spall via cfe-commits
@@ -236,6 +257,22 @@ _DXC_COMPAT_UNARY_INTEGER_OVERLOADS(cosh) _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(degrees) _DXC_COMPAT_UNARY_INTEGER_OVERLOADS(degrees) +//===--===// +// dot builtins overloads +//===--

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

2025-05-13 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/138429 >From 1139101e277f8f4d327fd7b422959dc4a3a43dbe Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Tue, 18 Mar 2025 11:04:11 -0700 Subject: [PATCH 1/2] update error messaging --- .../clang/Basic/DiagnosticSemaKinds

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

2025-05-13 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] Update Sema Checking Diagnostics for builtins (PR #138429)

2025-05-12 Thread Sarah Spall via cfe-commits
@@ -42,47 +42,47 @@ float2 test_mad_element_type_mismatch(half2 p0, float2 p1) { float2 test_builtin_mad_float2_splat(float p0, float2 p1) { return __builtin_hlsl_mad(p0, p1, p1); - // expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}} + // expect

[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] 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] 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
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] 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] 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] 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
@@ -303,6 +303,48 @@ fmod(__detail::HLSL_FIXED_VECTOR X, return __detail::fmod_vec_impl(X, Y); } +//===--===// +// ldexp builtins +//===--=

[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] 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] 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] 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] [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] 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] 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] 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] 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] [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-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] 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] 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] 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 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] [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] 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] 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] 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] 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] 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] 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] 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] [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] 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] 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] [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] 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] [HLSL] Finish exposing half types and intrinsics always (PR #132804)

2025-04-05 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/132804 >From 140b17c6972ac7f867dc342f29121d71e079c9db Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 24 Mar 2025 11:38:21 -0700 Subject: [PATCH 1/2] half overloads are defined all the time --- .../lib/Headers/hl

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

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

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Sarah Spall via cfe-commits
@@ -253,6 +253,37 @@ const inline float length(__detail::HLSL_FIXED_VECTOR X) { return __detail::length_vec_impl(X); } +//===--===// +// lit builtins +//===--

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-03 Thread Sarah Spall via cfe-commits
@@ -280,6 +280,22 @@ constexpr bool4 isinf(double4 V) { return isinf((float4)V); } _DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp) _DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp) +//===--===// +// lit builtins overloa

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-02 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,36 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s + +// CHECK

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

2025-04-02 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/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 test to show it

[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

2025-04-02 Thread Sarah Spall via cfe-commits
@@ -253,6 +253,37 @@ const inline float length(__detail::HLSL_FIXED_VECTOR X) { return __detail::length_vec_impl(X); } +//===--===// +// lit builtins +//===--

[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] 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] Add WaveReadLaneAt unsigned integer overloads (PR #133520)

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

[clang] [HLSL] 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] 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] 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-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] 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 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-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] [llvm] [HLSL] Add support to branch/flatten attributes to switch (PR #131739)

2025-03-24 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] [llvm] [HLSL] Add support to branch/flatten attributes to switch (PR #131739)

2025-03-24 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] Finish exposing half types and intrinsics always (PR #132804)

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

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

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

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

2025-03-24 Thread Sarah Spall via cfe-commits
spall wrote: > Are there any test changes we should consider here? If not could you prefix > `[NFC]` to the title? It looked to me like the tests were all correct based on what was done in the reference PR https://github.com/llvm/llvm-project/pull/132804 __

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

2025-03-24 Thread Sarah Spall via cfe-commits
spall wrote: > > > For example, for `abs`, it still depends on the _HLSL_16BIT_AVAILABILITY > > > availability attribute. Does this PR intend to keep abs overloads using > > > half "unexposed"? Or should that overload for abs be exposed too? > > > > > > Oh I see what you are referring to. Tha

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

2025-03-24 Thread Sarah Spall via cfe-commits
spall wrote: > For example, for `abs`, it still depends on the _HLSL_16BIT_AVAILABILITY > availability attribute. Does this PR intend to keep abs overloads using half > "unexposed"? Or should that overload for abs be exposed too? Oh I see what you are referring to. That might be my mistake; le

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

2025-03-24 Thread Sarah Spall via cfe-commits
spall wrote: > For example, for `abs`, it still depends on the _HLSL_16BIT_AVAILABILITY > availability attribute. Does this PR intend to keep abs overloads using half > "unexposed"? Or should that overload for abs be exposed too? I'm not sure I understand the question, I think abs is the same

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

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

[clang] [HLSL] Fix bug in new clamp overloads (PR #131928)

2025-03-19 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/131928 ___ 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-18 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.2-library %s -fnative-half-type -verify + + +int16_t4 test_asint_too_many_arg(uint16_t p0, uint16_t p1) +{ +return asint16(p0, p1); + // expected-error@-1 {{no matching function for ca

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

2025-03-18 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.2-library %s -fnative-half-type -emit-llvm -O1 -o - | FileCheck %s +// CHECK: define {{.*}}test_ints{{.*}}(i16 {{.*}} [[VAL:%.*]]){{.*}} +// CHECK-NOT: bitcast +// CHECK: ret i16 [

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

2025-03-18 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,55 @@ +; RUN: llc -O0 -verify-machineinstrs -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: OpCapability Int16 +; CHECK: OpCapability Float16 +; CH

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

2025-03-18 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/5] remove Macros implementing overloads for min and max. Implement

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

2025-03-18 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/4] remove Macros implementing overloads for min and max. Implement

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

2025-03-18 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/3] remove Macros implementing overloads for min and max. Implement

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

2025-03-18 Thread Sarah Spall via cfe-commits
https://github.com/spall edited https://github.com/llvm/llvm-project/pull/131666 ___ 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
@@ -54,5 +54,67 @@ clamp(U p0, V p1, W p2) { return clamp(p0, (U)p1, (U)p2); } +//===--===// +// max builtin overloads +//===--===// + +tem

[clang] [HLSL] Implement 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] 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
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] 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 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/15] extra scalar vector overloads for clamp --- .../lib/Headers/h

[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

  1   2   3   4   >