[tools]: Generate intrinisic test cases

Add test/intrinsics/intrinsics.wgsl.tmpl that generates a vast set of intrinsic overload permutations into test/intrinsics/gen/...

Add expected output for all of these, including 'SKIP' headers for those that currently fail.

Fixed: tint:832
Change-Id: Id6888df52c07f35e7a55199f2ad4d842c6e2595c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53051
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
diff --git a/test/intrinsics/gen/abs/002533.wgsl b/test/intrinsics/gen/abs/002533.wgsl
new file mode 100644
index 0000000..26a968f
--- /dev/null
+++ b/test/intrinsics/gen/abs/002533.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_002533() {
+  var res: vec4<f32> = abs(vec4<f32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_002533();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_002533();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_002533();
+}
diff --git a/test/intrinsics/gen/abs/002533.wgsl.expected.hlsl b/test/intrinsics/gen/abs/002533.wgsl.expected.hlsl
new file mode 100644
index 0000000..63a8d67
--- /dev/null
+++ b/test/intrinsics/gen/abs/002533.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_002533() {
+  float4 res = abs(float4(0.0f, 0.0f, 0.0f, 0.0f));
+}
+
+void vertex_main() {
+  abs_002533();
+  return;
+}
+
+void fragment_main() {
+  abs_002533();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_002533();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/002533.wgsl.expected.msl b/test/intrinsics/gen/abs/002533.wgsl.expected.msl
new file mode 100644
index 0000000..15940e8
--- /dev/null
+++ b/test/intrinsics/gen/abs/002533.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_002533() {
+  float4 res =   fabs(float4());
+}
+
+vertex void vertex_main() {
+  abs_002533();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_002533();
+  return;
+}
+
+kernel void compute_main() {
+  abs_002533();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/002533.wgsl.expected.spvasm b/test/intrinsics/gen/abs/002533.wgsl.expected.spvasm
new file mode 100644
index 0000000..90cbf83
--- /dev/null
+++ b/test/intrinsics/gen/abs/002533.wgsl.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+               OpCapability Shader
+         %11 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_002533 "abs_002533"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+    %v4float = OpTypeVector %float 4
+         %12 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+    %float_1 = OpConstant %float 1
+ %abs_002533 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_v4float Function %12
+          %9 = OpExtInst %v4float %11 FAbs %12
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %16 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %18 = OpFunctionCall %void %abs_002533
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %abs_002533
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %23 = OpLabel
+         %24 = OpFunctionCall %void %abs_002533
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/002533.wgsl.expected.wgsl b/test/intrinsics/gen/abs/002533.wgsl.expected.wgsl
new file mode 100644
index 0000000..480a9de
--- /dev/null
+++ b/test/intrinsics/gen/abs/002533.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_002533() {
+  var res : vec4<f32> = abs(vec4<f32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_002533();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_002533();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_002533();
+}
diff --git a/test/intrinsics/gen/abs/005174.wgsl b/test/intrinsics/gen/abs/005174.wgsl
new file mode 100644
index 0000000..7384a15
--- /dev/null
+++ b/test/intrinsics/gen/abs/005174.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_005174() {
+  var res: vec3<f32> = abs(vec3<f32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_005174();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_005174();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_005174();
+}
diff --git a/test/intrinsics/gen/abs/005174.wgsl.expected.hlsl b/test/intrinsics/gen/abs/005174.wgsl.expected.hlsl
new file mode 100644
index 0000000..2733aae
--- /dev/null
+++ b/test/intrinsics/gen/abs/005174.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_005174() {
+  float3 res = abs(float3(0.0f, 0.0f, 0.0f));
+}
+
+void vertex_main() {
+  abs_005174();
+  return;
+}
+
+void fragment_main() {
+  abs_005174();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_005174();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/005174.wgsl.expected.msl b/test/intrinsics/gen/abs/005174.wgsl.expected.msl
new file mode 100644
index 0000000..333bdca
--- /dev/null
+++ b/test/intrinsics/gen/abs/005174.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_005174() {
+  float3 res =   fabs(float3());
+}
+
+vertex void vertex_main() {
+  abs_005174();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_005174();
+  return;
+}
+
+kernel void compute_main() {
+  abs_005174();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/005174.wgsl.expected.spvasm b/test/intrinsics/gen/abs/005174.wgsl.expected.spvasm
new file mode 100644
index 0000000..3c4c075
--- /dev/null
+++ b/test/intrinsics/gen/abs/005174.wgsl.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+               OpCapability Shader
+         %11 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_005174 "abs_005174"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+    %v3float = OpTypeVector %float 3
+         %12 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+    %float_1 = OpConstant %float 1
+ %abs_005174 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_v3float Function %12
+          %9 = OpExtInst %v3float %11 FAbs %12
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %16 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %18 = OpFunctionCall %void %abs_005174
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %abs_005174
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %23 = OpLabel
+         %24 = OpFunctionCall %void %abs_005174
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/005174.wgsl.expected.wgsl b/test/intrinsics/gen/abs/005174.wgsl.expected.wgsl
new file mode 100644
index 0000000..0d0cb37
--- /dev/null
+++ b/test/intrinsics/gen/abs/005174.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_005174() {
+  var res : vec3<f32> = abs(vec3<f32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_005174();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_005174();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_005174();
+}
diff --git a/test/intrinsics/gen/abs/1ce782.wgsl b/test/intrinsics/gen/abs/1ce782.wgsl
new file mode 100644
index 0000000..bc53763
--- /dev/null
+++ b/test/intrinsics/gen/abs/1ce782.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_1ce782() {
+  var res: vec4<u32> = abs(vec4<u32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_1ce782();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_1ce782();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_1ce782();
+}
diff --git a/test/intrinsics/gen/abs/1ce782.wgsl.expected.hlsl b/test/intrinsics/gen/abs/1ce782.wgsl.expected.hlsl
new file mode 100644
index 0000000..dc858cb
--- /dev/null
+++ b/test/intrinsics/gen/abs/1ce782.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_1ce782() {
+  uint4 res = abs(uint4(0u, 0u, 0u, 0u));
+}
+
+void vertex_main() {
+  abs_1ce782();
+  return;
+}
+
+void fragment_main() {
+  abs_1ce782();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_1ce782();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/1ce782.wgsl.expected.msl b/test/intrinsics/gen/abs/1ce782.wgsl.expected.msl
new file mode 100644
index 0000000..5f35a13
--- /dev/null
+++ b/test/intrinsics/gen/abs/1ce782.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_1ce782() {
+  uint4 res =   abs(uint4());
+}
+
+vertex void vertex_main() {
+  abs_1ce782();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_1ce782();
+  return;
+}
+
+kernel void compute_main() {
+  abs_1ce782();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/1ce782.wgsl.expected.spvasm b/test/intrinsics/gen/abs/1ce782.wgsl.expected.spvasm
new file mode 100644
index 0000000..d791e62
--- /dev/null
+++ b/test/intrinsics/gen/abs/1ce782.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+         %12 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_1ce782 "abs_1ce782"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+       %uint = OpTypeInt 32 0
+     %v4uint = OpTypeVector %uint 4
+         %13 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+    %float_1 = OpConstant %float 1
+ %abs_1ce782 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_v4uint Function %13
+          %9 = OpExtInst %v4uint %12 SAbs %13
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %17 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %19 = OpFunctionCall %void %abs_1ce782
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %abs_1ce782
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %abs_1ce782
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/1ce782.wgsl.expected.wgsl b/test/intrinsics/gen/abs/1ce782.wgsl.expected.wgsl
new file mode 100644
index 0000000..5bf8abe
--- /dev/null
+++ b/test/intrinsics/gen/abs/1ce782.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_1ce782() {
+  var res : vec4<u32> = abs(vec4<u32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_1ce782();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_1ce782();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_1ce782();
+}
diff --git a/test/intrinsics/gen/abs/1e9d53.wgsl b/test/intrinsics/gen/abs/1e9d53.wgsl
new file mode 100644
index 0000000..4ad1136
--- /dev/null
+++ b/test/intrinsics/gen/abs/1e9d53.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_1e9d53() {
+  var res: vec2<f32> = abs(vec2<f32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_1e9d53();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_1e9d53();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_1e9d53();
+}
diff --git a/test/intrinsics/gen/abs/1e9d53.wgsl.expected.hlsl b/test/intrinsics/gen/abs/1e9d53.wgsl.expected.hlsl
new file mode 100644
index 0000000..5c0e701
--- /dev/null
+++ b/test/intrinsics/gen/abs/1e9d53.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_1e9d53() {
+  float2 res = abs(float2(0.0f, 0.0f));
+}
+
+void vertex_main() {
+  abs_1e9d53();
+  return;
+}
+
+void fragment_main() {
+  abs_1e9d53();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_1e9d53();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/1e9d53.wgsl.expected.msl b/test/intrinsics/gen/abs/1e9d53.wgsl.expected.msl
new file mode 100644
index 0000000..f126e82
--- /dev/null
+++ b/test/intrinsics/gen/abs/1e9d53.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_1e9d53() {
+  float2 res =   fabs(float2());
+}
+
+vertex void vertex_main() {
+  abs_1e9d53();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_1e9d53();
+  return;
+}
+
+kernel void compute_main() {
+  abs_1e9d53();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/1e9d53.wgsl.expected.spvasm b/test/intrinsics/gen/abs/1e9d53.wgsl.expected.spvasm
new file mode 100644
index 0000000..815fcf9
--- /dev/null
+++ b/test/intrinsics/gen/abs/1e9d53.wgsl.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+               OpCapability Shader
+         %11 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_1e9d53 "abs_1e9d53"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+    %v2float = OpTypeVector %float 2
+         %12 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+    %float_1 = OpConstant %float 1
+ %abs_1e9d53 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_v2float Function %12
+          %9 = OpExtInst %v2float %11 FAbs %12
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %16 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %18 = OpFunctionCall %void %abs_1e9d53
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %abs_1e9d53
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %23 = OpLabel
+         %24 = OpFunctionCall %void %abs_1e9d53
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/1e9d53.wgsl.expected.wgsl b/test/intrinsics/gen/abs/1e9d53.wgsl.expected.wgsl
new file mode 100644
index 0000000..1e51a1f
--- /dev/null
+++ b/test/intrinsics/gen/abs/1e9d53.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_1e9d53() {
+  var res : vec2<f32> = abs(vec2<f32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_1e9d53();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_1e9d53();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_1e9d53();
+}
diff --git a/test/intrinsics/gen/abs/467cd1.wgsl b/test/intrinsics/gen/abs/467cd1.wgsl
new file mode 100644
index 0000000..422ee72
--- /dev/null
+++ b/test/intrinsics/gen/abs/467cd1.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_467cd1() {
+  var res: u32 = abs(1u);
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_467cd1();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_467cd1();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_467cd1();
+}
diff --git a/test/intrinsics/gen/abs/467cd1.wgsl.expected.hlsl b/test/intrinsics/gen/abs/467cd1.wgsl.expected.hlsl
new file mode 100644
index 0000000..0728dea
--- /dev/null
+++ b/test/intrinsics/gen/abs/467cd1.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_467cd1() {
+  uint res = abs(1u);
+}
+
+void vertex_main() {
+  abs_467cd1();
+  return;
+}
+
+void fragment_main() {
+  abs_467cd1();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_467cd1();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/467cd1.wgsl.expected.msl b/test/intrinsics/gen/abs/467cd1.wgsl.expected.msl
new file mode 100644
index 0000000..63d83b3
--- /dev/null
+++ b/test/intrinsics/gen/abs/467cd1.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_467cd1() {
+  uint res =   abs(1u);
+}
+
+vertex void vertex_main() {
+  abs_467cd1();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_467cd1();
+  return;
+}
+
+kernel void compute_main() {
+  abs_467cd1();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/467cd1.wgsl.expected.spvasm b/test/intrinsics/gen/abs/467cd1.wgsl.expected.spvasm
new file mode 100644
index 0000000..7af5b05
--- /dev/null
+++ b/test/intrinsics/gen/abs/467cd1.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+         %11 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_467cd1 "abs_467cd1"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+       %uint = OpTypeInt 32 0
+     %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+         %15 = OpConstantNull %uint
+    %float_1 = OpConstant %float 1
+ %abs_467cd1 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %15
+          %9 = OpExtInst %uint %11 SAbs %uint_1
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %17 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %19 = OpFunctionCall %void %abs_467cd1
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %abs_467cd1
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %abs_467cd1
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/467cd1.wgsl.expected.wgsl b/test/intrinsics/gen/abs/467cd1.wgsl.expected.wgsl
new file mode 100644
index 0000000..b40916d
--- /dev/null
+++ b/test/intrinsics/gen/abs/467cd1.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_467cd1() {
+  var res : u32 = abs(1u);
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_467cd1();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_467cd1();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_467cd1();
+}
diff --git a/test/intrinsics/gen/abs/4ad288.wgsl b/test/intrinsics/gen/abs/4ad288.wgsl
new file mode 100644
index 0000000..0105439
--- /dev/null
+++ b/test/intrinsics/gen/abs/4ad288.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_4ad288() {
+  var res: i32 = abs(1);
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_4ad288();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_4ad288();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_4ad288();
+}
diff --git a/test/intrinsics/gen/abs/4ad288.wgsl.expected.hlsl b/test/intrinsics/gen/abs/4ad288.wgsl.expected.hlsl
new file mode 100644
index 0000000..e7ff244
--- /dev/null
+++ b/test/intrinsics/gen/abs/4ad288.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_4ad288() {
+  int res = abs(1);
+}
+
+void vertex_main() {
+  abs_4ad288();
+  return;
+}
+
+void fragment_main() {
+  abs_4ad288();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_4ad288();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/4ad288.wgsl.expected.msl b/test/intrinsics/gen/abs/4ad288.wgsl.expected.msl
new file mode 100644
index 0000000..c454219
--- /dev/null
+++ b/test/intrinsics/gen/abs/4ad288.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_4ad288() {
+  int res =   abs(1);
+}
+
+vertex void vertex_main() {
+  abs_4ad288();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_4ad288();
+  return;
+}
+
+kernel void compute_main() {
+  abs_4ad288();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/4ad288.wgsl.expected.spvasm b/test/intrinsics/gen/abs/4ad288.wgsl.expected.spvasm
new file mode 100644
index 0000000..bb37f07
--- /dev/null
+++ b/test/intrinsics/gen/abs/4ad288.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+         %11 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_4ad288 "abs_4ad288"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+      %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+         %15 = OpConstantNull %int
+    %float_1 = OpConstant %float 1
+ %abs_4ad288 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %15
+          %9 = OpExtInst %int %11 SAbs %int_1
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %17 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %19 = OpFunctionCall %void %abs_4ad288
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %abs_4ad288
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %abs_4ad288
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/4ad288.wgsl.expected.wgsl b/test/intrinsics/gen/abs/4ad288.wgsl.expected.wgsl
new file mode 100644
index 0000000..2842caf
--- /dev/null
+++ b/test/intrinsics/gen/abs/4ad288.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_4ad288() {
+  var res : i32 = abs(1);
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_4ad288();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_4ad288();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_4ad288();
+}
diff --git a/test/intrinsics/gen/abs/5ad50a.wgsl b/test/intrinsics/gen/abs/5ad50a.wgsl
new file mode 100644
index 0000000..5b305f8
--- /dev/null
+++ b/test/intrinsics/gen/abs/5ad50a.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_5ad50a() {
+  var res: vec3<i32> = abs(vec3<i32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_5ad50a();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_5ad50a();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_5ad50a();
+}
diff --git a/test/intrinsics/gen/abs/5ad50a.wgsl.expected.hlsl b/test/intrinsics/gen/abs/5ad50a.wgsl.expected.hlsl
new file mode 100644
index 0000000..075e3cf
--- /dev/null
+++ b/test/intrinsics/gen/abs/5ad50a.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_5ad50a() {
+  int3 res = abs(int3(0, 0, 0));
+}
+
+void vertex_main() {
+  abs_5ad50a();
+  return;
+}
+
+void fragment_main() {
+  abs_5ad50a();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_5ad50a();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/5ad50a.wgsl.expected.msl b/test/intrinsics/gen/abs/5ad50a.wgsl.expected.msl
new file mode 100644
index 0000000..2d542b8
--- /dev/null
+++ b/test/intrinsics/gen/abs/5ad50a.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_5ad50a() {
+  int3 res =   abs(int3());
+}
+
+vertex void vertex_main() {
+  abs_5ad50a();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_5ad50a();
+  return;
+}
+
+kernel void compute_main() {
+  abs_5ad50a();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/5ad50a.wgsl.expected.spvasm b/test/intrinsics/gen/abs/5ad50a.wgsl.expected.spvasm
new file mode 100644
index 0000000..3419005
--- /dev/null
+++ b/test/intrinsics/gen/abs/5ad50a.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+         %12 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_5ad50a "abs_5ad50a"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+      %v3int = OpTypeVector %int 3
+         %13 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+    %float_1 = OpConstant %float 1
+ %abs_5ad50a = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_v3int Function %13
+          %9 = OpExtInst %v3int %12 SAbs %13
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %17 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %19 = OpFunctionCall %void %abs_5ad50a
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %abs_5ad50a
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %abs_5ad50a
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/5ad50a.wgsl.expected.wgsl b/test/intrinsics/gen/abs/5ad50a.wgsl.expected.wgsl
new file mode 100644
index 0000000..ec7efb6
--- /dev/null
+++ b/test/intrinsics/gen/abs/5ad50a.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_5ad50a() {
+  var res : vec3<i32> = abs(vec3<i32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_5ad50a();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_5ad50a();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_5ad50a();
+}
diff --git a/test/intrinsics/gen/abs/7326de.wgsl b/test/intrinsics/gen/abs/7326de.wgsl
new file mode 100644
index 0000000..d32d55f
--- /dev/null
+++ b/test/intrinsics/gen/abs/7326de.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_7326de() {
+  var res: vec3<u32> = abs(vec3<u32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_7326de();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_7326de();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_7326de();
+}
diff --git a/test/intrinsics/gen/abs/7326de.wgsl.expected.hlsl b/test/intrinsics/gen/abs/7326de.wgsl.expected.hlsl
new file mode 100644
index 0000000..1452464
--- /dev/null
+++ b/test/intrinsics/gen/abs/7326de.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_7326de() {
+  uint3 res = abs(uint3(0u, 0u, 0u));
+}
+
+void vertex_main() {
+  abs_7326de();
+  return;
+}
+
+void fragment_main() {
+  abs_7326de();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_7326de();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/7326de.wgsl.expected.msl b/test/intrinsics/gen/abs/7326de.wgsl.expected.msl
new file mode 100644
index 0000000..9c2eb81
--- /dev/null
+++ b/test/intrinsics/gen/abs/7326de.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_7326de() {
+  uint3 res =   abs(uint3());
+}
+
+vertex void vertex_main() {
+  abs_7326de();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_7326de();
+  return;
+}
+
+kernel void compute_main() {
+  abs_7326de();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/7326de.wgsl.expected.spvasm b/test/intrinsics/gen/abs/7326de.wgsl.expected.spvasm
new file mode 100644
index 0000000..55422b3
--- /dev/null
+++ b/test/intrinsics/gen/abs/7326de.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+         %12 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_7326de "abs_7326de"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+       %uint = OpTypeInt 32 0
+     %v3uint = OpTypeVector %uint 3
+         %13 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+    %float_1 = OpConstant %float 1
+ %abs_7326de = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_v3uint Function %13
+          %9 = OpExtInst %v3uint %12 SAbs %13
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %17 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %19 = OpFunctionCall %void %abs_7326de
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %abs_7326de
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %abs_7326de
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/7326de.wgsl.expected.wgsl b/test/intrinsics/gen/abs/7326de.wgsl.expected.wgsl
new file mode 100644
index 0000000..0cd0f3c
--- /dev/null
+++ b/test/intrinsics/gen/abs/7326de.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_7326de() {
+  var res : vec3<u32> = abs(vec3<u32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_7326de();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_7326de();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_7326de();
+}
diff --git a/test/intrinsics/gen/abs/7f28e6.wgsl b/test/intrinsics/gen/abs/7f28e6.wgsl
new file mode 100644
index 0000000..60f0174
--- /dev/null
+++ b/test/intrinsics/gen/abs/7f28e6.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_7f28e6() {
+  var res: vec2<u32> = abs(vec2<u32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_7f28e6();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_7f28e6();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_7f28e6();
+}
diff --git a/test/intrinsics/gen/abs/7f28e6.wgsl.expected.hlsl b/test/intrinsics/gen/abs/7f28e6.wgsl.expected.hlsl
new file mode 100644
index 0000000..c2394da
--- /dev/null
+++ b/test/intrinsics/gen/abs/7f28e6.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_7f28e6() {
+  uint2 res = abs(uint2(0u, 0u));
+}
+
+void vertex_main() {
+  abs_7f28e6();
+  return;
+}
+
+void fragment_main() {
+  abs_7f28e6();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_7f28e6();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/7f28e6.wgsl.expected.msl b/test/intrinsics/gen/abs/7f28e6.wgsl.expected.msl
new file mode 100644
index 0000000..9ec6060
--- /dev/null
+++ b/test/intrinsics/gen/abs/7f28e6.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_7f28e6() {
+  uint2 res =   abs(uint2());
+}
+
+vertex void vertex_main() {
+  abs_7f28e6();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_7f28e6();
+  return;
+}
+
+kernel void compute_main() {
+  abs_7f28e6();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/7f28e6.wgsl.expected.spvasm b/test/intrinsics/gen/abs/7f28e6.wgsl.expected.spvasm
new file mode 100644
index 0000000..b3cffe1
--- /dev/null
+++ b/test/intrinsics/gen/abs/7f28e6.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+         %12 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_7f28e6 "abs_7f28e6"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+       %uint = OpTypeInt 32 0
+     %v2uint = OpTypeVector %uint 2
+         %13 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+    %float_1 = OpConstant %float 1
+ %abs_7f28e6 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_v2uint Function %13
+          %9 = OpExtInst %v2uint %12 SAbs %13
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %17 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %19 = OpFunctionCall %void %abs_7f28e6
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %abs_7f28e6
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %abs_7f28e6
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/7f28e6.wgsl.expected.wgsl b/test/intrinsics/gen/abs/7f28e6.wgsl.expected.wgsl
new file mode 100644
index 0000000..53a7554
--- /dev/null
+++ b/test/intrinsics/gen/abs/7f28e6.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_7f28e6() {
+  var res : vec2<u32> = abs(vec2<u32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_7f28e6();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_7f28e6();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_7f28e6();
+}
diff --git a/test/intrinsics/gen/abs/7faa9e.wgsl b/test/intrinsics/gen/abs/7faa9e.wgsl
new file mode 100644
index 0000000..c676477
--- /dev/null
+++ b/test/intrinsics/gen/abs/7faa9e.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_7faa9e() {
+  var res: vec2<i32> = abs(vec2<i32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_7faa9e();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_7faa9e();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_7faa9e();
+}
diff --git a/test/intrinsics/gen/abs/7faa9e.wgsl.expected.hlsl b/test/intrinsics/gen/abs/7faa9e.wgsl.expected.hlsl
new file mode 100644
index 0000000..80607a0
--- /dev/null
+++ b/test/intrinsics/gen/abs/7faa9e.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_7faa9e() {
+  int2 res = abs(int2(0, 0));
+}
+
+void vertex_main() {
+  abs_7faa9e();
+  return;
+}
+
+void fragment_main() {
+  abs_7faa9e();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_7faa9e();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/7faa9e.wgsl.expected.msl b/test/intrinsics/gen/abs/7faa9e.wgsl.expected.msl
new file mode 100644
index 0000000..9b60918
--- /dev/null
+++ b/test/intrinsics/gen/abs/7faa9e.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_7faa9e() {
+  int2 res =   abs(int2());
+}
+
+vertex void vertex_main() {
+  abs_7faa9e();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_7faa9e();
+  return;
+}
+
+kernel void compute_main() {
+  abs_7faa9e();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/7faa9e.wgsl.expected.spvasm b/test/intrinsics/gen/abs/7faa9e.wgsl.expected.spvasm
new file mode 100644
index 0000000..76f9674
--- /dev/null
+++ b/test/intrinsics/gen/abs/7faa9e.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+         %12 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_7faa9e "abs_7faa9e"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+      %v2int = OpTypeVector %int 2
+         %13 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+    %float_1 = OpConstant %float 1
+ %abs_7faa9e = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_v2int Function %13
+          %9 = OpExtInst %v2int %12 SAbs %13
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %17 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %19 = OpFunctionCall %void %abs_7faa9e
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %abs_7faa9e
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %abs_7faa9e
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/7faa9e.wgsl.expected.wgsl b/test/intrinsics/gen/abs/7faa9e.wgsl.expected.wgsl
new file mode 100644
index 0000000..c2f73f6
--- /dev/null
+++ b/test/intrinsics/gen/abs/7faa9e.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_7faa9e() {
+  var res : vec2<i32> = abs(vec2<i32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_7faa9e();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_7faa9e();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_7faa9e();
+}
diff --git a/test/intrinsics/gen/abs/9c80a6.wgsl b/test/intrinsics/gen/abs/9c80a6.wgsl
new file mode 100644
index 0000000..05e66e2
--- /dev/null
+++ b/test/intrinsics/gen/abs/9c80a6.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_9c80a6() {
+  var res: vec4<i32> = abs(vec4<i32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_9c80a6();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_9c80a6();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_9c80a6();
+}
diff --git a/test/intrinsics/gen/abs/9c80a6.wgsl.expected.hlsl b/test/intrinsics/gen/abs/9c80a6.wgsl.expected.hlsl
new file mode 100644
index 0000000..fb08cab
--- /dev/null
+++ b/test/intrinsics/gen/abs/9c80a6.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_9c80a6() {
+  int4 res = abs(int4(0, 0, 0, 0));
+}
+
+void vertex_main() {
+  abs_9c80a6();
+  return;
+}
+
+void fragment_main() {
+  abs_9c80a6();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_9c80a6();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/9c80a6.wgsl.expected.msl b/test/intrinsics/gen/abs/9c80a6.wgsl.expected.msl
new file mode 100644
index 0000000..26f8447
--- /dev/null
+++ b/test/intrinsics/gen/abs/9c80a6.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_9c80a6() {
+  int4 res =   abs(int4());
+}
+
+vertex void vertex_main() {
+  abs_9c80a6();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_9c80a6();
+  return;
+}
+
+kernel void compute_main() {
+  abs_9c80a6();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/9c80a6.wgsl.expected.spvasm b/test/intrinsics/gen/abs/9c80a6.wgsl.expected.spvasm
new file mode 100644
index 0000000..c3806ce
--- /dev/null
+++ b/test/intrinsics/gen/abs/9c80a6.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+         %12 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_9c80a6 "abs_9c80a6"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+      %v4int = OpTypeVector %int 4
+         %13 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+    %float_1 = OpConstant %float 1
+ %abs_9c80a6 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_v4int Function %13
+          %9 = OpExtInst %v4int %12 SAbs %13
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %17 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %19 = OpFunctionCall %void %abs_9c80a6
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %abs_9c80a6
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %abs_9c80a6
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/9c80a6.wgsl.expected.wgsl b/test/intrinsics/gen/abs/9c80a6.wgsl.expected.wgsl
new file mode 100644
index 0000000..797774c
--- /dev/null
+++ b/test/intrinsics/gen/abs/9c80a6.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_9c80a6() {
+  var res : vec4<i32> = abs(vec4<i32>());
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_9c80a6();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_9c80a6();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_9c80a6();
+}
diff --git a/test/intrinsics/gen/abs/b96037.wgsl b/test/intrinsics/gen/abs/b96037.wgsl
new file mode 100644
index 0000000..cd0e431
--- /dev/null
+++ b/test/intrinsics/gen/abs/b96037.wgsl
@@ -0,0 +1,42 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+//   test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+//   src/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+fn abs_b96037() {
+  var res: f32 = abs(1.0);
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_b96037();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_b96037();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_b96037();
+}
diff --git a/test/intrinsics/gen/abs/b96037.wgsl.expected.hlsl b/test/intrinsics/gen/abs/b96037.wgsl.expected.hlsl
new file mode 100644
index 0000000..655840a
--- /dev/null
+++ b/test/intrinsics/gen/abs/b96037.wgsl.expected.hlsl
@@ -0,0 +1,20 @@
+void abs_b96037() {
+  float res = abs(1.0f);
+}
+
+void vertex_main() {
+  abs_b96037();
+  return;
+}
+
+void fragment_main() {
+  abs_b96037();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  abs_b96037();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/b96037.wgsl.expected.msl b/test/intrinsics/gen/abs/b96037.wgsl.expected.msl
new file mode 100644
index 0000000..f2db329
--- /dev/null
+++ b/test/intrinsics/gen/abs/b96037.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_b96037() {
+  float res =   fabs(1.0f);
+}
+
+vertex void vertex_main() {
+  abs_b96037();
+  return;
+}
+
+fragment void fragment_main() {
+  abs_b96037();
+  return;
+}
+
+kernel void compute_main() {
+  abs_b96037();
+  return;
+}
+
diff --git a/test/intrinsics/gen/abs/b96037.wgsl.expected.spvasm b/test/intrinsics/gen/abs/b96037.wgsl.expected.spvasm
new file mode 100644
index 0000000..af85239
--- /dev/null
+++ b/test/intrinsics/gen/abs/b96037.wgsl.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+               OpCapability Shader
+         %10 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %tint_pointsize "tint_pointsize"
+               OpName %abs_b96037 "abs_b96037"
+               OpName %res "res"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %tint_pointsize BuiltIn PointSize
+      %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+          %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %abs_b96037 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_float Function %4
+          %9 = OpExtInst %float %10 FAbs %float_1
+               OpStore %res %9
+               OpReturn
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %5
+         %15 = OpLabel
+               OpStore %tint_pointsize %float_1
+         %16 = OpFunctionCall %void %abs_b96037
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+         %18 = OpLabel
+         %19 = OpFunctionCall %void %abs_b96037
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %abs_b96037
+               OpReturn
+               OpFunctionEnd
diff --git a/test/intrinsics/gen/abs/b96037.wgsl.expected.wgsl b/test/intrinsics/gen/abs/b96037.wgsl.expected.wgsl
new file mode 100644
index 0000000..112c0a18
--- /dev/null
+++ b/test/intrinsics/gen/abs/b96037.wgsl.expected.wgsl
@@ -0,0 +1,18 @@
+fn abs_b96037() {
+  var res : f32 = abs(1.0);
+}
+
+[[stage(vertex)]]
+fn vertex_main() {
+  abs_b96037();
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  abs_b96037();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  abs_b96037();
+}