Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmake/modules/HCT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function(add_hlsl_hctgen mode)
${opcodes_json})

get_filename_component(output_extension ${full_output} LAST_EXT)
string(SUBSTRING ${output_extension} 1 -1 output_extension_no_dot)
set(target_name "${mode}_${output_extension_no_dot}")

if (CLANG_FORMAT_EXE AND output_extension MATCHES "\.h|\.cpp|\.inl")
set(format_cmd COMMAND ${CLANG_FORMAT_EXE} -i ${temp_output})
Expand Down Expand Up @@ -132,8 +134,8 @@ function(add_hlsl_hctgen mode)
DEPENDS ${output}
COMMENT "Verifying clang-format results...")

add_custom_target(${mode}
add_custom_target(${target_name}
DEPENDS ${temp_output}.stamp)

add_dependencies(HCTGen ${mode})
add_dependencies(HCTGen ${target_name})
endfunction()
1 change: 1 addition & 0 deletions lib/DXIL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# This file is distributed under the University of Illinois Open Source License.
# See LICENSE.TXT for details.

add_hlsl_hctgen(DxilCounters OUTPUT DxilCounters.cpp CODE_TAG)
add_hlsl_hctgen(DxilOperations OUTPUT DxilOperations.cpp CODE_TAG)
add_hlsl_hctgen(DxilShaderModel OUTPUT DxilShaderModel.cpp CODE_TAG)
add_hlsl_hctgen(DxilMetadata OUTPUT DxilMetadataHelper.cpp CODE_TAG)
Expand Down
32 changes: 18 additions & 14 deletions lib/DXIL/DxilCounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,18 @@ bool CountDxilOp_atomic(unsigned op) {
return op == 70 || (78 <= op && op <= 79);
}
bool CountDxilOp_barrier(unsigned op) {
// Instructions: Barrier=80
return op == 80;
// Instructions: Barrier=80, BarrierByMemoryType=244,
// BarrierByMemoryHandle=245, BarrierByNodeRecordHandle=246
return op == 80 || (244 <= op && op <= 246);
}
bool CountDxilOp_floats(unsigned op) {
// Instructions: FAbs=6, Saturate=7, IsNaN=8, IsInf=9, IsFinite=10,
// IsNormal=11, Cos=12, Sin=13, Tan=14, Acos=15, Asin=16, Atan=17, Hcos=18,
// Hsin=19, Htan=20, Exp=21, Frc=22, Log=23, Sqrt=24, Rsqrt=25, Round_ne=26,
// Round_ni=27, Round_pi=28, Round_z=29, FMax=35, FMin=36, Fma=47, Dot2=54,
// Dot3=55, Dot4=56, Dot2AddHalf=162
// Dot3=55, Dot4=56, Dot2AddHalf=162, FDot=311
return (6 <= op && op <= 29) || (35 <= op && op <= 36) || op == 47 ||
(54 <= op && op <= 56) || op == 162;
(54 <= op && op <= 56) || op == 162 || op == 311;
}
bool CountDxilOp_gs_cut(unsigned op) {
// Instructions: CutStream=98, EmitThenCutStream=99
Expand All @@ -155,9 +156,9 @@ bool CountDxilOp_gs_emit(unsigned op) {
}
bool CountDxilOp_ints(unsigned op) {
// Instructions: IMax=37, IMin=38, IMul=41, IMad=48, Ibfe=51,
// Dot4AddI8Packed=163
// Dot4AddI8Packed=163, VectorReduceAnd=309, VectorReduceOr=310
return (37 <= op && op <= 38) || op == 41 || op == 48 || op == 51 ||
op == 163;
op == 163 || (309 <= op && op <= 310);
}
bool CountDxilOp_sig_ld(unsigned op) {
// Instructions: LoadInput=4, LoadOutputControlPoint=103,
Expand All @@ -175,16 +176,18 @@ bool CountDxilOp_tex_bias(unsigned op) {
}
bool CountDxilOp_tex_cmp(unsigned op) {
// Instructions: SampleCmp=64, SampleCmpLevelZero=65, TextureGatherCmp=74,
// SampleCmpLevel=224
return (64 <= op && op <= 65) || op == 74 || op == 224;
// SampleCmpLevel=224, SampleCmpGrad=254, SampleCmpBias=255
return (64 <= op && op <= 65) || op == 74 || op == 224 ||
(254 <= op && op <= 255);
}
bool CountDxilOp_tex_grad(unsigned op) {
// Instructions: SampleGrad=63
return op == 63;
}
bool CountDxilOp_tex_load(unsigned op) {
// Instructions: TextureLoad=66, BufferLoad=68, RawBufferLoad=139
return op == 66 || op == 68 || op == 139;
// Instructions: TextureLoad=66, BufferLoad=68, RawBufferLoad=139,
// RawBufferVectorLoad=303
return op == 66 || op == 68 || op == 139 || op == 303;
}
bool CountDxilOp_tex_norm(unsigned op) {
// Instructions: Sample=60, SampleLevel=62, TextureGather=73,
Expand All @@ -195,17 +198,18 @@ bool CountDxilOp_tex_store(unsigned op) {
// Instructions: TextureStore=67, BufferStore=69, RawBufferStore=140,
// WriteSamplerFeedback=174, WriteSamplerFeedbackBias=175,
// WriteSamplerFeedbackLevel=176, WriteSamplerFeedbackGrad=177,
// TextureStoreSample=225
// TextureStoreSample=225, RawBufferVectorStore=304
return op == 67 || op == 69 || op == 140 || (174 <= op && op <= 177) ||
op == 225;
op == 225 || op == 304;
}
bool CountDxilOp_uints(unsigned op) {
// Instructions: Bfrev=30, Countbits=31, FirstbitLo=32, FirstbitHi=33,
// FirstbitSHi=34, UMax=39, UMin=40, UMul=42, UDiv=43, UAddc=44, USubb=45,
// UMad=49, Msad=50, Ubfe=52, Bfi=53, Dot4AddU8Packed=164
// UMad=49, Msad=50, Ubfe=52, Bfi=53, Dot4AddU8Packed=164,
// VectorReduceAnd=309, VectorReduceOr=310
return (30 <= op && op <= 34) || (39 <= op && op <= 40) ||
(42 <= op && op <= 45) || (49 <= op && op <= 50) ||
(52 <= op && op <= 53) || op == 164;
(52 <= op && op <= 53) || op == 164 || (309 <= op && op <= 310);
}
// Counter functions for llvm ops:
bool CountLlvmOp_atomic(unsigned op) {
Expand Down
2 changes: 1 addition & 1 deletion tools/clang/lib/Sema/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(LLVM_LINK_COMPONENTS
# HLSL Change Begin
add_hlsl_hctgen(DxilIntrinsicTables BUILD_DIR OUTPUT gen_intrin_main_tables_15.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
list(APPEND LLVM_COMMON_DEPENDS DxilIntrinsicTables)
list(APPEND LLVM_COMMON_DEPENDS DxilIntrinsicTables_h)
# HLSL Change End

add_clang_library(clangSema
Expand Down
Loading