-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[DirectX] only allow intrinsics defined in DXIL.td #128613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
69f0295
3aacbd7
f19dcf6
d40e8ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -770,8 +770,20 @@ class OpLowerer { | |
continue; | ||
Intrinsic::ID ID = F.getIntrinsicID(); | ||
switch (ID) { | ||
default: | ||
// NOTE: Skip dx_resource_casthandle here. They are | ||
// resolved after this loop in cleanupHandleCasts. | ||
case Intrinsic::dx_resource_casthandle: | ||
// NOTE: llvm.dbg.value is supported as is in DXIL. | ||
case Intrinsic::dbg_value: | ||
case Intrinsic::not_intrinsic: | ||
continue; | ||
default: { | ||
DiagnosticInfoUnsupported Diag( | ||
F, "Unsupported intrinsic for DXIL lowering"); | ||
M.getContext().diagnose(Diag); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also set HasErrors here? It doesn't actually matter, since we won't leave the casthandles in an inconsistent state and we don't key anything else off of that, but it seems weird not to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add it for consistency. We don't seem to be able to do multiple Diagnostic errors per test case. Ie I can only invoke There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's because you're using |
||
HasErrors |= true; | ||
break; | ||
} | ||
#define DXIL_OP_INTRINSIC(OpCode, Intrin, ...) \ | ||
case Intrin: \ | ||
HasErrors |= replaceFunctionWithOp( \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,7 +286,7 @@ declare <3 x half> @llvm.dx.nclamp.v3f16(<3 x half>, <3 x half>, <3 x half>) | |
declare <4 x float> @llvm.dx.nclamp.v4f32(<4 x float>, <4 x float>, <4 x float>) | ||
declare <2 x double> @llvm.dx.nclamp.v2f64(<2 x double>, <2 x double>, <2 x double>) | ||
declare <4 x i32> @llvm.dx.sclamp.v4i32(<4 x i32>, <4 x i32>, <4 x i32>) | ||
declare <3 x i16> @llvm.dx.uclamp.v3i32(<3 x i16>, <3 x i32>, <3 x i16>) | ||
declare <3 x i16> @llvm.dx.uclamp.v3i16(<3 x i16>, <3 x i16>, <3 x i16>) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's just to make the declaration match the function that is actually used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well one its a typo. but it broke when I changed to error by default.There was no uclamp.v3i32 usage only a declare. There was a uclamp.v3i16 usage but no declare. If we had a use then after the |
||
declare <4 x i32> @llvm.dx.uclamp.v4i32(<4 x i32>, <4 x i32>, <4 x i32>) | ||
declare <2 x i64> @llvm.dx.uclamp.v2i64(<2 x i64>, <2 x i64>, <2 x i64>) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s | ||
|
||
; CHECK: error: <unknown>:0:0: in function llvm.vector.reduce.and.v4i32 i32 (<4 x i32>): Unsupported intrinsic for DXIL lowering | ||
define i32 @fn_and(<4 x i32> %0) local_unnamed_addr #0 { | ||
%2 = tail call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> %0) | ||
ret i32 %2 | ||
} | ||
|
||
declare i32 @llvm.vector.reduce.and.v4i32(<4 x i32>) | ||
|
||
attributes #0 = { convergent norecurse nounwind "hlsl.export"} |
Uh oh!
There was an error while loading. Please reload this page.