-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
Description
https://godbolt.org/z/f6r7ThrcG
For the following shader, Clang emits the llvm.fshl.i64 intrinsic which is not supported for DXIL lowering.
struct Pair {
int32_t a;
int32_t b;
};
RWStructuredBuffer<Pair> src;
RWStructuredBuffer<Pair> dest;
Pair Swap(Pair p) {
Pair result;
result.a = p.b;
result.b = p.a;
return result;
}
[numthreads(1, 1, 1)]
void CSMain(uint3 Tid : SV_GroupThreadID) {
dest[Tid.x] = Swap(src[Tid.x]);
}edit: This can also be generated with a rotation left function in HLSL demonstrated here: https://godbolt.org/z/a44Pnohn4
define void @CSMain() local_unnamed_addr #1 {
entry:
%0 = tail call target("dx.RawBuffer", %struct.Pair, 1, 0) @llvm.dx.resource.handlefromimplicitbinding.tdx.RawBuffer_s_struct.Pairs_1_0t(i32 0, i32 0, i32 1, i32 0, ptr nonnull @.str)
%1 = tail call target("dx.RawBuffer", %struct.Pair, 1, 0) @llvm.dx.resource.handlefromimplicitbinding.tdx.RawBuffer_s_struct.Pairs_1_0t(i32 2, i32 0, i32 1, i32 0, ptr nonnull @.str.2)
%2 = tail call i32 @llvm.dx.thread.id.in.group(i32 0)
%3 = tail call noundef nonnull align 1 dereferenceable(8) ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_s_struct.Pairs_1_0t(target("dx.RawBuffer", %struct.Pair, 1, 0) %0, i32 %2)
%4 = load i64, ptr %3, align 1
%5 = tail call noundef nonnull align 1 dereferenceable(8) ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_s_struct.Pairs_1_0t(target("dx.RawBuffer", %struct.Pair, 1, 0) %1, i32 %2)
%ref.tmp.i.sroa.0.0.insert.insert = tail call i64 @llvm.fshl.i64(i64 %4, i64 %4, i64 32)
store i64 %ref.tmp.i.sroa.0.0.insert.insert, ptr %5, align 1
ret void
}Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Active