@@ -157,6 +158,35 @@ static bool expandAnyIntrinsic(CallInst *Orig) {
return true;
}
+static bool expandLengthIntrinsic(CallInst *Orig) {
+ Value *X = Orig->getOperand(0);
+ IRBuilder<> Builder(Orig->getParent());
+ Builder.SetInsertPoint(Orig);
+ Type *Ty = X->getType()
@@ -157,6 +158,35 @@ static bool expandAnyIntrinsic(CallInst *Orig) {
return true;
}
+static bool expandLengthIntrinsic(CallInst *Orig) {
+ Value *X = Orig->getOperand(0);
+ IRBuilder<> Builder(Orig->getParent());
+ Builder.SetInsertPoint(Orig);
+ Type *Ty = X->getType()
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/101543
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner edited
https://github.com/llvm/llvm-project/pull/101433
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -112,17 +116,13 @@ struct BuiltinTypeDeclBuilder {
Ty = Record->getASTContext().getPointerType(
QualType(TTD->getTypeForDecl(), 0));
}
-return addMemberVariable("h", Ty, Access);
- }
-
- BuiltinTypeDeclBuilder &annotateHLSLResource(ResourceClass
https://github.com/bogner approved this pull request.
Looks good modulo a couple of nitpicks.
https://github.com/llvm/llvm-project/pull/101433
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c
@@ -280,18 +280,22 @@ void CGHLSLRuntime::annotateHLSLResource(const VarDecl
*D, GlobalVariable *GV) {
const auto *RD = Ty->getAsCXXRecordDecl();
if (!RD)
return;
- const auto *HLSLResAttr = RD->getAttr();
- const auto *HLSLResClassAttr = RD->getAttr();
- if (!HLSLR
@@ -81,6 +81,7 @@ struct BuiltinTypeDeclBuilder {
BuiltinTypeDeclBuilder &
addMemberVariable(StringRef Name, QualType Type,
+const llvm::SmallVector &Attrs,
bogner wrote:
Generally you don't want to pass the `SmallVector` template to a
@@ -0,0 +1,10 @@
+; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s
2>&1 | FileCheck %s
+
+; DXIL operation length does not support double overload type
+; CHECK: LLVM ERROR: Invalid Overload
+
+define noundef double @test_length_double2(<2 x double> nou
https://github.com/bogner approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/97362
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/101256
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner commented:
It'd be better to make the attribute take no arguments, and we can tell if
something is ROV by its presence alone, so:
```hlsl
[[hlsl::is_rov]] __hlsl_resource_t handle;
```
would be an ROV resource, but
```hlsl
__hlsl_resource_t handle;
```
would not.
I thi
bogner wrote:
> There is some discussion in the RFC, but I don't see a consensus on the "dot"
> intrinsic in particular. I personally haven't found the arguments in favor of
> it particularly compelling.
>
> This really needs an RFC specific to that intrinsic (class), which includes a
> clear
https://github.com/bogner commented:
If I understand correctly from reading this, there should never be a case where
both dxc and clang both choose an overload but those differ. Ie, any case where
the behaviour disagrees will result in clang failing to resolve the overload
because it's ambiguo
https://github.com/bogner commented:
We should be able to test this by defining a global or calling a function with
the `__hlsl_resource_t` type.
https://github.com/llvm/llvm-project/pull/104856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/bogner edited
https://github.com/llvm/llvm-project/pull/104856
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,60 @@
+//===- DirectX.cpp
+//---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier
@@ -0,0 +1,60 @@
+//===- DirectX.cpp
+//---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/104619
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,54 @@
+//===- DirectX.cpp
+//---===//
bogner wrote:
Something happened to the formatting here
https://github.com/llvm/llvm-project/pull/104856
___
cfe-
@@ -1154,3 +1156,70 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned
BuiltinID, CallExpr *TheCall) {
}
return false;
}
+
+static bool calculateIsIntangibleType(QualType Ty) {
+ Ty = Ty->getCanonicalTypeUnqualified();
+ if (Ty->isBuiltinType())
+return Ty->isHLSLSp
@@ -5683,6 +5685,14 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait
UTT,
return true;
return false;
}
+ case UTT_IsIntangibleType:
+if (!T->isVoidType() && !T->isIncompleteArrayType())
+ if (Self.RequireCompleteType(TInfo->getTypeLoc().getBe
@@ -1154,3 +1156,70 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned
BuiltinID, CallExpr *TheCall) {
}
return false;
}
+
+static bool calculateIsIntangibleType(QualType Ty) {
+ Ty = Ty->getCanonicalTypeUnqualified();
+ if (Ty->isBuiltinType())
+return Ty->isHLSLSp
@@ -1154,3 +1156,70 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned
BuiltinID, CallExpr *TheCall) {
}
return false;
}
+
+static bool calculateIsIntangibleType(QualType Ty) {
+ Ty = Ty->getCanonicalTypeUnqualified();
+ if (Ty->isBuiltinType())
+return Ty->isHLSLSp
@@ -27,7 +29,7 @@
using namespace clang;
-SemaHLSL::SemaHLSL(Sema &S) : SemaBase(S) {}
+SemaHLSL::SemaHLSL(Sema &S) : SemaBase(S), IsIntangibleTypeCache(8) {}
bogner wrote:
Why initialize the DenseMap with a specific number of buckets here? Why 8?
https://g
@@ -851,6 +851,21 @@ Decl *Sema::ActOnStartExportDecl(Scope *S, SourceLocation
ExportLoc,
CurContext->addDecl(D);
PushDeclContext(S, D);
+ if (getLangOpts().HLSL) {
+// exported functions cannot be in an unnamed namespace
+for (const DeclContext *DC = CurContext;
@@ -924,6 +939,23 @@ static bool checkExportedDeclContext(Sema &S, DeclContext
*DC,
/// Check that it's valid to export \p D.
static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) {
+ // HLSL: export declaration is valid only on functions
+ if (S.getLan
@@ -924,6 +939,23 @@ static bool checkExportedDeclContext(Sema &S, DeclContext
*DC,
/// Check that it's valid to export \p D.
static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) {
+ // HLSL: export declaration is valid only on functions
+ if (S.getLan
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/96823
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/108292
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/108128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner closed
https://github.com/llvm/llvm-project/pull/108128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner closed
https://github.com/llvm/llvm-project/pull/108292
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/108035
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -10,6 +10,7 @@
#define _HLSL_HLSL_INTRINSICS_H_
namespace hlsl {
+#include "hlsl_details.h"
bogner wrote:
We shouldn't `#include` a file inside a namespace. Instead, "hlsl_details.h"
should also have a `namespace hlsl {}` block around the `__detail` names
@@ -0,0 +1,35 @@
+//===- hlsl_intrinsics.h - HLSL definitions for intrinsics --===//
bogner wrote:
This comment needs updating.
https://github.com/llvm/llvm-project/pull/107292
___
cfe-commits mailing list
@@ -0,0 +1,35 @@
+//===- hlsl_intrinsics.h - HLSL 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-License-Identifier: Apache
@@ -0,0 +1,35 @@
+//===- hlsl_intrinsics.h - HLSL 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-License-Identifier: Apache
@@ -0,0 +1,18 @@
+// 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
bogner wrote:
This still has `-verify-ignore-unexpected`...
https:
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/108437
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -12397,6 +12397,9 @@ def warn_attr_min_eq_max: Warning<
def err_hlsl_attribute_number_arguments_insufficient_shader_model: Error<
"attribute %0 with %1 arguments requires shader model %2 or greater">;
+def ext_hlsl_auto_type_specifier : ExtWarn<
+ "'auto' type specifier
@@ -1347,6 +1347,8 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
Diag(LambdaBeginLoc, getLangOpts().CPlusPlus11
? diag::warn_cxx98_compat_lambda
: diag::ext_lambda);
+ if (getLangOpts().HLSL)
+Diag(Lambd
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/108445
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -43,3 +53,18 @@ void main() {
// CHECK-NEXT:call void @llvm.memset.p0.i32(ptr align 4 %ref.tmp, i8 0, i32 8,
i1 false)
// CHECK-NEXT:call void @llvm.memcpy.p0.p0.i32(ptr align 4 %this1, ptr align 4
%ref.tmp, i32 8, i1 false)
// CHECK-NEXT:%Second = getelementptr inbounds n
@@ -942,6 +942,7 @@ class BTFTagAttributedTypeLoc
struct HLSLAttributedResourceLocInfo {
SourceRange Range;
+ TypeSourceInfo *ContainedTyTSI;
bogner wrote:
`ContainedTyInfo` might be a better name - we usually only use type
abbreviations if its the whole
@@ -30,9 +31,9 @@ class Scope;
// FIXME: This can be hidden (as static function in SemaHLSL.cpp) once we no
// longer need to create builtin buffer types in HLSLExternalSemaSource.
-bool CreateHLSLAttributedResourceType(Sema &S, QualType Wrapped,
-
@@ -114,19 +115,30 @@ struct BuiltinTypeDeclBuilder {
AccessSpecifier Access = AccessSpecifier::AS_private) {
if (Record->isCompleteDefinition())
return *this;
+
+TypeSourceInfo *ElementTypeTSI = nullptr;
bogner wrote:
Same nami
@@ -563,18 +566,23 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr
&AL) {
D->addAttr(NewAttr);
}
-bool clang::CreateHLSLAttributedResourceType(Sema &S, QualType Wrapped,
- ArrayRef AttrList,
-
@@ -563,18 +566,23 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr
&AL) {
D->addAttr(NewAttr);
}
-bool clang::CreateHLSLAttributedResourceType(Sema &S, QualType Wrapped,
- ArrayRef AttrList,
-
@@ -114,19 +115,30 @@ struct BuiltinTypeDeclBuilder {
AccessSpecifier Access = AccessSpecifier::AS_private) {
if (Record->isCompleteDefinition())
return *this;
+
+TypeSourceInfo *ElementTypeTSI = nullptr;
+
QualType Ty = Record->getASTContex
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/107954
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner edited
https://github.com/llvm/llvm-project/pull/107292
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -finclude-default-header -triple
dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only
-disable-llvm-passes -verify
bogner wrote:
The `-emit-llvm-only` and `-disable-llvm-passes` flags don't really do anything
https://github.com/bogner approved this pull request.
looks good, thanks!
https://github.com/llvm/llvm-project/pull/107292
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/108456
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -30,15 +29,15 @@ RWBuffer Buffer;
// CHECK-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <> implicit class RWBuffer definition
// CHECK: FinalAttr 0x{{[0-9A-Fa-f]+}} <> Implicit final
-// CHECK-NEXT: implicit h 'element_type *
{{\[\[}}hlsl::resource_class(UAV)]]':'element_type *
https://github.com/bogner edited
https://github.com/llvm/llvm-project/pull/108456
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1,19 +1,21 @@
-// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm
-disable-llvm-passes -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple spirv-vulkan-library -x hlsl -emit-llvm
-disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-SPIRV
@@ -489,3 +494,100 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
GV->eraseFromParent();
}
}
+
+// Returns handle type of a resource, if the type is a resource
+// or an array of resources
+static const HLSLAttributedResourceType *findHandleTypeOnResource(QualTy
@@ -489,3 +494,100 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
GV->eraseFromParent();
}
}
+
+// Returns handle type of a resource, if the type is a resource
+// or an array of resources
+static const HLSLAttributedResourceType *findHandleTypeOnResource(QualTy
@@ -489,3 +494,100 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
GV->eraseFromParent();
}
}
+
+// Returns handle type of a resource, if the type is a resource
+// or an array of resources
+static const HLSLAttributedResourceType *findHandleTypeOnResource(QualTy
@@ -489,3 +494,100 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
GV->eraseFromParent();
}
}
+
+// Returns handle type of a resource, if the type is a resource
+// or an array of resources
+static const HLSLAttributedResourceType *findHandleTypeOnResource(QualTy
@@ -489,3 +494,100 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
GV->eraseFromParent();
}
}
+
+// Returns handle type of a resource, if the type is a resource
+// or an array of resources
+static const HLSLAttributedResourceType *findHandleTypeOnResource(QualTy
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/106860
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/110327
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/111010
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bogner wrote:
It would probably be good to have some test coverage for int16, half, and
double here
https://github.com/llvm/llvm-project/pull/111010
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lis
@@ -2235,3 +2280,107 @@ QualType SemaHLSL::getInoutParameterType(QualType Ty) {
Ty.addRestrict();
return Ty;
}
+
+void SemaHLSL::ActOnVariableDeclarator(VarDecl *VD) {
+ if (VD->hasGlobalStorage()) {
+// make sure the declaration has a complete type
+if (SemaRef.Re
@@ -102,6 +152,15 @@ class SemaHLSL : public SemaBase {
llvm::DenseMap
LocsForHLSLAttributedResources;
+
+ // List of all resource bindings
+ ResourceBindings Bindings;
+
+private:
+ void FindResourcesOnVarDecl(VarDecl *D);
+ void FindResourcesOnUserRecordDecl(const
@@ -2235,3 +2280,107 @@ QualType SemaHLSL::getInoutParameterType(QualType Ty) {
Ty.addRestrict();
return Ty;
}
+
+void SemaHLSL::ActOnVariableDeclarator(VarDecl *VD) {
+ if (VD->hasGlobalStorage()) {
+// make sure the declaration has a complete type
+if (SemaRef.Re
@@ -4593,6 +4593,44 @@ def HLSLResourceBinding: InheritableAttr {
let LangOpts = [HLSL];
let Args = [StringArgument<"Slot">, StringArgument<"Space", 1>];
let Documentation = [HLSLResourceBindingDocs];
+ let AdditionalMembers = [{
+ enum class RegisterType : unsigned
@@ -985,88 +1026,92 @@ SemaHLSL::TakeLocForHLSLAttribute(const
HLSLAttributedResourceType *RT) {
return LocInfo;
}
-// get the record decl from a var decl that we expect
-// represents a resource
-static CXXRecordDecl *getRecordDeclFromVarDecl(VarDecl *VD) {
- const Type *
@@ -83,6 +81,49 @@ static RegisterType getRegisterType(StringRef Slot) {
}
}
+static ResourceClass getResourceClass(RegisterType RT) {
+ switch (RT) {
+ case RegisterType::SRV:
+return ResourceClass::SRV;
+ case RegisterType::UAV:
+return ResourceClass::UAV;
+ ca
@@ -985,88 +1026,92 @@ SemaHLSL::TakeLocForHLSLAttribute(const
HLSLAttributedResourceType *RT) {
return LocInfo;
}
-// get the record decl from a var decl that we expect
-// represents a resource
-static CXXRecordDecl *getRecordDeclFromVarDecl(VarDecl *VD) {
- const Type *
bogner wrote:
> > Despite all of this, DXC does indeed support 16- and 64-bit overloads, as
> > seen here: https://hlsl.godbolt.org/z/qbc17xz35
> > Note that the return type of the operation is not overloaded - all of the
> > overloads of this function return uint.
>
> Why is the return type n
https://github.com/bogner approved this pull request.
Looks good once Chris's comments and the clang-format issue are resolved.
https://github.com/llvm/llvm-project/pull/111010
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.
@@ -489,6 +542,9 @@ class OpLowerer {
case Intrinsic::dx_typedBufferStore:
HasErrors |= lowerTypedBufferStore(F);
break;
+ case Intrinsic::dx_splitdouble:
bogner wrote:
There will need to be some logic in DXILOpLowering, because we n
https://github.com/bogner edited
https://github.com/llvm/llvm-project/pull/109331
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -928,6 +928,78 @@ float3 exp2(float3);
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_exp2)
float4 exp2(float4);
+//===--===//
+// firstbithigh builtins
+//===
@@ -489,3 +494,100 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
GV->eraseFromParent();
}
}
+
+// Returns handle type of a resource, if the type is a resource
+// or an array of resources
+static const HLSLAttributedResourceType *findHandleTypeOnResource(QualTy
@@ -985,88 +1034,94 @@ SemaHLSL::TakeLocForHLSLAttribute(const
HLSLAttributedResourceType *RT) {
return LocInfo;
}
-// get the record decl from a var decl that we expect
-// represents a resource
-static CXXRecordDecl *getRecordDeclFromVarDecl(VarDecl *VD) {
- const Type *
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/111203
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -28,13 +28,60 @@ class AttributeCommonInfo;
class IdentifierInfo;
class ParsedAttr;
class Scope;
+class VarDecl;
+
+using llvm::dxil::ResourceClass;
// FIXME: This can be hidden (as static function in SemaHLSL.cpp) once we no
// longer need to create builtin buffer types
@@ -5622,6 +5622,9 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl
*D,
getCUDARuntime().handleVarRegistration(D, *GV);
}
+ if (LangOpts.HLSL)
+getHLSLRuntime().handleGlobalVarDefinition(D, GV);
bogner wrote:
Pre-SM6.6 this will emit a
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/112573
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/111883
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bogner approved this pull request.
Could also consider checking for `ret void` instead, as that's more flexible if
someone were to add another test case later in the file. This seems fine too
though.
https://github.com/llvm/llvm-project/pull/112461
__
https://github.com/bogner approved this pull request.
I'm a little bit worried about how subtle the naming difference is from when we
want to talk about if the builtin itself is intangible or if the type is
transitively intangible, but that might just be because we're replacing one
name with t
https://github.com/bogner approved this pull request.
https://github.com/llvm/llvm-project/pull/111752
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -18901,6 +18901,159 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0},
nullptr, "hlsl.radians");
}
+ case Builtin::BI__builtin_hlsl_splitdouble: {
+
+assert((E->getArg(0)->getType()->hasFlo
@@ -4681,6 +4682,14 @@ void CallArg::copyInto(CodeGenFunction &CGF, Address
Addr) const {
IsUsed = true;
}
+void CodeGenFunction::EmitWritebacks(CodeGenFunction &CGF,
+ const CallArgList &Args) {
+ if (getTarget().getCXXABI().areArgsDest
@@ -18901,6 +18901,159 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0},
nullptr, "hlsl.radians");
}
+ case Builtin::BI__builtin_hlsl_splitdouble: {
+
+assert((E->getArg(0)->getType()->hasFlo
@@ -18901,6 +18901,159 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0},
nullptr, "hlsl.radians");
}
+ case Builtin::BI__builtin_hlsl_splitdouble: {
+
+assert((E->getArg(0)->getType()->hasFlo
@@ -47,6 +47,7 @@ def ResRetInt32Ty : DXILOpParamType;
def HandleTy : DXILOpParamType;
def ResBindTy : DXILOpParamType;
def ResPropsTy : DXILOpParamType;
+def ResSplitDoubleTy : DXILOpParamType;
bogner wrote:
This should just be "SplitDoubleTy". The types that
@@ -461,6 +479,27 @@ class OpLowerer {
});
}
+ [[nodiscard]] bool lowerSplitDouble(Function &F) {
+IRBuilder<> &IRB = OpBuilder.getIRB();
+return replaceFunction(F, [&](CallInst *CI) -> Error {
+ IRB.SetInsertPoint(CI);
+
+ Value *Arg0 = CI->getArgOper
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple
dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -O1 -o - |
FileCheck %s
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple
spirv-vulkan-library %s -fnative-half-type -emit-ll
@@ -264,6 +264,24 @@ class OpLowerer {
return lowerToBindAndAnnotateHandle(F);
}
+ Error replaceSplitDoubleCallUsages(CallInst *Intrin, CallInst *Op) {
+IRBuilder<> &IRB = OpBuilder.getIRB();
+
+for (Use &U : make_early_inc_range(Intrin->uses())) {
+ if (au
bogner wrote:
It is not correct to limit firstbithigh to 32 bit integers. There are a couple
of reasons that might make one think that it is, but we do in fact want/need to
support int16 and int64 here.
1. The [HLSL
docs](https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/firstbithi
@@ -564,6 +564,30 @@ def CBits : DXILOp<31, unary> {
let attributes = [Attributes];
}
+def FBH : DXILOp<33, unary> {
+ let Doc = "Returns the location of the first set bit starting from "
+"the highest order bit and working downward.";
+ let LLVMIntrinsic = i
https://github.com/bogner edited
https://github.com/llvm/llvm-project/pull/111082
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
501 - 600 of 962 matches
Mail list logo