From f5818dc56c9aec4519c3a887c5ee0998b704b133 Mon Sep 17 00:00:00 2001 From: ivanhlgao Date: Fri, 22 Nov 2024 19:10:53 +0800 Subject: [PATCH] Fix Internal Compiler error: cast() argument of incompatible type! (#7016) -fix max( min16float4 (0,0,0,0), min16float4 (0,0,0,0)) compile error --- tools/clang/lib/CodeGen/CGHLSLMS.cpp | 2 ++ tools/clang/test/DXC/min16vector_constant_max.hlsl | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 tools/clang/test/DXC/min16vector_constant_max.hlsl diff --git a/tools/clang/lib/CodeGen/CGHLSLMS.cpp b/tools/clang/lib/CodeGen/CGHLSLMS.cpp index 72f5a791ab..02a8dc84ac 100644 --- a/tools/clang/lib/CodeGen/CGHLSLMS.cpp +++ b/tools/clang/lib/CodeGen/CGHLSLMS.cpp @@ -3991,6 +3991,8 @@ RValue CGMSHLSLRuntime::EmitHLSLBuiltinCallExpr(CodeGenFunction &CGF, // Not support half Eval yet. allOperandImm = false; break; + } else if (operand->getType()->isVectorTy()) { + allOperandImm = false; } } if (allOperandImm) { diff --git a/tools/clang/test/DXC/min16vector_constant_max.hlsl b/tools/clang/test/DXC/min16vector_constant_max.hlsl new file mode 100644 index 0000000000..d6ce71b885 --- /dev/null +++ b/tools/clang/test/DXC/min16vector_constant_max.hlsl @@ -0,0 +1,7 @@ +// Validate that the offsets for a min16float vector is correct if 16-bit types aren't enabled +// RUN: %dxc -T ps_6_0 -Od -Zi -Qembed_debug %s | FileCheck %s + +void main( out min16float4 outColor : SV_Target0) +{ + outColor = max( min16float4 (0,0,0,0), min16float4 (0,0,0,0)); +} \ No newline at end of file