tint/writer/spirv: Inline constant expressions

This is required to handle materialized values, and for constant
expressions.

Bug: tint:1504
Change-Id: If0a49e9b03566c06aa6e4e4c284fc427e1541e91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92082
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
Ben Clayton
2022-06-01 15:57:22 +00:00
committed by Dawn LUCI CQ
parent 609ce6de8d
commit 8e3485248e
242 changed files with 10432 additions and 10031 deletions

View File

@@ -12,9 +12,9 @@
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%7 = OpConstantNull %float
%f = OpFunction %void None %1
%4 = OpLabel
%8 = OpFRem %float %float_1 %float_0
%8 = OpFRem %float %float_1 %7
OpReturn
OpFunctionEnd

View File

@@ -12,9 +12,9 @@
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%7 = OpConstantNull %int
%f = OpFunction %void None %1
%4 = OpLabel
%8 = OpSMod %int %int_1 %int_0
%8 = OpSMod %int %int_1 %7
OpReturn
OpFunctionEnd

View File

@@ -12,9 +12,9 @@
%1 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%uint_0 = OpConstant %uint 0
%7 = OpConstantNull %uint
%f = OpFunction %void None %1
%4 = OpLabel
%8 = OpUMod %uint %uint_1 %uint_0
%8 = OpUMod %uint %uint_1 %7
OpReturn
OpFunctionEnd

View File

@@ -16,13 +16,13 @@
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%10 = OpConstantComposite %v3int %int_1 %int_2 %int_3
%int_0 = OpConstant %int 0
%11 = OpConstantNull %int
%_ptr_Function_v3int = OpTypePointer Function %v3int
%15 = OpConstantNull %v3int
%f = OpFunction %void None %1
%4 = OpLabel
%13 = OpVariable %_ptr_Function_v3int Function %15
%16 = OpCompositeConstruct %v3int %int_0 %int_0 %int_0
%16 = OpCompositeConstruct %v3int %11 %11 %11
%12 = OpSMod %v3int %10 %16
OpReturn
OpFunctionEnd

View File

@@ -16,13 +16,13 @@
%uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3
%10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
%uint_0 = OpConstant %uint 0
%11 = OpConstantNull %uint
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%15 = OpConstantNull %v3uint
%f = OpFunction %void None %1
%4 = OpLabel
%13 = OpVariable %_ptr_Function_v3uint Function %15
%16 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %uint_0
%16 = OpCompositeConstruct %v3uint %11 %11 %11
%12 = OpUMod %v3uint %10 %16
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Bound: 16
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,17 +16,16 @@
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
%9 = OpConstantNull %float
%float_0 = OpConstant %float 0
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_float Function %9
%b = OpVariable %_ptr_Function_float Function %9
OpStore %a %float_1
OpStore %b %float_0
%12 = OpLoad %float %a
OpStore %b %9
%11 = OpLoad %float %a
%12 = OpLoad %float %b
%13 = OpLoad %float %b
%14 = OpLoad %float %b
%15 = OpFAdd %float %13 %14
%16 = OpFRem %float %12 %15
%14 = OpFAdd %float %12 %13
%15 = OpFRem %float %11 %14
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Bound: 16
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,17 +16,16 @@
%int_1 = OpConstant %int 1
%_ptr_Function_int = OpTypePointer Function %int
%9 = OpConstantNull %int
%int_0 = OpConstant %int 0
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_int Function %9
%b = OpVariable %_ptr_Function_int Function %9
OpStore %a %int_1
OpStore %b %int_0
%12 = OpLoad %int %a
OpStore %b %9
%11 = OpLoad %int %a
%12 = OpLoad %int %b
%13 = OpLoad %int %b
%14 = OpLoad %int %b
%15 = OpIAdd %int %13 %14
%16 = OpSMod %int %12 %15
%14 = OpIAdd %int %12 %13
%15 = OpSMod %int %11 %14
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Bound: 16
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,17 +16,16 @@
%uint_1 = OpConstant %uint 1
%_ptr_Function_uint = OpTypePointer Function %uint
%9 = OpConstantNull %uint
%uint_0 = OpConstant %uint 0
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_uint Function %9
%b = OpVariable %_ptr_Function_uint Function %9
OpStore %a %uint_1
OpStore %b %uint_0
%12 = OpLoad %uint %a
OpStore %b %9
%11 = OpLoad %uint %a
%12 = OpLoad %uint %b
%13 = OpLoad %uint %b
%14 = OpLoad %uint %b
%15 = OpIAdd %uint %13 %14
%16 = OpUMod %uint %12 %15
%14 = OpIAdd %uint %12 %13
%15 = OpUMod %uint %11 %14
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Bound: 24
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -20,21 +20,20 @@
%10 = OpConstantComposite %v3int %int_1 %int_2 %int_3
%_ptr_Function_v3int = OpTypePointer Function %v3int
%13 = OpConstantNull %v3int
%int_0 = OpConstant %int 0
%14 = OpConstantNull %int
%_ptr_Function_int = OpTypePointer Function %int
%17 = OpConstantNull %int
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_v3int Function %13
%b = OpVariable %_ptr_Function_int Function %17
%23 = OpVariable %_ptr_Function_v3int Function %13
%b = OpVariable %_ptr_Function_int Function %14
%22 = OpVariable %_ptr_Function_v3int Function %13
OpStore %a %10
OpStore %b %int_0
%18 = OpLoad %v3int %a
OpStore %b %14
%17 = OpLoad %v3int %a
%18 = OpLoad %int %b
%19 = OpLoad %int %b
%20 = OpLoad %int %b
%21 = OpIAdd %int %19 %20
%24 = OpCompositeConstruct %v3int %21 %21 %21
%22 = OpSMod %v3int %18 %24
%20 = OpIAdd %int %18 %19
%23 = OpCompositeConstruct %v3int %20 %20 %20
%21 = OpSMod %v3int %17 %23
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Bound: 24
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -20,21 +20,20 @@
%10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%13 = OpConstantNull %v3uint
%uint_0 = OpConstant %uint 0
%14 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%17 = OpConstantNull %uint
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_v3uint Function %13
%b = OpVariable %_ptr_Function_uint Function %17
%23 = OpVariable %_ptr_Function_v3uint Function %13
%b = OpVariable %_ptr_Function_uint Function %14
%22 = OpVariable %_ptr_Function_v3uint Function %13
OpStore %a %10
OpStore %b %uint_0
%18 = OpLoad %v3uint %a
OpStore %b %14
%17 = OpLoad %v3uint %a
%18 = OpLoad %uint %b
%19 = OpLoad %uint %b
%20 = OpLoad %uint %b
%21 = OpIAdd %uint %19 %20
%24 = OpCompositeConstruct %v3uint %21 %21 %21
%22 = OpUMod %v3uint %18 %24
%20 = OpIAdd %uint %18 %19
%23 = OpCompositeConstruct %v3uint %20 %20 %20
%21 = OpUMod %v3uint %17 %23
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; Bound: 14
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,15 +16,14 @@
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
%9 = OpConstantNull %float
%float_0 = OpConstant %float 0
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_float Function %9
%b = OpVariable %_ptr_Function_float Function %9
OpStore %a %float_1
OpStore %b %float_0
%12 = OpLoad %float %a
%13 = OpLoad %float %b
%14 = OpFRem %float %12 %13
OpStore %b %9
%11 = OpLoad %float %a
%12 = OpLoad %float %b
%13 = OpFRem %float %11 %12
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; Bound: 14
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,15 +16,14 @@
%int_1 = OpConstant %int 1
%_ptr_Function_int = OpTypePointer Function %int
%9 = OpConstantNull %int
%int_0 = OpConstant %int 0
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_int Function %9
%b = OpVariable %_ptr_Function_int Function %9
OpStore %a %int_1
OpStore %b %int_0
%12 = OpLoad %int %a
%13 = OpLoad %int %b
%14 = OpSMod %int %12 %13
OpStore %b %9
%11 = OpLoad %int %a
%12 = OpLoad %int %b
%13 = OpSMod %int %11 %12
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; Bound: 14
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,15 +16,14 @@
%uint_1 = OpConstant %uint 1
%_ptr_Function_uint = OpTypePointer Function %uint
%9 = OpConstantNull %uint
%uint_0 = OpConstant %uint 0
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_uint Function %9
%b = OpVariable %_ptr_Function_uint Function %9
OpStore %a %uint_1
OpStore %b %uint_0
%12 = OpLoad %uint %a
%13 = OpLoad %uint %b
%14 = OpUMod %uint %12 %13
OpStore %b %9
%11 = OpLoad %uint %a
%12 = OpLoad %uint %b
%13 = OpUMod %uint %11 %12
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -20,19 +20,18 @@
%10 = OpConstantComposite %v3int %int_1 %int_2 %int_3
%_ptr_Function_v3int = OpTypePointer Function %v3int
%13 = OpConstantNull %v3int
%int_0 = OpConstant %int 0
%14 = OpConstantNull %int
%_ptr_Function_int = OpTypePointer Function %int
%17 = OpConstantNull %int
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_v3int Function %13
%b = OpVariable %_ptr_Function_int Function %17
%21 = OpVariable %_ptr_Function_v3int Function %13
%b = OpVariable %_ptr_Function_int Function %14
%20 = OpVariable %_ptr_Function_v3int Function %13
OpStore %a %10
OpStore %b %int_0
%18 = OpLoad %v3int %a
%19 = OpLoad %int %b
%22 = OpCompositeConstruct %v3int %19 %19 %19
%20 = OpSMod %v3int %18 %22
OpStore %b %14
%17 = OpLoad %v3int %a
%18 = OpLoad %int %b
%21 = OpCompositeConstruct %v3int %18 %18 %18
%19 = OpSMod %v3int %17 %21
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -20,19 +20,18 @@
%10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%13 = OpConstantNull %v3uint
%uint_0 = OpConstant %uint 0
%14 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%17 = OpConstantNull %uint
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_v3uint Function %13
%b = OpVariable %_ptr_Function_uint Function %17
%21 = OpVariable %_ptr_Function_v3uint Function %13
%b = OpVariable %_ptr_Function_uint Function %14
%20 = OpVariable %_ptr_Function_v3uint Function %13
OpStore %a %10
OpStore %b %uint_0
%18 = OpLoad %v3uint %a
%19 = OpLoad %uint %b
%22 = OpCompositeConstruct %v3uint %19 %19 %19
%20 = OpUMod %v3uint %18 %22
OpStore %b %14
%17 = OpLoad %v3uint %a
%18 = OpLoad %uint %b
%21 = OpCompositeConstruct %v3uint %18 %18 %18
%19 = OpUMod %v3uint %17 %21
OpReturn
OpFunctionEnd