mirror of
				https://github.com/encounter/dawn-cmake.git
				synced 2025-10-27 12:10:29 +00:00 
			
		
		
		
	Prevents UB for divide-by-zero and integer overflow when dividing Fixed: tint:1349 Change-Id: Ieef66d27d7aec3011628ced076b2bccc7770a8af Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108925 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| ; SPIR-V
 | |
| ; Version: 1.3
 | |
| ; Generator: Google Tint Compiler; 0
 | |
| ; Bound: 25
 | |
| ; Schema: 0
 | |
|                OpCapability Shader
 | |
|                OpMemoryModel Logical GLSL450
 | |
|                OpEntryPoint GLCompute %f "f"
 | |
|                OpExecutionMode %f LocalSize 1 1 1
 | |
|                OpName %tint_mod "tint_mod"
 | |
|                OpName %lhs "lhs"
 | |
|                OpName %rhs "rhs"
 | |
|                OpName %f "f"
 | |
|         %int = OpTypeInt 32 1
 | |
|           %1 = OpTypeFunction %int %int %int
 | |
|           %8 = OpConstantNull %int
 | |
|        %bool = OpTypeBool
 | |
| %int_n2147483648 = OpConstant %int -2147483648
 | |
|      %int_n1 = OpConstant %int -1
 | |
|       %int_1 = OpConstant %int 1
 | |
|        %void = OpTypeVoid
 | |
|          %19 = OpTypeFunction %void
 | |
|       %int_2 = OpConstant %int 2
 | |
|    %tint_mod = OpFunction %int None %1
 | |
|         %lhs = OpFunctionParameter %int
 | |
|         %rhs = OpFunctionParameter %int
 | |
|           %6 = OpLabel
 | |
|           %9 = OpIEqual %bool %rhs %8
 | |
|          %12 = OpIEqual %bool %lhs %int_n2147483648
 | |
|          %14 = OpIEqual %bool %rhs %int_n1
 | |
|          %15 = OpLogicalAnd %bool %12 %14
 | |
|          %16 = OpLogicalOr %bool %9 %15
 | |
|           %7 = OpSelect %int %16 %int_1 %rhs
 | |
|          %18 = OpSMod %int %lhs %7
 | |
|                OpReturnValue %18
 | |
|                OpFunctionEnd
 | |
|           %f = OpFunction %void None %19
 | |
|          %22 = OpLabel
 | |
|          %24 = OpFunctionCall %int %tint_mod %int_1 %int_2
 | |
|                OpReturn
 | |
|                OpFunctionEnd
 |