aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/ModuleDependencyCollector.cpp
diff options
context:
space:
mode:
authorCooper Partin <coopp@microsoft.com>2024-02-08 09:50:21 -0800
committerGitHub <noreply@github.com>2024-02-08 11:50:21 -0600
commit16d1a6486c25769d264a6ddb70a48bbb1c23c077 (patch)
treec02368e3fcb97fe1ebbfb59d624adbbf88201bdf /clang/lib/Frontend/ModuleDependencyCollector.cpp
parentc8d431e0ed6ab6276bf45d1c36466faad8e4e4d1 (diff)
downloadllvm-16d1a6486c25769d264a6ddb70a48bbb1c23c077.zip
llvm-16d1a6486c25769d264a6ddb70a48bbb1c23c077.tar.gz
llvm-16d1a6486c25769d264a6ddb70a48bbb1c23c077.tar.bz2
[DirectX] Fix HLSL bitshifts to leverage the OpenCL pipeline for bitshifting (#81030)
Fixes #55106 In HLSL bit shifts are defined to shift by shift size % type size. This contains the following changes: HLSL codegen bit shifts will be emitted as x << (y & (sizeof(x) - 1) and bitshift masking leverages the OpenCL pipeline for this. Tests were also added to validate this behavior. Before this change the following was being emitted: ; Function Attrs: noinline nounwind optnone define noundef i32 @"?shl32@@YAHHH@Z"(i32 noundef %V, i32 noundef %S) #0 { entry: %S.addr = alloca i32, align 4 %V.addr = alloca i32, align 4 store i32 %S, ptr %S.addr, align 4 store i32 %V, ptr %V.addr, align 4 %0 = load i32, ptr %V.addr, align 4 %1 = load i32, ptr %S.addr, align 4 %shl = shl i32 %0, %1 ret i32 %shl } After this change: ; Function Attrs: noinline nounwind optnone define noundef i32 @"?shl32@@YAHHH@Z"(i32 noundef %V, i32 noundef %S) #0 { entry: %S.addr = alloca i32, align 4 %V.addr = alloca i32, align 4 store i32 %S, ptr %S.addr, align 4 store i32 %V, ptr %V.addr, align 4 %0 = load i32, ptr %V.addr, align 4 %1 = load i32, ptr %S.addr, align 4 %shl.mask = and i32 %1, 31 %shl = shl i32 %0, %shl.mask ret i32 %shl } --------- Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
Diffstat (limited to 'clang/lib/Frontend/ModuleDependencyCollector.cpp')
0 files changed, 0 insertions, 0 deletions