[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-03 Thread Sarah Spall via cfe-commits
@@ -2016,8 +2016,9 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { case Type::Vector: { const auto *VT = cast(T); TypeInfo EltInfo = getTypeInfo(VT->getElementType()); -Width = VT->isExtVectorBoolType() ? VT->getNumElements() -

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-03 Thread Sarah Spall via cfe-commits
@@ -2016,8 +2016,9 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { case Type::Vector: { const auto *VT = cast(T); TypeInfo EltInfo = getTypeInfo(VT->getElementType()); -Width = VT->isExtVectorBoolType() ? VT->getNumElements() -

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-03 Thread Sarah Spall via cfe-commits
@@ -1984,6 +1984,15 @@ llvm::Constant *ConstantEmitter::emitForMemory(CodeGenModule &CGM, return Res; } + // In HLSL bool vectors are stored in memory as a vector of i32 + if (destType->isExtVectorBoolType() && CGM.getContext().getLangOpts().HLSL) { +llvm::Type *b

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

2025-02-04 Thread Sarah Spall via cfe-commits
@@ -14857,6 +14857,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) { case CK_FixedPointCast: case CK_IntegralToFixedPoint: case CK_MatrixCast: +// TODO does CK_HLSLAggregateCast belong here? spall wrote: It can, and I do need to remove

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

2025-02-04 Thread Sarah Spall via cfe-commits
@@ -14857,6 +14857,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) { case CK_FixedPointCast: case CK_IntegralToFixedPoint: case CK_MatrixCast: +// TODO does CK_HLSLAggregateCast belong here? spall wrote: You can truncate (for example) a

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

2025-02-04 Thread Sarah Spall via cfe-commits
@@ -6358,3 +6359,81 @@ RValue CodeGenFunction::EmitPseudoObjectRValue(const PseudoObjectExpr *E, LValue CodeGenFunction::EmitPseudoObjectLValue(const PseudoObjectExpr *E) { return emitPseudoObjectExpr(*this, E, true, AggValueSlot::ignored()).LV; } + +void CodeGenFunction::Fl

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-04 Thread Sarah Spall via cfe-commits
@@ -2016,8 +2016,9 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { case Type::Vector: { const auto *VT = cast(T); TypeInfo EltInfo = getTypeInfo(VT->getElementType()); -Width = VT->isExtVectorBoolType() ? VT->getNumElements() -

[clang] [HLSL] Implement HLSL Elementwise casting (excluding splat cases); Re-land #118842 (PR #126258)

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

[clang] [HLSL] Desugar type when converting from a ConstantArrayType to an ArrayParameterType (PR #126561)

2025-02-10 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/126561 Desugar type when converting from a ConstantArrayType to an ArrayParameterType in getArrayParameterType Closes #125743 >From 199395c935fc1da70db91bba94a1ea86afb83bf9 Mon Sep 17 00:00:00 2001 From: Sarah Spall D

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

2025-02-05 Thread Sarah Spall via cfe-commits
@@ -6358,3 +6359,81 @@ RValue CodeGenFunction::EmitPseudoObjectRValue(const PseudoObjectExpr *E, LValue CodeGenFunction::EmitPseudoObjectLValue(const PseudoObjectExpr *E) { return emitPseudoObjectExpr(*this, E, true, AggValueSlot::ignored()).LV; } + +void CodeGenFunction::Fl

[clang] Revert "[HLSL] Implement HLSL Flat casting (excluding splat cases)" (PR #126149)

2025-02-06 Thread Sarah Spall via cfe-commits
spall wrote: > Hi, > > We usually ask to include the reason for the revert in the commit message. I apologize, there was a buildbot failure which seemed to be caused by the reverted commit. https://github.com/llvm/llvm-project/pull/126149 ___ cfe-c

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

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

[clang] Revert "[HLSL] Implement HLSL Flat casting (excluding splat cases)" (PR #126149)

2025-02-06 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/126149 Reverts llvm/llvm-project#118842 >From 6fd9dd96b0cd68d9bb04e791f90ec8ef5211563a Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 6 Feb 2025 15:17:49 -0800 Subject: [PATCH] Revert "[HLSL] Implement HLSL Flat

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

2025-02-06 Thread Sarah Spall via cfe-commits
spall wrote: > One small request: can you add a test that verifies we produce an error if > you try to cast to or from a structure containing a bitfield? I think I already did this clang/test/SemaHLSL/Language/ElementwiseCast-errors.hlsl https://github.com/llvm/llvm-project/pull/118842 __

[clang] Revert "[HLSL] Implement HLSL Flat casting (excluding splat cases)" (PR #126149)

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

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

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

[clang] [HLSL] Implement HLSL Elementwise casting (excluding splat cases); Re-land #118842 (PR #126258)

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

[clang] [HLSL] Implement HLSL Elementwise casting (excluding splat cases); Re-land (PR #126258)

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

[clang] [HLSL] Desugar type when converting from a ConstantArrayType to an ArrayParameterType (PR #126561)

2025-02-10 Thread Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/126561 ___ 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-10 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From e994824f3630ee8b224afceb6c14d980c9013112 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Dec 2024 05:14:17 + Subject: [PATCH 01/11] splat cast wip --- clang/include/clang/AST/OperationKinds.def

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

2025-02-10 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From e994824f3630ee8b224afceb6c14d980c9013112 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Dec 2024 05:14:17 + Subject: [PATCH 01/13] splat cast wip --- clang/include/clang/AST/OperationKinds.def

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

2025-02-10 Thread Sarah Spall via cfe-commits
https://github.com/spall ready_for_review 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] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-12 Thread Sarah Spall via cfe-commits
@@ -2064,6 +2064,9 @@ llvm::Value *CodeGenFunction::EmitToMemory(llvm::Value *Value, QualType Ty) { if (Ty->isExtVectorBoolType()) { spall wrote: My intention was to replace calls to 'isExtVectorBoolType' and 'isPackedVectorBoolType' anywhere we want an hl

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

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

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

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

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-01-31 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/123977 >From 50f8b16bf83d70cc37f2ac7e70c9195a4c4cda02 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 16 Jan 2025 01:32:25 + Subject: [PATCH 01/10] wip --- clang/lib/CodeGen/CGExpr.cpp | 19

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-01-31 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/123977 >From 50f8b16bf83d70cc37f2ac7e70c9195a4c4cda02 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 16 Jan 2025 01:32:25 + Subject: [PATCH 1/8] wip --- clang/lib/CodeGen/CGExpr.cpp | 19 ++

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-01-31 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,52 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s + +// CHECK: %struct.S = type { <2 x i32>, float } +// CHECK: [[ConstS:@.*]] = private unnamed_addr constant %struct.S { <2

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-01-31 Thread Sarah Spall via cfe-commits
@@ -110,6 +131,24 @@ float2 HowManyFloats(float V) { return V.rr.rr; } +// CHECK-LABEL: HowManyBools +// CHECK: [[VAddr:%.*]] = alloca i32, align 4 +// CHECK-NEXT: [[Vec2Ptr:%.*]] = alloca <2 x i32>, align 1 spall wrote: I probably need to update this test

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

2024-12-16 Thread Sarah Spall 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 Sarah Spall via cfe-commits
https://github.com/spall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/117245 ___ 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 Sarah Spall 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 Sarah Spall via cfe-commits
https://github.com/spall 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 Sarah Spall 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 Sarah Spall via cfe-commits
https://github.com/spall closed https://github.com/llvm/llvm-project/pull/117245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

2024-12-18 Thread Sarah Spall via cfe-commits
spall wrote: > This looks correct, but how much work is it to update all of these tests to > have fast math enabled rather than explicitly disabling it? I worry that (1) > folks looking at these tests in the future will think that disabling fast > math is a meaningful part of the test and (2)

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

2024-12-12 Thread Sarah Spall 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-12 Thread Sarah Spall 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-12 Thread Sarah Spall via cfe-commits
@@ -96,15 +96,20 @@ class SPIRVInstructionSelector : public InstructionSelector { bool selectFirstBitHigh(Register ResVReg, const SPIRVType *ResType, MachineInstr &I, bool IsSigned) const; - bool selectFirstBitHigh16(Register ResVReg, const SPIRVT

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

2024-12-12 Thread Sarah Spall 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-12 Thread Sarah Spall 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-12 Thread Sarah Spall via cfe-commits
https://github.com/spall 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-12 Thread Sarah Spall via cfe-commits
https://github.com/spall 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-12 Thread Sarah Spall via cfe-commits
spall wrote: I'd also update your description to mention fixing the vector > size 2 bug in FirstBitHigh as well, by making this code general purpose for both firstbitlow and firstbithigh. https://github.com/llvm/llvm-project/pull/116858 ___ cfe-commi

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

2024-12-12 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/119820 Make fast math the default for HLSL Closes #108597 >From d167cd92875f7aec8ed3ab15c3321ee9000e8481 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 12 Dec 2024 20:35:47 + Subject: [PATCH 1/2] make fast m

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

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

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

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

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

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

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

2024-12-19 Thread Sarah Spall via cfe-commits
spall wrote: Waiting on #120630 https://github.com/llvm/llvm-project/pull/119820 ___ 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-11-21 Thread Sarah Spall via cfe-commits
@@ -3158,6 +3172,166 @@ bool SPIRVInstructionSelector::selectFirstBitHigh(Register ResVReg, } } +bool SPIRVInstructionSelector::selectFirstBitLow16(Register ResVReg, + const SPIRVType *ResType, +

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

2024-11-21 Thread Sarah Spall via cfe-commits
@@ -3158,6 +3172,166 @@ bool SPIRVInstructionSelector::selectFirstBitHigh(Register ResVReg, } } +bool SPIRVInstructionSelector::selectFirstBitLow16(Register ResVReg, + const SPIRVType *ResType, +

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

2024-11-21 Thread Sarah Spall via cfe-commits
@@ -3158,6 +3172,166 @@ bool SPIRVInstructionSelector::selectFirstBitHigh(Register ResVReg, } } +bool SPIRVInstructionSelector::selectFirstBitLow16(Register ResVReg, + const SPIRVType *ResType, +

[clang] [HLSL] get inout/out ABI for array parameters working (PR #111047)

2024-12-03 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/111047 >From 119def060924f13bd1fe07f6d73ce27a1b52ea12 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Tue, 17 Sep 2024 20:25:46 + Subject: [PATCH 1/8] theoretically fix issue --- clang/lib/Sema/SemaType.cpp | 4 ++

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

2024-12-06 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118842 >From 2e932a57ccb992b856b58bec4c30c6b64f24f711 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 28 Nov 2024 16:23:57 + Subject: [PATCH 1/5] Flat casts WIP --- clang/include/clang/AST/OperationKinds.def

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

2024-12-06 Thread Sarah Spall via cfe-commits
spall wrote: Work for this PR begins at 'splat cast wip' commit. 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)

2024-12-06 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/118992 Implement HLSL Flat casting that handles splatting for arrays and structs, and vectors if splatting from a vec1. Closes #100609 and Closes #100619 Depends on #118842 >From 2e932a57ccb992b856b58bec4c30c6b64f24f7

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

2024-12-06 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From 2e932a57ccb992b856b58bec4c30c6b64f24f711 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 28 Nov 2024 16:23:57 + Subject: [PATCH 1/8] Flat casts WIP --- clang/include/clang/AST/OperationKinds.def

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

2025-01-08 Thread Sarah Spall 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 Sarah Spall 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 Sarah Spall 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 Sarah Spall 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] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-01-22 Thread Sarah Spall via cfe-commits
https://github.com/spall created https://github.com/llvm/llvm-project/pull/123977 Make the memory representation of boolean vectors in HLSL, vectors of i32. Allow boolean swizzling for boolean vectors in HLSL. Add tests for boolean vectors and boolean vector swizzling. Closes #91639 >From 50f8

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

2025-01-22 Thread Sarah Spall via cfe-commits
@@ -1461,6 +1552,7 @@ static bool castPreservesZero(const CastExpr *CE) { case CK_NonAtomicToAtomic: case CK_AtomicToNonAtomic: case CK_HLSLVectorTruncation: + case CK_HLSLAggregateCast: // TODO does CK_HLSLAggregateCast preserve zero? spall wrote: @llv

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

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

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

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

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

2025-01-15 Thread Sarah Spall via cfe-commits
https://github.com/spall closed 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] [HLSL] Implement HLSL splatting (PR #118992)

2025-02-13 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From e994824f3630ee8b224afceb6c14d980c9013112 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Dec 2024 05:14:17 + Subject: [PATCH 01/19] splat cast wip --- clang/include/clang/AST/OperationKinds.def

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-12 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/123977 >From 50f8b16bf83d70cc37f2ac7e70c9195a4c4cda02 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 16 Jan 2025 01:32:25 + Subject: [PATCH 01/12] wip --- clang/lib/CodeGen/CGExpr.cpp | 19

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-12 Thread Sarah Spall via cfe-commits
@@ -110,6 +131,24 @@ float2 HowManyFloats(float V) { return V.rr.rr; } +// CHECK-LABEL: HowManyBools +// CHECK: [[VAddr:%.*]] = alloca i32, align 4 +// CHECK-NEXT: [[Vec2Ptr:%.*]] = alloca <2 x i32>, align 8 +// CHECK-NEXT: [[Tmp:%.*]] = zext i1 {{.*}} to i32 +// CHECK-NEXT:

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

2025-02-14 Thread Sarah Spall via cfe-commits
https://github.com/spall closed 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 Aggregate splatting (PR #118992)

2025-02-14 Thread Sarah Spall via cfe-commits
https://github.com/spall edited 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 Aggregate splatting (PR #118992)

2025-02-14 Thread Sarah Spall via cfe-commits
https://github.com/spall edited 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] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-14 Thread Sarah Spall via cfe-commits
@@ -2064,6 +2064,9 @@ llvm::Value *CodeGenFunction::EmitToMemory(llvm::Value *Value, QualType Ty) { if (Ty->isExtVectorBoolType()) { llvm::Type *StoreTy = convertTypeForLoadStore(Ty, Value->getType()); +if (getLangOpts().HLSL) spall wrote: Yes, I g

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-14 Thread Sarah Spall via cfe-commits
@@ -2064,6 +2064,9 @@ llvm::Value *CodeGenFunction::EmitToMemory(llvm::Value *Value, QualType Ty) { if (Ty->isExtVectorBoolType()) { llvm::Type *StoreTy = convertTypeForLoadStore(Ty, Value->getType()); +if (getLangOpts().HLSL) spall wrote: Does thi

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

2025-02-13 Thread Sarah Spall 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-08 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/118992 >From e994824f3630ee8b224afceb6c14d980c9013112 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 6 Dec 2024 05:14:17 + Subject: [PATCH 1/9] splat cast wip --- clang/include/clang/AST/OperationKinds.def |

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-11 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/123977 >From 50f8b16bf83d70cc37f2ac7e70c9195a4c4cda02 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 16 Jan 2025 01:32:25 + Subject: [PATCH 01/11] wip --- clang/lib/CodeGen/CGExpr.cpp | 19

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

2025-03-15 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/7] error on out of bounds vector accesses --- .../clang/Basic/Dia

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

2025-03-15 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/12] extra scalar vector overloads for clamp --- .../lib/Headers/h

[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] [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] [HLSL] add extra scalar vector overloads for clamp (PR #129939)

2025-03-17 Thread Sarah Spall via cfe-commits
@@ -0,0 +1,12 @@ +// RUN: not %clang_dxc -enable-16bit-types -T cs_6_0 -HV 202x %s 2>&1 | FileCheck %s -DTEST_TYPE=half +// RUN: not %clang_dxc -enable-16bit-types -T cs_6_0 -HV 202x %s 2>&1 | FileCheck %s -DTEST_TYPE=half3 +// RUN: not %clang_dxc -enable-16bit-types -T cs_6_0

[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] 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
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: > 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] 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
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: > 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] [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] add extra scalar vector overloads for clamp (PR #129939)

2025-03-14 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/13] extra scalar vector overloads for clamp --- .../lib/Headers/h

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

[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] [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] [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] 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

<    1   2   3   4   >