Re-generate expected outputs.

Change-Id: I97fc90d33fe7620b3fccfab343a9c0bbfdf6924c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59447
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.hlsl
index 84838ef..c5053c4 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.hlsl
@@ -10,7 +10,7 @@
   float undefined = 0.0f;
   bool x_51 = false;
   bool x_52_phi = false;
-  undefined = (5.0f % 0.0f);
+  undefined = (5.0f - (0.0f * floor((5.0f / 0.0f))));
   const uint scalar_offset = ((16u * uint(0))) / 4;
   const int x_10 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
   const uint scalar_offset_1 = ((16u * uint(0))) / 4;
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.msl
index ad2c3ca..941cf28 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -34,7 +32,7 @@
   float undefined = 0.0f;
   bool x_51 = false;
   bool x_52_phi = false;
-  undefined = (5.0f % 0.0f);
+  undefined = (5.0f - (0.0f * floor((5.0f / 0.0f))));
   int const x_10 = x_6.x_GLF_uniform_int_values.arr[0].el;
   int const x_11 = x_6.x_GLF_uniform_int_values.arr[0].el;
   int const x_12 = x_6.x_GLF_uniform_int_values.arr[1].el;
@@ -69,8 +67,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\u348.0.metal:35:21: error: invalid operands to binary expression ('float' and 'float')
-  undefined = (5.0f % 0.0f);
-               ~~~~ ^ ~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.spvasm
index 042259a..1e78c0a 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.spvasm
@@ -1,9 +1,10 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 89
+; Bound: 93
 ; Schema: 0
                OpCapability Shader
+         %35 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical GLSL450
                OpEntryPoint Fragment %main "main" %tint_symbol_1
                OpExecutionMode %main OriginUpperLeft
@@ -72,77 +73,80 @@
       %int_1 = OpConstant %int 1
 %_ptr_Uniform_float = OpTypePointer Uniform %float
    %main_out = OpTypeStruct %v4float
-         %77 = OpTypeFunction %void %main_out
+         %81 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %20
          %23 = OpLabel
   %undefined = OpVariable %_ptr_Function_float Function %26
        %x_51 = OpVariable %_ptr_Function_bool Function %30
    %x_52_phi = OpVariable %_ptr_Function_bool Function %30
-         %34 = OpFMod %float %float_5 %float_0
-               OpStore %undefined %34
-         %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
-         %39 = OpLoad %int %38
-         %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
-         %41 = OpLoad %int %40
-         %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
-         %44 = OpLoad %int %43
-         %45 = OpIAdd %int %41 %44
-         %46 = OpIEqual %bool %39 %45
-               OpStore %x_52_phi %46
-         %47 = OpLogicalNot %bool %46
-               OpSelectionMerge %48 None
-               OpBranchConditional %47 %49 %48
-         %49 = OpLabel
-         %50 = OpLoad %float %undefined
-         %52 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
-         %53 = OpLoad %float %52
-         %54 = OpFOrdGreaterThan %bool %50 %53
-               OpStore %x_51 %54
-         %55 = OpLoad %bool %x_51
-               OpStore %x_52_phi %55
-               OpBranch %48
-         %48 = OpLabel
-         %56 = OpLoad %bool %x_52_phi
-               OpSelectionMerge %57 None
-               OpBranchConditional %56 %58 %59
-         %58 = OpLabel
-         %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
-         %61 = OpLoad %int %60
-         %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
-         %63 = OpLoad %int %62
-         %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
+         %36 = OpFDiv %float %float_5 %float_0
+         %34 = OpExtInst %float %35 Floor %36
+         %37 = OpFMul %float %float_0 %34
+         %38 = OpFSub %float %float_5 %37
+               OpStore %undefined %38
+         %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
+         %43 = OpLoad %int %42
+         %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
+         %45 = OpLoad %int %44
+         %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
+         %48 = OpLoad %int %47
+         %49 = OpIAdd %int %45 %48
+         %50 = OpIEqual %bool %43 %49
+               OpStore %x_52_phi %50
+         %51 = OpLogicalNot %bool %50
+               OpSelectionMerge %52 None
+               OpBranchConditional %51 %53 %52
+         %53 = OpLabel
+         %54 = OpLoad %float %undefined
+         %56 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
+         %57 = OpLoad %float %56
+         %58 = OpFOrdGreaterThan %bool %54 %57
+               OpStore %x_51 %58
+         %59 = OpLoad %bool %x_51
+               OpStore %x_52_phi %59
+               OpBranch %52
+         %52 = OpLabel
+         %60 = OpLoad %bool %x_52_phi
+               OpSelectionMerge %61 None
+               OpBranchConditional %60 %62 %63
+         %62 = OpLabel
+         %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
          %65 = OpLoad %int %64
-         %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
+         %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
          %67 = OpLoad %int %66
-         %68 = OpConvertSToF %float %61
-         %69 = OpConvertSToF %float %63
-         %70 = OpConvertSToF %float %65
-         %71 = OpConvertSToF %float %67
-         %72 = OpCompositeConstruct %v4float %68 %69 %70 %71
-               OpStore %x_GLF_color %72
-               OpBranch %57
-         %59 = OpLabel
-         %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
-         %74 = OpLoad %int %73
-         %75 = OpConvertSToF %float %74
-         %76 = OpCompositeConstruct %v4float %75 %75 %75 %75
+         %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
+         %69 = OpLoad %int %68
+         %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
+         %71 = OpLoad %int %70
+         %72 = OpConvertSToF %float %65
+         %73 = OpConvertSToF %float %67
+         %74 = OpConvertSToF %float %69
+         %75 = OpConvertSToF %float %71
+         %76 = OpCompositeConstruct %v4float %72 %73 %74 %75
                OpStore %x_GLF_color %76
-               OpBranch %57
-         %57 = OpLabel
+               OpBranch %61
+         %63 = OpLabel
+         %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
+         %78 = OpLoad %int %77
+         %79 = OpConvertSToF %float %78
+         %80 = OpCompositeConstruct %v4float %79 %79 %79 %79
+               OpStore %x_GLF_color %80
+               OpBranch %61
+         %61 = OpLabel
                OpReturn
                OpFunctionEnd
-%tint_symbol_2 = OpFunction %void None %77
+%tint_symbol_2 = OpFunction %void None %81
 %tint_symbol = OpFunctionParameter %main_out
-         %81 = OpLabel
-         %82 = OpCompositeExtract %v4float %tint_symbol 0
-               OpStore %tint_symbol_1 %82
+         %85 = OpLabel
+         %86 = OpCompositeExtract %v4float %tint_symbol 0
+               OpStore %tint_symbol_1 %86
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %20
-         %84 = OpLabel
-         %85 = OpFunctionCall %void %main_1
-         %87 = OpLoad %v4float %x_GLF_color
-         %88 = OpCompositeConstruct %main_out %87
-         %86 = OpFunctionCall %void %tint_symbol_2 %88
+         %88 = OpLabel
+         %89 = OpFunctionCall %void %main_1
+         %91 = OpLoad %v4float %x_GLF_color
+         %92 = OpCompositeConstruct %main_out %91
+         %90 = OpFunctionCall %void %tint_symbol_2 %92
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.wgsl
index ee6f6f7..43a60a3 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.wgsl
@@ -22,7 +22,7 @@
   var undefined : f32;
   var x_51 : bool;
   var x_52_phi : bool;
-  undefined = (5.0 % 0.0);
+  undefined = (5.0 - (0.0 * floor((5.0 / 0.0))));
   let x_10 : i32 = x_6.x_GLF_uniform_int_values[0];
   let x_11 : i32 = x_6.x_GLF_uniform_int_values[0];
   let x_12 : i32 = x_6.x_GLF_uniform_int_values[1];
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.msl
index 201dc73..6033ad9 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -34,7 +32,7 @@
   float undefined = 0.0f;
   bool x_51 = false;
   bool x_52_phi = false;
-  undefined = (5.0f % 0.0f);
+  undefined = fmod(5.0f, 0.0f);
   int const x_10 = x_6.x_GLF_uniform_int_values.arr[0].el;
   int const x_11 = x_6.x_GLF_uniform_int_values.arr[0].el;
   int const x_12 = x_6.x_GLF_uniform_int_values.arr[1].el;
@@ -69,8 +67,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\u5b0.0.metal:35:21: error: invalid operands to binary expression ('float' and 'float')
-  undefined = (5.0f % 0.0f);
-               ~~~~ ^ ~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.spvasm
index 042259a..5d524ab 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.spvasm
@@ -78,7 +78,7 @@
   %undefined = OpVariable %_ptr_Function_float Function %26
        %x_51 = OpVariable %_ptr_Function_bool Function %30
    %x_52_phi = OpVariable %_ptr_Function_bool Function %30
-         %34 = OpFMod %float %float_5 %float_0
+         %34 = OpFRem %float %float_5 %float_0
                OpStore %undefined %34
          %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
          %39 = OpLoad %int %38
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.hlsl
index 134d1e5..a13eb73 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.hlsl
@@ -12,7 +12,7 @@
   float f1 = 0.0f;
   bool x_72 = false;
   bool x_73_phi = false;
-  f0 = (10.0f % 0.000001f);
+  f0 = (10.0f - (0.000001f * floor((10.0f / 0.000001f))));
   s1 = 9.99999935e-39f;
   if ((s1 == 0.0f)) {
     s1 = 1.0f;
@@ -21,7 +21,8 @@
   bool x_71 = false;
   bool x_63_phi = false;
   bool x_72_phi = false;
-  f1 = (10.0f % s1);
+  const float x_42 = s1;
+  f1 = (10.0f - (x_42 * floor((10.0f / x_42))));
   bool tint_tmp = isinf(f1);
   if (!tint_tmp) {
     tint_tmp = (s1 == 1.0f);
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.msl
index b44e5d5..eed1df1 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -36,7 +34,7 @@
   float f1 = 0.0f;
   bool x_72 = false;
   bool x_73_phi = false;
-  f0 = (10.0f % 0.000001f);
+  f0 = (10.0f - (0.000001f * floor((10.0f / 0.000001f))));
   s1 = 9.99999935e-39f;
   float const x_38 = s1;
   if ((x_38 == 0.0f)) {
@@ -47,7 +45,7 @@
   bool x_63_phi = false;
   bool x_72_phi = false;
   float const x_42 = s1;
-  f1 = (10.0f % x_42);
+  f1 = (10.0f - (x_42 * floor((10.0f / x_42))));
   float const x_44 = f1;
   float const x_46 = s1;
   bool const x_48 = (isinf(x_44) || (x_46 == 1.0f));
@@ -98,11 +96,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\u3v4.0.metal:37:15: error: invalid operands to binary expression ('float' and 'float')
-  f0 = (10.0f % 0.000001f);
-        ~~~~~ ^ ~~~~~~~~~
-T:\tmp\u3v4.0.metal:48:15: error: invalid operands to binary expression ('float' and 'const float')
-  f1 = (10.0f % x_42);
-        ~~~~~ ^ ~~~~
-2 errors generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.spvasm
index f597477..d7b1097 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.spvasm
@@ -1,9 +1,10 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 132
+; Bound: 139
 ; Schema: 0
                OpCapability Shader
+         %37 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical GLSL450
                OpEntryPoint Fragment %main "main" %tint_symbol_1
                OpExecutionMode %main OriginUpperLeft
@@ -82,7 +83,7 @@
 %_ptr_Uniform_int = OpTypePointer Uniform %int
       %int_0 = OpConstant %int 0
    %main_out = OpTypeStruct %v4float
-        %120 = OpTypeFunction %void %main_out
+        %127 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %20
          %23 = OpLabel
          %f0 = OpVariable %_ptr_Function_float Function %26
@@ -94,134 +95,140 @@
        %x_71 = OpVariable %_ptr_Function_bool Function %32
    %x_63_phi = OpVariable %_ptr_Function_bool Function %32
    %x_72_phi = OpVariable %_ptr_Function_bool Function %32
-         %36 = OpFMod %float %float_10 %float_9_99999997en07
-               OpStore %f0 %36
+         %38 = OpFDiv %float %float_10 %float_9_99999997en07
+         %36 = OpExtInst %float %37 Floor %38
+         %39 = OpFMul %float %float_9_99999997en07 %36
+         %40 = OpFSub %float %float_10 %39
+               OpStore %f0 %40
                OpStore %s1 %float_0x1_b38fb8pn127
-         %38 = OpLoad %float %s1
-         %40 = OpFOrdEqual %bool %38 %float_0
-               OpSelectionMerge %41 None
-               OpBranchConditional %40 %42 %41
-         %42 = OpLabel
+         %42 = OpLoad %float %s1
+         %44 = OpFOrdEqual %bool %42 %float_0
+               OpSelectionMerge %45 None
+               OpBranchConditional %44 %46 %45
+         %46 = OpLabel
                OpStore %s1 %float_1
-               OpBranch %41
-         %41 = OpLabel
-         %48 = OpLoad %float %s1
-         %49 = OpFMod %float %float_10 %48
-               OpStore %f1 %49
-         %50 = OpLoad %float %f1
-         %51 = OpLoad %float %s1
-         %52 = OpIsInf %bool %50
-               OpSelectionMerge %53 None
-               OpBranchConditional %52 %53 %54
-         %54 = OpLabel
-         %55 = OpFOrdEqual %bool %51 %float_1
-               OpBranch %53
-         %53 = OpLabel
-         %56 = OpPhi %bool %52 %41 %55 %54
-               OpStore %x_73_phi %56
-         %57 = OpLogicalNot %bool %56
-               OpSelectionMerge %58 None
-               OpBranchConditional %57 %59 %58
-         %59 = OpLabel
-         %60 = OpLoad %float %f0
-         %61 = OpLoad %float %f1
-         %62 = OpFOrdEqual %bool %60 %61
-               OpStore %x_63_phi %62
-         %63 = OpLogicalNot %bool %62
-               OpSelectionMerge %64 None
-               OpBranchConditional %63 %65 %64
-         %65 = OpLabel
-         %66 = OpLoad %float %f0
+               OpBranch %45
+         %45 = OpLabel
+         %52 = OpLoad %float %s1
+         %54 = OpFDiv %float %float_10 %52
+         %53 = OpExtInst %float %37 Floor %54
+         %55 = OpFMul %float %52 %53
+         %56 = OpFSub %float %float_10 %55
+               OpStore %f1 %56
+         %57 = OpLoad %float %f1
+         %58 = OpLoad %float %s1
+         %59 = OpIsInf %bool %57
+               OpSelectionMerge %60 None
+               OpBranchConditional %59 %60 %61
+         %61 = OpLabel
+         %62 = OpFOrdEqual %bool %58 %float_1
+               OpBranch %60
+         %60 = OpLabel
+         %63 = OpPhi %bool %59 %45 %62 %61
+               OpStore %x_73_phi %63
+         %64 = OpLogicalNot %bool %63
+               OpSelectionMerge %65 None
+               OpBranchConditional %64 %66 %65
+         %66 = OpLabel
          %67 = OpLoad %float %f0
-         %69 = OpFOrdGreaterThan %bool %66 %float_0_99000001
-               OpSelectionMerge %70 None
-               OpBranchConditional %69 %71 %70
-         %71 = OpLabel
-         %73 = OpFOrdLessThan %bool %67 %float_0_00999999978
-               OpBranch %70
-         %70 = OpLabel
-         %74 = OpPhi %bool %69 %65 %73 %71
-               OpStore %x_62 %74
-         %75 = OpLoad %bool %x_62
-               OpStore %x_63_phi %75
-               OpBranch %64
-         %64 = OpLabel
-         %76 = OpLoad %bool %x_63_phi
-               OpStore %x_72_phi %76
-         %77 = OpLogicalNot %bool %76
-               OpSelectionMerge %78 None
-               OpBranchConditional %77 %79 %78
-         %79 = OpLabel
-         %80 = OpLoad %float %f1
-         %81 = OpLoad %float %f1
-         %82 = OpFOrdGreaterThan %bool %80 %float_0_99000001
-               OpSelectionMerge %83 None
-               OpBranchConditional %82 %84 %83
-         %84 = OpLabel
-         %85 = OpFOrdLessThan %bool %81 %float_0_00999999978
-               OpBranch %83
-         %83 = OpLabel
-         %86 = OpPhi %bool %82 %79 %85 %84
-               OpStore %x_71 %86
-         %87 = OpLoad %bool %x_71
-               OpStore %x_72_phi %87
-               OpBranch %78
+         %68 = OpLoad %float %f1
+         %69 = OpFOrdEqual %bool %67 %68
+               OpStore %x_63_phi %69
+         %70 = OpLogicalNot %bool %69
+               OpSelectionMerge %71 None
+               OpBranchConditional %70 %72 %71
+         %72 = OpLabel
+         %73 = OpLoad %float %f0
+         %74 = OpLoad %float %f0
+         %76 = OpFOrdGreaterThan %bool %73 %float_0_99000001
+               OpSelectionMerge %77 None
+               OpBranchConditional %76 %78 %77
          %78 = OpLabel
-         %88 = OpLoad %bool %x_72_phi
-               OpStore %x_72 %88
-         %89 = OpLoad %bool %x_72
-               OpStore %x_73_phi %89
-               OpBranch %58
-         %58 = OpLabel
-         %90 = OpLoad %bool %x_73_phi
-         %91 = OpLoad %float %f1
-               OpSelectionMerge %92 None
-               OpBranchConditional %90 %92 %93
-         %93 = OpLabel
-         %94 = OpFOrdEqual %bool %91 %float_10
-               OpBranch %92
-         %92 = OpLabel
-         %95 = OpPhi %bool %90 %58 %94 %93
-               OpSelectionMerge %96 None
-               OpBranchConditional %95 %97 %98
-         %97 = OpLabel
-        %102 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1
-        %103 = OpLoad %int %102
-        %105 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
-        %106 = OpLoad %int %105
-        %107 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
-        %108 = OpLoad %int %107
+         %80 = OpFOrdLessThan %bool %74 %float_0_00999999978
+               OpBranch %77
+         %77 = OpLabel
+         %81 = OpPhi %bool %76 %72 %80 %78
+               OpStore %x_62 %81
+         %82 = OpLoad %bool %x_62
+               OpStore %x_63_phi %82
+               OpBranch %71
+         %71 = OpLabel
+         %83 = OpLoad %bool %x_63_phi
+               OpStore %x_72_phi %83
+         %84 = OpLogicalNot %bool %83
+               OpSelectionMerge %85 None
+               OpBranchConditional %84 %86 %85
+         %86 = OpLabel
+         %87 = OpLoad %float %f1
+         %88 = OpLoad %float %f1
+         %89 = OpFOrdGreaterThan %bool %87 %float_0_99000001
+               OpSelectionMerge %90 None
+               OpBranchConditional %89 %91 %90
+         %91 = OpLabel
+         %92 = OpFOrdLessThan %bool %88 %float_0_00999999978
+               OpBranch %90
+         %90 = OpLabel
+         %93 = OpPhi %bool %89 %86 %92 %91
+               OpStore %x_71 %93
+         %94 = OpLoad %bool %x_71
+               OpStore %x_72_phi %94
+               OpBranch %85
+         %85 = OpLabel
+         %95 = OpLoad %bool %x_72_phi
+               OpStore %x_72 %95
+         %96 = OpLoad %bool %x_72
+               OpStore %x_73_phi %96
+               OpBranch %65
+         %65 = OpLabel
+         %97 = OpLoad %bool %x_73_phi
+         %98 = OpLoad %float %f1
+               OpSelectionMerge %99 None
+               OpBranchConditional %97 %99 %100
+        %100 = OpLabel
+        %101 = OpFOrdEqual %bool %98 %float_10
+               OpBranch %99
+         %99 = OpLabel
+        %102 = OpPhi %bool %97 %65 %101 %100
+               OpSelectionMerge %103 None
+               OpBranchConditional %102 %104 %105
+        %104 = OpLabel
         %109 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1
         %110 = OpLoad %int %109
-        %111 = OpConvertSToF %float %103
-        %112 = OpConvertSToF %float %106
-        %113 = OpConvertSToF %float %108
-        %114 = OpConvertSToF %float %110
-        %115 = OpCompositeConstruct %v4float %111 %112 %113 %114
-               OpStore %x_GLF_color %115
-               OpBranch %96
-         %98 = OpLabel
-        %116 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
+        %112 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
+        %113 = OpLoad %int %112
+        %114 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
+        %115 = OpLoad %int %114
+        %116 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1
         %117 = OpLoad %int %116
-        %118 = OpConvertSToF %float %117
-        %119 = OpCompositeConstruct %v4float %118 %118 %118 %118
-               OpStore %x_GLF_color %119
-               OpBranch %96
-         %96 = OpLabel
+        %118 = OpConvertSToF %float %110
+        %119 = OpConvertSToF %float %113
+        %120 = OpConvertSToF %float %115
+        %121 = OpConvertSToF %float %117
+        %122 = OpCompositeConstruct %v4float %118 %119 %120 %121
+               OpStore %x_GLF_color %122
+               OpBranch %103
+        %105 = OpLabel
+        %123 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
+        %124 = OpLoad %int %123
+        %125 = OpConvertSToF %float %124
+        %126 = OpCompositeConstruct %v4float %125 %125 %125 %125
+               OpStore %x_GLF_color %126
+               OpBranch %103
+        %103 = OpLabel
                OpReturn
                OpFunctionEnd
-%tint_symbol_2 = OpFunction %void None %120
+%tint_symbol_2 = OpFunction %void None %127
 %tint_symbol = OpFunctionParameter %main_out
-        %124 = OpLabel
-        %125 = OpCompositeExtract %v4float %tint_symbol 0
-               OpStore %tint_symbol_1 %125
+        %131 = OpLabel
+        %132 = OpCompositeExtract %v4float %tint_symbol 0
+               OpStore %tint_symbol_1 %132
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %20
-        %127 = OpLabel
-        %128 = OpFunctionCall %void %main_1
-        %130 = OpLoad %v4float %x_GLF_color
-        %131 = OpCompositeConstruct %main_out %130
-        %129 = OpFunctionCall %void %tint_symbol_2 %131
+        %134 = OpLabel
+        %135 = OpFunctionCall %void %main_1
+        %137 = OpLoad %v4float %x_GLF_color
+        %138 = OpCompositeConstruct %main_out %137
+        %136 = OpFunctionCall %void %tint_symbol_2 %138
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.wgsl
index 8b2ad19..69a4451 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.wgsl
@@ -24,7 +24,7 @@
   var f1 : f32;
   var x_72 : bool;
   var x_73_phi : bool;
-  f0 = (10.0 % 0.000001);
+  f0 = (10.0 - (0.000001 * floor((10.0 / 0.000001))));
   s1 = 0x1.b38fb8p-127;
   let x_38 : f32 = s1;
   if ((x_38 == 0.0)) {
@@ -35,7 +35,7 @@
   var x_63_phi : bool;
   var x_72_phi : bool;
   let x_42 : f32 = s1;
-  f1 = (10.0 % x_42);
+  f1 = (10.0 - (x_42 * floor((10.0 / x_42))));
   let x_44 : f32 = f1;
   let x_46 : f32 = s1;
   let x_48 : bool = (isInf(x_44) || (x_46 == 1.0));
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.hlsl
index 4cb3c14..ca4f0b8 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.hlsl
@@ -4,7 +4,7 @@
 };
 
 void main_1() {
-  if (((1.0f % 1.0f) <= 0.01f)) {
+  if (((1.0f - (1.0f * floor((1.0f / 1.0f)))) <= 0.01f)) {
     const uint scalar_offset = ((16u * uint(0))) / 4;
     const int x_29 = asint(x_5[scalar_offset / 4][scalar_offset % 4]);
     const uint scalar_offset_1 = ((16u * uint(0))) / 4;
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.msl
index e2d1f94..5531972 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -21,7 +19,7 @@
 };
 
 void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) {
-  if (((1.0f % 1.0f) <= 0.01f)) {
+  if (((1.0f - (1.0f * floor((1.0f / 1.0f)))) <= 0.01f)) {
     int const x_29 = x_5.x_GLF_uniform_int_values.arr[0].el;
     int const x_32 = x_5.x_GLF_uniform_int_values.arr[0].el;
     int const x_35 = x_5.x_GLF_uniform_int_values.arr[1].el;
@@ -42,8 +40,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\u8zg.0.metal:22:14: error: invalid operands to binary expression ('float' and 'float')
-  if (((1.0f % 1.0f) <= 0.01f)) {
-        ~~~~ ^ ~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.spvasm
index 1f59503..7607b44 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.spvasm
@@ -1,9 +1,10 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 57
+; Bound: 61
 ; Schema: 0
                OpCapability Shader
+         %21 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical GLSL450
                OpEntryPoint Fragment %main "main" %tint_symbol_1
                OpExecutionMode %main OriginUpperLeft
@@ -50,48 +51,51 @@
 %_ptr_Uniform_int = OpTypePointer Uniform %int
       %int_1 = OpConstant %int 1
    %main_out = OpTypeStruct %v4float
-         %45 = OpTypeFunction %void %main_out
+         %49 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %15
          %18 = OpLabel
-         %20 = OpFMod %float %float_1 %float_1
-         %22 = OpFOrdLessThanEqual %bool %20 %float_0_00999999978
-               OpSelectionMerge %24 None
-               OpBranchConditional %22 %25 %26
-         %25 = OpLabel
-         %30 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
-         %31 = OpLoad %int %30
-         %32 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
-         %33 = OpLoad %int %32
-         %35 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
-         %36 = OpLoad %int %35
-         %37 = OpConvertSToF %float %31
-         %38 = OpConvertSToF %float %33
-         %39 = OpConvertSToF %float %36
-         %40 = OpCompositeConstruct %v4float %float_1 %37 %38 %39
-               OpStore %x_GLF_color %40
-               OpBranch %24
-         %26 = OpLabel
-         %41 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
-         %42 = OpLoad %int %41
-         %43 = OpConvertSToF %float %42
-         %44 = OpCompositeConstruct %v4float %43 %43 %43 %43
+         %22 = OpFDiv %float %float_1 %float_1
+         %20 = OpExtInst %float %21 Floor %22
+         %23 = OpFMul %float %float_1 %20
+         %24 = OpFSub %float %float_1 %23
+         %26 = OpFOrdLessThanEqual %bool %24 %float_0_00999999978
+               OpSelectionMerge %28 None
+               OpBranchConditional %26 %29 %30
+         %29 = OpLabel
+         %34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
+         %35 = OpLoad %int %34
+         %36 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
+         %37 = OpLoad %int %36
+         %39 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
+         %40 = OpLoad %int %39
+         %41 = OpConvertSToF %float %35
+         %42 = OpConvertSToF %float %37
+         %43 = OpConvertSToF %float %40
+         %44 = OpCompositeConstruct %v4float %float_1 %41 %42 %43
                OpStore %x_GLF_color %44
-               OpBranch %24
-         %24 = OpLabel
+               OpBranch %28
+         %30 = OpLabel
+         %45 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
+         %46 = OpLoad %int %45
+         %47 = OpConvertSToF %float %46
+         %48 = OpCompositeConstruct %v4float %47 %47 %47 %47
+               OpStore %x_GLF_color %48
+               OpBranch %28
+         %28 = OpLabel
                OpReturn
                OpFunctionEnd
-%tint_symbol_2 = OpFunction %void None %45
+%tint_symbol_2 = OpFunction %void None %49
 %tint_symbol = OpFunctionParameter %main_out
-         %49 = OpLabel
-         %50 = OpCompositeExtract %v4float %tint_symbol 0
-               OpStore %tint_symbol_1 %50
+         %53 = OpLabel
+         %54 = OpCompositeExtract %v4float %tint_symbol 0
+               OpStore %tint_symbol_1 %54
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %15
-         %52 = OpLabel
-         %53 = OpFunctionCall %void %main_1
-         %55 = OpLoad %v4float %x_GLF_color
-         %56 = OpCompositeConstruct %main_out %55
-         %54 = OpFunctionCall %void %tint_symbol_2 %56
+         %56 = OpLabel
+         %57 = OpFunctionCall %void %main_1
+         %59 = OpLoad %v4float %x_GLF_color
+         %60 = OpCompositeConstruct %main_out %59
+         %58 = OpFunctionCall %void %tint_symbol_2 %60
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.wgsl
index 020e0e9..dbba7f3 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.wgsl
@@ -10,7 +10,7 @@
 [[group(0), binding(0)]] var<uniform> x_5 : buf0;
 
 fn main_1() {
-  if (((1.0 % 1.0) <= 0.01)) {
+  if (((1.0 - (1.0 * floor((1.0 / 1.0)))) <= 0.01)) {
     let x_29 : i32 = x_5.x_GLF_uniform_int_values[0];
     let x_32 : i32 = x_5.x_GLF_uniform_int_values[0];
     let x_35 : i32 = x_5.x_GLF_uniform_int_values[1];
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.msl
index 5e4bde3..3108d65 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -21,7 +19,7 @@
 };
 
 void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) {
-  if (((1.0f % 1.0f) <= 0.01f)) {
+  if ((fmod(1.0f, 1.0f) <= 0.01f)) {
     int const x_29 = x_5.x_GLF_uniform_int_values.arr[0].el;
     int const x_32 = x_5.x_GLF_uniform_int_values.arr[0].el;
     int const x_35 = x_5.x_GLF_uniform_int_values.arr[1].el;
@@ -42,8 +40,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\u180.0.metal:22:14: error: invalid operands to binary expression ('float' and 'float')
-  if (((1.0f % 1.0f) <= 0.01f)) {
-        ~~~~ ^ ~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.spvasm
index 1f59503..91368f6 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.spvasm
@@ -53,7 +53,7 @@
          %45 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %15
          %18 = OpLabel
-         %20 = OpFMod %float %float_1 %float_1
+         %20 = OpFRem %float %float_1 %float_1
          %22 = OpFOrdLessThanEqual %bool %20 %float_0_00999999978
                OpSelectionMerge %24 None
                OpBranchConditional %22 %25 %26
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.hlsl
index 67f50ff..ccce3d4 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.hlsl
@@ -16,7 +16,7 @@
   const int x_13 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
   x_GLF_color = float4(float(x_10), float(x_11), float(x_12), float(x_13));
   const float x_45 = asfloat(x_8[1].x);
-  a = (x_45 % asfloat(0x7fc00000u));
+  a = (x_45 - (asfloat(0x7fc00000u) * floor((x_45 / asfloat(0x7fc00000u)))));
   const float x_47 = a;
   const uint scalar_offset_2 = ((16u * uint(0))) / 4;
   const float x_49 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]);
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.msl
index c3188c0..ac1f176 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -38,7 +36,7 @@
   int const x_13 = x_5.x_GLF_uniform_int_values.arr[0].el;
   *(tint_symbol_4) = float4(float(x_10), float(x_11), float(x_12), float(x_13));
   float const x_45 = x_8.x_GLF_uniform_float_values.arr[1].el;
-  a = (x_45 % NAN);
+  a = (x_45 - (NAN * floor((x_45 / NAN))));
   float const x_47 = a;
   float const x_49 = x_8.x_GLF_uniform_float_values.arr[0].el;
   if ((x_47 != x_49)) {
@@ -56,8 +54,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\ubcg.0.metal:39:13: error: invalid operands to binary expression ('const float' and 'float')
-  a = (x_45 % NAN);
-       ~~~~ ^ ~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.spvasm
index 4c857a1..eaeec78 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.spvasm
@@ -1,9 +1,10 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 72
+; Bound: 76
 ; Schema: 0
                OpCapability Shader
+         %48 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical GLSL450
                OpEntryPoint Fragment %main "main" %tint_symbol_1
                OpExecutionMode %main OriginUpperLeft
@@ -68,7 +69,7 @@
      %uint_1 = OpConstant %uint 1
 %_ptr_Private_float = OpTypePointer Private %float
    %main_out = OpTypeStruct %v4float
-         %60 = OpTypeFunction %void %main_out
+         %64 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %19
          %22 = OpLabel
           %a = OpVariable %_ptr_Function_float Function %25
@@ -88,35 +89,38 @@
                OpStore %x_GLF_color %42
          %44 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1
          %45 = OpLoad %float %44
-         %47 = OpFMod %float %45 %float_0x1_8p_128
-               OpStore %a %47
-         %48 = OpLoad %float %a
-         %49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
-         %50 = OpLoad %float %49
-         %51 = OpFOrdNotEqual %bool %48 %50
-               OpSelectionMerge %53 None
-               OpBranchConditional %51 %54 %53
-         %54 = OpLabel
-         %55 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
-         %56 = OpLoad %float %55
-         %59 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1
-               OpStore %59 %56
-               OpBranch %53
-         %53 = OpLabel
+         %49 = OpFDiv %float %45 %float_0x1_8p_128
+         %47 = OpExtInst %float %48 Floor %49
+         %50 = OpFMul %float %float_0x1_8p_128 %47
+         %51 = OpFSub %float %45 %50
+               OpStore %a %51
+         %52 = OpLoad %float %a
+         %53 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
+         %54 = OpLoad %float %53
+         %55 = OpFOrdNotEqual %bool %52 %54
+               OpSelectionMerge %57 None
+               OpBranchConditional %55 %58 %57
+         %58 = OpLabel
+         %59 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
+         %60 = OpLoad %float %59
+         %63 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1
+               OpStore %63 %60
+               OpBranch %57
+         %57 = OpLabel
                OpReturn
                OpFunctionEnd
-%tint_symbol_2 = OpFunction %void None %60
+%tint_symbol_2 = OpFunction %void None %64
 %tint_symbol = OpFunctionParameter %main_out
-         %64 = OpLabel
-         %65 = OpCompositeExtract %v4float %tint_symbol 0
-               OpStore %tint_symbol_1 %65
+         %68 = OpLabel
+         %69 = OpCompositeExtract %v4float %tint_symbol 0
+               OpStore %tint_symbol_1 %69
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %19
-         %67 = OpLabel
-         %68 = OpFunctionCall %void %main_1
-         %70 = OpLoad %v4float %x_GLF_color
-         %71 = OpCompositeConstruct %main_out %70
-         %69 = OpFunctionCall %void %tint_symbol_2 %71
+         %71 = OpLabel
+         %72 = OpFunctionCall %void %main_1
+         %74 = OpLoad %v4float %x_GLF_color
+         %75 = OpCompositeConstruct %main_out %74
+         %73 = OpFunctionCall %void %tint_symbol_2 %75
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.wgsl
index b317f98..eb7bb53 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.wgsl
@@ -26,7 +26,7 @@
   let x_13 : i32 = x_5.x_GLF_uniform_int_values[0];
   x_GLF_color = vec4<f32>(f32(x_10), f32(x_11), f32(x_12), f32(x_13));
   let x_45 : f32 = x_8.x_GLF_uniform_float_values[1];
-  a = (x_45 % 0x1.8p+128);
+  a = (x_45 - (0x1.8p+128 * floor((x_45 / 0x1.8p+128))));
   let x_47 : f32 = a;
   let x_49 : f32 = x_8.x_GLF_uniform_float_values[0];
   if ((x_47 != x_49)) {
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.hlsl
index 420ed9d..f0a0bf5 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.hlsl
@@ -16,7 +16,7 @@
   const int x_13 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
   x_GLF_color = float4(float(x_10), float(x_11), float(x_12), float(x_13));
   const float x_45 = asfloat(x_8[1].x);
-  a = (asfloat(0x7fc00000u) % x_45);
+  a = (asfloat(0x7fc00000u) - (x_45 * floor((asfloat(0x7fc00000u) / x_45))));
   const float x_47 = a;
   const uint scalar_offset_2 = ((16u * uint(0))) / 4;
   const float x_49 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]);
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.msl
index 915b6d5..752e43d 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -38,7 +36,7 @@
   int const x_13 = x_5.x_GLF_uniform_int_values.arr[0].el;
   *(tint_symbol_4) = float4(float(x_10), float(x_11), float(x_12), float(x_13));
   float const x_45 = x_8.x_GLF_uniform_float_values.arr[1].el;
-  a = (NAN % x_45);
+  a = (NAN - (x_45 * floor((NAN / x_45))));
   float const x_47 = a;
   float const x_49 = x_8.x_GLF_uniform_float_values.arr[0].el;
   if ((x_47 != x_49)) {
@@ -56,8 +54,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\uc6w.0.metal:39:12: error: invalid operands to binary expression ('float' and 'const float')
-  a = (NAN % x_45);
-       ~~~ ^ ~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.spvasm
index e69f89a..079ad52 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.spvasm
@@ -1,9 +1,10 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 72
+; Bound: 76
 ; Schema: 0
                OpCapability Shader
+         %48 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical GLSL450
                OpEntryPoint Fragment %main "main" %tint_symbol_1
                OpExecutionMode %main OriginUpperLeft
@@ -68,7 +69,7 @@
      %uint_1 = OpConstant %uint 1
 %_ptr_Private_float = OpTypePointer Private %float
    %main_out = OpTypeStruct %v4float
-         %60 = OpTypeFunction %void %main_out
+         %64 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %19
          %22 = OpLabel
           %a = OpVariable %_ptr_Function_float Function %25
@@ -88,35 +89,38 @@
                OpStore %x_GLF_color %42
          %44 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1
          %45 = OpLoad %float %44
-         %47 = OpFMod %float %float_n0x1_8p_128 %45
-               OpStore %a %47
-         %48 = OpLoad %float %a
-         %49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
-         %50 = OpLoad %float %49
-         %51 = OpFOrdNotEqual %bool %48 %50
-               OpSelectionMerge %53 None
-               OpBranchConditional %51 %54 %53
-         %54 = OpLabel
-         %55 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
-         %56 = OpLoad %float %55
-         %59 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1
-               OpStore %59 %56
-               OpBranch %53
-         %53 = OpLabel
+         %49 = OpFDiv %float %float_n0x1_8p_128 %45
+         %47 = OpExtInst %float %48 Floor %49
+         %50 = OpFMul %float %45 %47
+         %51 = OpFSub %float %float_n0x1_8p_128 %50
+               OpStore %a %51
+         %52 = OpLoad %float %a
+         %53 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
+         %54 = OpLoad %float %53
+         %55 = OpFOrdNotEqual %bool %52 %54
+               OpSelectionMerge %57 None
+               OpBranchConditional %55 %58 %57
+         %58 = OpLabel
+         %59 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0
+         %60 = OpLoad %float %59
+         %63 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1
+               OpStore %63 %60
+               OpBranch %57
+         %57 = OpLabel
                OpReturn
                OpFunctionEnd
-%tint_symbol_2 = OpFunction %void None %60
+%tint_symbol_2 = OpFunction %void None %64
 %tint_symbol = OpFunctionParameter %main_out
-         %64 = OpLabel
-         %65 = OpCompositeExtract %v4float %tint_symbol 0
-               OpStore %tint_symbol_1 %65
+         %68 = OpLabel
+         %69 = OpCompositeExtract %v4float %tint_symbol 0
+               OpStore %tint_symbol_1 %69
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %19
-         %67 = OpLabel
-         %68 = OpFunctionCall %void %main_1
-         %70 = OpLoad %v4float %x_GLF_color
-         %71 = OpCompositeConstruct %main_out %70
-         %69 = OpFunctionCall %void %tint_symbol_2 %71
+         %71 = OpLabel
+         %72 = OpFunctionCall %void %main_1
+         %74 = OpLoad %v4float %x_GLF_color
+         %75 = OpCompositeConstruct %main_out %74
+         %73 = OpFunctionCall %void %tint_symbol_2 %75
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.wgsl
index bf323a2..4d64cae 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.wgsl
@@ -26,7 +26,7 @@
   let x_13 : i32 = x_5.x_GLF_uniform_int_values[0];
   x_GLF_color = vec4<f32>(f32(x_10), f32(x_11), f32(x_12), f32(x_13));
   let x_45 : f32 = x_8.x_GLF_uniform_float_values[1];
-  a = (-0x1.8p+128 % x_45);
+  a = (-0x1.8p+128 - (x_45 * floor((-0x1.8p+128 / x_45))));
   let x_47 : f32 = a;
   let x_49 : f32 = x_8.x_GLF_uniform_float_values[0];
   if ((x_47 != x_49)) {
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.hlsl
index 307332d..0a42777 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.hlsl
@@ -5,7 +5,7 @@
 
 void main_1() {
   float a = 0.0f;
-  a = (asfloat(1u) % 1.0f);
+  a = (asfloat(1u) - (1.0f * floor((asfloat(1u) / 1.0f))));
   const float x_29 = asfloat(x_6[1].x);
   x_GLF_color = float4(x_29, x_29, x_29, x_29);
   const float x_31 = a;
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.msl
index 6652116..a72ccb7 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -22,7 +20,7 @@
 
 void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) {
   float a = 0.0f;
-  a = (as_type<float>(1u) % 1.0f);
+  a = (as_type<float>(1u) - (1.0f * floor((as_type<float>(1u) / 1.0f))));
   float const x_29 = x_6.x_GLF_uniform_float_values.arr[1].el;
   *(tint_symbol_4) = float4(x_29, x_29, x_29, x_29);
   float const x_31 = a;
@@ -45,8 +43,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\uf8c.0.metal:23:27: error: invalid operands to binary expression ('float' and 'float')
-  a = (as_type<float>(1u) % 1.0f);
-       ~~~~~~~~~~~~~~~~~~ ^ ~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.spvasm
index 5169c11..0617387 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.spvasm
@@ -1,9 +1,10 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 62
+; Bound: 67
 ; Schema: 0
                OpCapability Shader
+         %25 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical GLSL450
                OpEntryPoint Fragment %main "main" %tint_symbol_1
                OpExecutionMode %main OriginUpperLeft
@@ -54,50 +55,54 @@
        %bool = OpTypeBool
       %int_0 = OpConstant %int 0
    %main_out = OpTypeStruct %v4float
-         %50 = OpTypeFunction %void %main_out
+         %55 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %14
          %17 = OpLabel
           %a = OpVariable %_ptr_Function_float Function %20
          %21 = OpBitcast %float %uint_1
-         %24 = OpFMod %float %21 %float_1
-               OpStore %a %24
-         %29 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
-         %30 = OpLoad %float %29
-         %31 = OpCompositeConstruct %v4float %30 %30 %30 %30
-               OpStore %x_GLF_color %31
-         %32 = OpLoad %float %a
-         %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2
+         %26 = OpBitcast %float %uint_1
+         %27 = OpFDiv %float %26 %float_1
+         %24 = OpExtInst %float %25 Floor %27
+         %28 = OpFMul %float %float_1 %24
+         %29 = OpFSub %float %21 %28
+               OpStore %a %29
+         %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
          %35 = OpLoad %float %34
-         %36 = OpFOrdLessThan %bool %32 %35
-               OpSelectionMerge %38 None
-               OpBranchConditional %36 %39 %38
-         %39 = OpLabel
-         %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
-         %42 = OpLoad %float %41
-         %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
-         %44 = OpLoad %float %43
-         %45 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
-         %46 = OpLoad %float %45
-         %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
-         %48 = OpLoad %float %47
-         %49 = OpCompositeConstruct %v4float %42 %44 %46 %48
-               OpStore %x_GLF_color %49
-               OpBranch %38
-         %38 = OpLabel
+         %36 = OpCompositeConstruct %v4float %35 %35 %35 %35
+               OpStore %x_GLF_color %36
+         %37 = OpLoad %float %a
+         %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2
+         %40 = OpLoad %float %39
+         %41 = OpFOrdLessThan %bool %37 %40
+               OpSelectionMerge %43 None
+               OpBranchConditional %41 %44 %43
+         %44 = OpLabel
+         %46 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
+         %47 = OpLoad %float %46
+         %48 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
+         %49 = OpLoad %float %48
+         %50 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
+         %51 = OpLoad %float %50
+         %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
+         %53 = OpLoad %float %52
+         %54 = OpCompositeConstruct %v4float %47 %49 %51 %53
+               OpStore %x_GLF_color %54
+               OpBranch %43
+         %43 = OpLabel
                OpReturn
                OpFunctionEnd
-%tint_symbol_2 = OpFunction %void None %50
+%tint_symbol_2 = OpFunction %void None %55
 %tint_symbol = OpFunctionParameter %main_out
-         %54 = OpLabel
-         %55 = OpCompositeExtract %v4float %tint_symbol 0
-               OpStore %tint_symbol_1 %55
+         %59 = OpLabel
+         %60 = OpCompositeExtract %v4float %tint_symbol 0
+               OpStore %tint_symbol_1 %60
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %14
-         %57 = OpLabel
-         %58 = OpFunctionCall %void %main_1
-         %60 = OpLoad %v4float %x_GLF_color
-         %61 = OpCompositeConstruct %main_out %60
-         %59 = OpFunctionCall %void %tint_symbol_2 %61
+         %62 = OpLabel
+         %63 = OpFunctionCall %void %main_1
+         %65 = OpLoad %v4float %x_GLF_color
+         %66 = OpCompositeConstruct %main_out %65
+         %64 = OpFunctionCall %void %tint_symbol_2 %66
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.wgsl
index 8f1d936..ca60286 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.wgsl
@@ -11,7 +11,7 @@
 
 fn main_1() {
   var a : f32;
-  a = (bitcast<f32>(1u) % 1.0);
+  a = (bitcast<f32>(1u) - (1.0 * floor((bitcast<f32>(1u) / 1.0))));
   let x_29 : f32 = x_6.x_GLF_uniform_float_values[1];
   x_GLF_color = vec4<f32>(x_29, x_29, x_29, x_29);
   let x_31 : f32 = a;
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.msl
index da17ed9..d51d832 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -22,7 +20,7 @@
 
 void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) {
   float a = 0.0f;
-  a = (as_type<float>(1u) % 1.0f);
+  a = fmod(as_type<float>(1u), 1.0f);
   float const x_29 = x_6.x_GLF_uniform_float_values.arr[1].el;
   *(tint_symbol_4) = float4(x_29, x_29, x_29, x_29);
   float const x_31 = a;
@@ -45,8 +43,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\ue28.0.metal:23:27: error: invalid operands to binary expression ('float' and 'float')
-  a = (as_type<float>(1u) % 1.0f);
-       ~~~~~~~~~~~~~~~~~~ ^ ~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.spvasm
index 5169c11..6114885 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.spvasm
@@ -59,7 +59,7 @@
          %17 = OpLabel
           %a = OpVariable %_ptr_Function_float Function %20
          %21 = OpBitcast %float %uint_1
-         %24 = OpFMod %float %21 %float_1
+         %24 = OpFRem %float %21 %float_1
                OpStore %a %24
          %29 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
          %30 = OpLoad %float %29
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.hlsl
index 2ae1a6e..29ab977 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.hlsl
@@ -10,7 +10,7 @@
   float a = 0.0f;
   const uint scalar_offset = ((16u * uint(0))) / 4;
   const float x_30 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]);
-  a = (x_30 % 1.0f);
+  a = (x_30 - (1.0f * floor((x_30 / 1.0f))));
   const float x_32 = a;
   const uint scalar_offset_1 = ((16u * uint(0))) / 4;
   const float x_34 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.msl
index 514ffa4..d1276b9 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -33,7 +31,7 @@
 void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) {
   float a = 0.0f;
   float const x_30 = x_6.x_GLF_uniform_float_values.arr[0].el;
-  a = (x_30 % 1.0f);
+  a = (x_30 - (1.0f * floor((x_30 / 1.0f))));
   float const x_32 = a;
   float const x_34 = x_6.x_GLF_uniform_float_values.arr[0].el;
   if ((x_32 == x_34)) {
@@ -57,8 +55,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\us0.0.metal:34:13: error: invalid operands to binary expression ('const float' and 'float')
-  a = (x_30 % 1.0f);
-       ~~~~ ^ ~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.spvasm
index 4f6ad22..d891a6e 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.spvasm
@@ -1,9 +1,10 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 66
+; Bound: 70
 ; Schema: 0
                OpCapability Shader
+         %34 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical GLSL450
                OpEntryPoint Fragment %main "main" %tint_symbol_1
                OpExecutionMode %main OriginUpperLeft
@@ -66,52 +67,55 @@
        %bool = OpTypeBool
 %_ptr_Uniform_int = OpTypePointer Uniform %int
    %main_out = OpTypeStruct %v4float
-         %54 = OpTypeFunction %void %main_out
+         %58 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %20
          %23 = OpLabel
           %a = OpVariable %_ptr_Function_float Function %26
          %30 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
          %31 = OpLoad %float %30
-         %33 = OpFMod %float %31 %float_1
-               OpStore %a %33
-         %34 = OpLoad %float %a
-         %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
-         %36 = OpLoad %float %35
-         %37 = OpFOrdEqual %bool %34 %36
-               OpSelectionMerge %39 None
-               OpBranchConditional %37 %40 %41
-         %40 = OpLabel
-         %43 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
-         %44 = OpLoad %int %43
-         %45 = OpLoad %float %a
-         %46 = OpLoad %float %a
+         %35 = OpFDiv %float %31 %float_1
+         %33 = OpExtInst %float %34 Floor %35
+         %36 = OpFMul %float %float_1 %33
+         %37 = OpFSub %float %31 %36
+               OpStore %a %37
+         %38 = OpLoad %float %a
+         %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
+         %40 = OpLoad %float %39
+         %41 = OpFOrdEqual %bool %38 %40
+               OpSelectionMerge %43 None
+               OpBranchConditional %41 %44 %45
+         %44 = OpLabel
          %47 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
          %48 = OpLoad %int %47
-         %49 = OpConvertSToF %float %44
-         %50 = OpConvertSToF %float %48
-         %51 = OpCompositeConstruct %v4float %49 %45 %46 %50
-               OpStore %x_GLF_color %51
-               OpBranch %39
-         %41 = OpLabel
-         %52 = OpLoad %float %a
-         %53 = OpCompositeConstruct %v4float %52 %52 %52 %52
-               OpStore %x_GLF_color %53
-               OpBranch %39
-         %39 = OpLabel
+         %49 = OpLoad %float %a
+         %50 = OpLoad %float %a
+         %51 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
+         %52 = OpLoad %int %51
+         %53 = OpConvertSToF %float %48
+         %54 = OpConvertSToF %float %52
+         %55 = OpCompositeConstruct %v4float %53 %49 %50 %54
+               OpStore %x_GLF_color %55
+               OpBranch %43
+         %45 = OpLabel
+         %56 = OpLoad %float %a
+         %57 = OpCompositeConstruct %v4float %56 %56 %56 %56
+               OpStore %x_GLF_color %57
+               OpBranch %43
+         %43 = OpLabel
                OpReturn
                OpFunctionEnd
-%tint_symbol_2 = OpFunction %void None %54
+%tint_symbol_2 = OpFunction %void None %58
 %tint_symbol = OpFunctionParameter %main_out
-         %58 = OpLabel
-         %59 = OpCompositeExtract %v4float %tint_symbol 0
-               OpStore %tint_symbol_1 %59
+         %62 = OpLabel
+         %63 = OpCompositeExtract %v4float %tint_symbol 0
+               OpStore %tint_symbol_1 %63
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %20
-         %61 = OpLabel
-         %62 = OpFunctionCall %void %main_1
-         %64 = OpLoad %v4float %x_GLF_color
-         %65 = OpCompositeConstruct %main_out %64
-         %63 = OpFunctionCall %void %tint_symbol_2 %65
+         %65 = OpLabel
+         %66 = OpFunctionCall %void %main_1
+         %68 = OpLoad %v4float %x_GLF_color
+         %69 = OpCompositeConstruct %main_out %68
+         %67 = OpFunctionCall %void %tint_symbol_2 %69
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.wgsl
index 2690c8d..2c3c99e 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.wgsl
@@ -21,7 +21,7 @@
 fn main_1() {
   var a : f32;
   let x_30 : f32 = x_6.x_GLF_uniform_float_values[0];
-  a = (x_30 % 1.0);
+  a = (x_30 - (1.0 * floor((x_30 / 1.0))));
   let x_32 : f32 = a;
   let x_34 : f32 = x_6.x_GLF_uniform_float_values[0];
   if ((x_32 == x_34)) {
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.msl
index 7fbbeaa..7df3919 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -33,7 +31,7 @@
 void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) {
   float a = 0.0f;
   float const x_30 = x_6.x_GLF_uniform_float_values.arr[0].el;
-  a = (x_30 % 1.0f);
+  a = fmod(x_30, 1.0f);
   float const x_32 = a;
   float const x_34 = x_6.x_GLF_uniform_float_values.arr[0].el;
   if ((x_32 == x_34)) {
@@ -57,8 +55,3 @@
   return tint_symbol_3;
 }
 
-T:\tmp\u8k0.0.metal:34:13: error: invalid operands to binary expression ('const float' and 'float')
-  a = (x_30 % 1.0f);
-       ~~~~ ^ ~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.spvasm
index 4f6ad22..a904efa 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.spvasm
@@ -72,7 +72,7 @@
           %a = OpVariable %_ptr_Function_float Function %26
          %30 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
          %31 = OpLoad %float %30
-         %33 = OpFMod %float %31 %float_1
+         %33 = OpFRem %float %31 %float_1
                OpStore %a %33
          %34 = OpLoad %float %a
          %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.msl
index 649909a..0e2f8aa 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -75,7 +73,7 @@
   float const x_86 = b;
   float const x_88 = x_7.x_GLF_uniform_float_values.arr[2].el;
   float const x_91 = x_7.x_GLF_uniform_float_values.arr[1].el;
-  if ((distance(x_86, x_88) < x_91)) {
+  if ((fabs(x_86 - x_88) < x_91)) {
     int const x_97 = x_15.x_GLF_uniform_int_values.arr[0].el;
     int const x_100 = x_15.x_GLF_uniform_int_values.arr[1].el;
     int const x_103 = x_15.x_GLF_uniform_int_values.arr[1].el;
@@ -97,26 +95,3 @@
   return tint_symbol_5;
 }
 
-T:\tmp\udoo.0.metal:76:8: error: call to 'distance' is ambiguous
-  if ((distance(x_86, x_88) < x_91)) {
-       ^~~~~~~~
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:481:17: note: candidate function
-METAL_FUNC half distance(half2 x, half2 y)
-                ^
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:512:17: note: candidate function
-METAL_FUNC half distance(half3 x, half3 y)
-                ^
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:543:17: note: candidate function
-METAL_FUNC half distance(half4 x, half4 y)
-                ^
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:648:18: note: candidate function
-METAL_FUNC float distance(float2 x, float2 y)
-                 ^
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:691:18: note: candidate function
-METAL_FUNC float distance(float3 x, float3 y)
-                 ^
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:734:18: note: candidate function
-METAL_FUNC float distance(float4 x, float4 y)
-                 ^
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.msl
index e8b297a..0e2f8aa 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -75,7 +73,7 @@
   float const x_86 = b;
   float const x_88 = x_7.x_GLF_uniform_float_values.arr[2].el;
   float const x_91 = x_7.x_GLF_uniform_float_values.arr[1].el;
-  if ((distance(x_86, x_88) < x_91)) {
+  if ((fabs(x_86 - x_88) < x_91)) {
     int const x_97 = x_15.x_GLF_uniform_int_values.arr[0].el;
     int const x_100 = x_15.x_GLF_uniform_int_values.arr[1].el;
     int const x_103 = x_15.x_GLF_uniform_int_values.arr[1].el;
@@ -97,26 +95,3 @@
   return tint_symbol_5;
 }
 
-T:\tmp\udr8.0.metal:76:8: error: call to 'distance' is ambiguous
-  if ((distance(x_86, x_88) < x_91)) {
-       ^~~~~~~~
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:481:17: note: candidate function
-METAL_FUNC half distance(half2 x, half2 y)
-                ^
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:512:17: note: candidate function
-METAL_FUNC half distance(half3 x, half3 y)
-                ^
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:543:17: note: candidate function
-METAL_FUNC half distance(half4 x, half4 y)
-                ^
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:648:18: note: candidate function
-METAL_FUNC float distance(float2 x, float2 y)
-                 ^
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:691:18: note: candidate function
-METAL_FUNC float distance(float3 x, float3 y)
-                 ^
-C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:734:18: note: candidate function
-METAL_FUNC float distance(float4 x, float4 y)
-                 ^
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.hlsl
index 8d53961..206d78b 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.hlsl
@@ -54,7 +54,7 @@
           x_56_phi = x_68;
         } else {
           x_76_phi = x_55;
-          if (((float(x_58) % round(x_49)) <= 0.01f)) {
+          if (((float(x_58) - (round(x_49) * floor((float(x_58) / round(x_49))))) <= 0.01f)) {
             x_75 = (x_55 + 100.0f);
             x_76_phi = x_75;
           }
@@ -121,7 +121,7 @@
           x_93_phi = x_105;
         } else {
           x_113_phi = x_92;
-          if (((float(x_95) % round(x_49)) <= 0.01f)) {
+          if (((float(x_95) - (round(x_49) * floor((float(x_95) / round(x_49))))) <= 0.01f)) {
             x_112 = (x_92 + 100.0f);
             x_113_phi = x_112;
           }
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.msl
index 6b28523..ad27d07 100755
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -59,7 +57,7 @@
           x_56_phi = x_68;
         } else {
           x_76_phi = x_55;
-          if (((float(x_58) % rint(x_49)) <= 0.01f)) {
+          if (((float(x_58) - (rint(x_49) * floor((float(x_58) / rint(x_49))))) <= 0.01f)) {
             x_75 = (x_55 + 100.0f);
             x_76_phi = x_75;
           }
@@ -126,7 +124,7 @@
           x_93_phi = x_105;
         } else {
           x_113_phi = x_92;
-          if (((float(x_95) % rint(x_49)) <= 0.01f)) {
+          if (((float(x_95) - (rint(x_49) * floor((float(x_95) / rint(x_49))))) <= 0.01f)) {
             x_112 = (x_92 + 100.0f);
             x_113_phi = x_112;
           }
@@ -198,11 +196,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\u2mo.0.metal:60:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_58) % rint(x_49)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-T:\tmp\u2mo.0.metal:127:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_95) % rint(x_49)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-2 errors generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.spvasm
index fdd3fe1..4762c18 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 254
+; Bound: 264
 ; Schema: 0
                OpCapability Shader
          %56 = OpExtInstImport "GLSL.std.450"
@@ -118,7 +118,7 @@
       %int_3 = OpConstant %int 3
     %float_1 = OpConstant %float 1
    %main_out = OpTypeStruct %v4float
-        %241 = OpTypeFunction %void %main_out
+        %251 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %15
          %18 = OpLabel
           %c = OpVariable %_ptr_Function_v3float Function %22
@@ -207,243 +207,253 @@
                OpStore %x_76_phi %97
          %98 = OpConvertSToF %float %75
          %99 = OpExtInst %float %56 RoundEven %55
-        %100 = OpFMod %float %98 %99
-        %102 = OpFOrdLessThanEqual %bool %100 %float_0_00999999978
-               OpSelectionMerge %103 None
-               OpBranchConditional %102 %104 %103
-        %104 = OpLabel
-        %105 = OpLoad %float %x_55
-        %107 = OpFAdd %float %105 %float_100
-               OpStore %x_75 %107
-        %108 = OpLoad %float %x_75
-               OpStore %x_76_phi %108
-               OpBranch %103
-        %103 = OpLabel
-        %109 = OpLoad %float %x_76_phi
-               OpStore %x_76 %109
-        %110 = OpLoad %float %x_76
-               OpStore %x_56_phi %110
+        %101 = OpConvertSToF %float %75
+        %102 = OpExtInst %float %56 RoundEven %55
+        %103 = OpFDiv %float %101 %102
+        %100 = OpExtInst %float %56 Floor %103
+        %104 = OpFMul %float %99 %100
+        %105 = OpFSub %float %98 %104
+        %107 = OpFOrdLessThanEqual %bool %105 %float_0_00999999978
+               OpSelectionMerge %108 None
+               OpBranchConditional %107 %109 %108
+        %109 = OpLabel
+        %110 = OpLoad %float %x_55
+        %112 = OpFAdd %float %110 %float_100
+               OpStore %x_75 %112
+        %113 = OpLoad %float %x_75
+               OpStore %x_76_phi %113
+               OpBranch %108
+        %108 = OpLabel
+        %114 = OpLoad %float %x_76_phi
+               OpStore %x_76 %114
+        %115 = OpLoad %float %x_76
+               OpStore %x_56_phi %115
                OpBranch %90
          %90 = OpLabel
-        %111 = OpLoad %float %x_56_phi
-               OpStore %x_56 %111
-        %112 = OpConvertSToF %float %75
-        %113 = OpLoad %float %x_51
-        %114 = OpFOrdGreaterThanEqual %bool %112 %113
-               OpSelectionMerge %115 None
-               OpBranchConditional %114 %116 %115
-        %116 = OpLabel
-        %117 = OpLoad %float %x_56
-               OpStore %x_81_phi %117
-        %118 = OpLoad %float %x_56
-               OpStore %x_82_phi %118
+        %116 = OpLoad %float %x_56_phi
+               OpStore %x_56 %116
+        %117 = OpConvertSToF %float %75
+        %118 = OpLoad %float %x_51
+        %119 = OpFOrdGreaterThanEqual %bool %117 %118
+               OpSelectionMerge %120 None
+               OpBranchConditional %119 %121 %120
+        %121 = OpLabel
+        %122 = OpLoad %float %x_56
+               OpStore %x_81_phi %122
+        %123 = OpLoad %float %x_56
+               OpStore %x_82_phi %123
                OpStore %x_83_phi %true
                OpBranch %67
-        %115 = OpLabel
+        %120 = OpLabel
                OpBranch %68
          %68 = OpLabel
-        %120 = OpIAdd %int %75 %int_1
-               OpStore %x_59 %120
-        %121 = OpLoad %float %x_56
-               OpStore %x_55_phi %121
-        %122 = OpLoad %int %x_59
-               OpStore %x_58_phi %122
+        %125 = OpIAdd %int %75 %int_1
+               OpStore %x_59 %125
+        %126 = OpLoad %float %x_56
+               OpStore %x_55_phi %126
+        %127 = OpLoad %int %x_59
+               OpStore %x_58_phi %127
                OpBranch %66
          %67 = OpLabel
-        %123 = OpLoad %float %x_81_phi
-               OpStore %x_81 %123
-        %124 = OpLoad %float %x_82_phi
-               OpStore %x_82 %124
-        %125 = OpLoad %bool %x_83_phi
-        %126 = OpLoad %float %x_81
-               OpStore %x_85_phi %126
-               OpSelectionMerge %127 None
-               OpBranchConditional %125 %128 %127
-        %128 = OpLabel
+        %128 = OpLoad %float %x_81_phi
+               OpStore %x_81 %128
+        %129 = OpLoad %float %x_82_phi
+               OpStore %x_82 %129
+        %130 = OpLoad %bool %x_83_phi
+        %131 = OpLoad %float %x_81
+               OpStore %x_85_phi %131
+               OpSelectionMerge %132 None
+               OpBranchConditional %130 %133 %132
+        %133 = OpLabel
                OpBranch %62
-        %127 = OpLabel
-        %129 = OpLoad %float %x_82
-               OpStore %x_85_phi %129
+        %132 = OpLabel
+        %134 = OpLoad %float %x_82
+               OpStore %x_85_phi %134
                OpBranch %62
          %62 = OpLabel
-        %138 = OpLoad %float %x_85_phi
-        %139 = OpAccessChain %_ptr_Function_float %c %uint_0
-               OpStore %139 %138
-        %141 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %142 = OpLoad %float %141
-               OpStore %x_88 %142
-               OpSelectionMerge %143 None
-               OpSwitch %uint_0 %144
-        %144 = OpLabel
+        %143 = OpLoad %float %x_85_phi
+        %144 = OpAccessChain %_ptr_Function_float %c %uint_0
+               OpStore %144 %143
+        %146 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %147 = OpLoad %float %146
+               OpStore %x_88 %147
+               OpSelectionMerge %148 None
+               OpSwitch %uint_0 %149
+        %149 = OpLabel
                OpStore %x_92_phi %float_n0_5
                OpStore %x_95_phi %int_1
-               OpBranch %145
-        %145 = OpLabel
-               OpLoopMerge %146 %147 None
+               OpBranch %150
+        %150 = OpLabel
+               OpLoopMerge %151 %152 None
+               OpBranch %153
+        %153 = OpLabel
+        %158 = OpLoad %float %x_92_phi
+               OpStore %x_92 %158
+        %159 = OpLoad %int %x_95_phi
+               OpStore %x_118_phi %float_0
+        %160 = OpLoad %float %x_92
+               OpStore %x_119_phi %160
+               OpStore %x_120_phi %false
+        %161 = OpSLessThan %bool %159 %int_800
+               OpSelectionMerge %162 None
+               OpBranchConditional %161 %163 %164
+        %163 = OpLabel
+               OpBranch %162
+        %164 = OpLabel
+               OpBranch %151
+        %162 = OpLabel
+        %167 = OpSMod %int %159 %int_32
+        %168 = OpIEqual %bool %167 %int_0
+               OpSelectionMerge %169 None
+               OpBranchConditional %168 %170 %171
+        %170 = OpLabel
+        %172 = OpLoad %float %x_92
+        %173 = OpFAdd %float %172 %float_0_400000006
+               OpStore %x_105 %173
+        %174 = OpLoad %float %x_105
+               OpStore %x_93_phi %174
+               OpBranch %169
+        %171 = OpLabel
+        %175 = OpLoad %float %x_92
+               OpStore %x_113_phi %175
+        %176 = OpConvertSToF %float %159
+        %177 = OpExtInst %float %56 RoundEven %55
+        %179 = OpConvertSToF %float %159
+        %180 = OpExtInst %float %56 RoundEven %55
+        %181 = OpFDiv %float %179 %180
+        %178 = OpExtInst %float %56 Floor %181
+        %182 = OpFMul %float %177 %178
+        %183 = OpFSub %float %176 %182
+        %184 = OpFOrdLessThanEqual %bool %183 %float_0_00999999978
+               OpSelectionMerge %185 None
+               OpBranchConditional %184 %186 %185
+        %186 = OpLabel
+        %187 = OpLoad %float %x_92
+        %188 = OpFAdd %float %187 %float_100
+               OpStore %x_112 %188
+        %189 = OpLoad %float %x_112
+               OpStore %x_113_phi %189
+               OpBranch %185
+        %185 = OpLabel
+        %190 = OpLoad %float %x_113_phi
+               OpStore %x_113 %190
+        %191 = OpLoad %float %x_113
+               OpStore %x_93_phi %191
+               OpBranch %169
+        %169 = OpLabel
+        %192 = OpLoad %float %x_93_phi
+               OpStore %x_93 %192
+        %193 = OpConvertSToF %float %159
+        %194 = OpLoad %float %x_88
+        %195 = OpFOrdGreaterThanEqual %bool %193 %194
+               OpSelectionMerge %196 None
+               OpBranchConditional %195 %197 %196
+        %197 = OpLabel
+        %198 = OpLoad %float %x_93
+               OpStore %x_118_phi %198
+        %199 = OpLoad %float %x_93
+               OpStore %x_119_phi %199
+               OpStore %x_120_phi %true
+               OpBranch %151
+        %196 = OpLabel
+               OpBranch %152
+        %152 = OpLabel
+        %200 = OpIAdd %int %159 %int_1
+               OpStore %x_96 %200
+        %201 = OpLoad %float %x_93
+               OpStore %x_92_phi %201
+        %202 = OpLoad %int %x_96
+               OpStore %x_95_phi %202
+               OpBranch %150
+        %151 = OpLabel
+        %203 = OpLoad %float %x_118_phi
+               OpStore %x_118 %203
+        %204 = OpLoad %float %x_119_phi
+               OpStore %x_119 %204
+        %205 = OpLoad %bool %x_120_phi
+        %206 = OpLoad %float %x_118
+               OpStore %x_122_phi %206
+               OpSelectionMerge %207 None
+               OpBranchConditional %205 %208 %207
+        %208 = OpLabel
+               OpBranch %148
+        %207 = OpLabel
+        %209 = OpLoad %float %x_119
+               OpStore %x_122_phi %209
                OpBranch %148
         %148 = OpLabel
-        %153 = OpLoad %float %x_92_phi
-               OpStore %x_92 %153
-        %154 = OpLoad %int %x_95_phi
-               OpStore %x_118_phi %float_0
-        %155 = OpLoad %float %x_92
-               OpStore %x_119_phi %155
-               OpStore %x_120_phi %false
-        %156 = OpSLessThan %bool %154 %int_800
-               OpSelectionMerge %157 None
-               OpBranchConditional %156 %158 %159
-        %158 = OpLabel
-               OpBranch %157
-        %159 = OpLabel
-               OpBranch %146
-        %157 = OpLabel
-        %162 = OpSMod %int %154 %int_32
-        %163 = OpIEqual %bool %162 %int_0
-               OpSelectionMerge %164 None
-               OpBranchConditional %163 %165 %166
-        %165 = OpLabel
-        %167 = OpLoad %float %x_92
-        %168 = OpFAdd %float %167 %float_0_400000006
-               OpStore %x_105 %168
-        %169 = OpLoad %float %x_105
-               OpStore %x_93_phi %169
-               OpBranch %164
-        %166 = OpLabel
-        %170 = OpLoad %float %x_92
-               OpStore %x_113_phi %170
-        %171 = OpConvertSToF %float %154
-        %172 = OpExtInst %float %56 RoundEven %55
-        %173 = OpFMod %float %171 %172
-        %174 = OpFOrdLessThanEqual %bool %173 %float_0_00999999978
-               OpSelectionMerge %175 None
-               OpBranchConditional %174 %176 %175
-        %176 = OpLabel
-        %177 = OpLoad %float %x_92
-        %178 = OpFAdd %float %177 %float_100
-               OpStore %x_112 %178
-        %179 = OpLoad %float %x_112
-               OpStore %x_113_phi %179
-               OpBranch %175
-        %175 = OpLabel
-        %180 = OpLoad %float %x_113_phi
-               OpStore %x_113 %180
-        %181 = OpLoad %float %x_113
-               OpStore %x_93_phi %181
-               OpBranch %164
-        %164 = OpLabel
-        %182 = OpLoad %float %x_93_phi
-               OpStore %x_93 %182
-        %183 = OpConvertSToF %float %154
-        %184 = OpLoad %float %x_88
-        %185 = OpFOrdGreaterThanEqual %bool %183 %184
-               OpSelectionMerge %186 None
-               OpBranchConditional %185 %187 %186
-        %187 = OpLabel
-        %188 = OpLoad %float %x_93
-               OpStore %x_118_phi %188
-        %189 = OpLoad %float %x_93
-               OpStore %x_119_phi %189
-               OpStore %x_120_phi %true
-               OpBranch %146
-        %186 = OpLabel
-               OpBranch %147
-        %147 = OpLabel
-        %190 = OpIAdd %int %154 %int_1
-               OpStore %x_96 %190
-        %191 = OpLoad %float %x_93
-               OpStore %x_92_phi %191
-        %192 = OpLoad %int %x_96
-               OpStore %x_95_phi %192
-               OpBranch %145
-        %146 = OpLabel
-        %193 = OpLoad %float %x_118_phi
-               OpStore %x_118 %193
-        %194 = OpLoad %float %x_119_phi
-               OpStore %x_119 %194
-        %195 = OpLoad %bool %x_120_phi
-        %196 = OpLoad %float %x_118
-               OpStore %x_122_phi %196
-               OpSelectionMerge %197 None
-               OpBranchConditional %195 %198 %197
-        %198 = OpLabel
-               OpBranch %143
-        %197 = OpLabel
-        %199 = OpLoad %float %x_119
-               OpStore %x_122_phi %199
-               OpBranch %143
-        %143 = OpLabel
-        %200 = OpLoad %float %x_122_phi
-        %201 = OpAccessChain %_ptr_Function_float %c %uint_1
-               OpStore %201 %200
-        %202 = OpAccessChain %_ptr_Function_float %c %uint_0
-        %203 = OpLoad %float %202
-        %204 = OpAccessChain %_ptr_Function_float %c %uint_1
-        %205 = OpLoad %float %204
-        %207 = OpAccessChain %_ptr_Function_float %c %uint_2
-        %208 = OpFAdd %float %203 %205
-               OpStore %207 %208
+        %210 = OpLoad %float %x_122_phi
+        %211 = OpAccessChain %_ptr_Function_float %c %uint_1
+               OpStore %211 %210
+        %212 = OpAccessChain %_ptr_Function_float %c %uint_0
+        %213 = OpLoad %float %212
+        %214 = OpAccessChain %_ptr_Function_float %c %uint_1
+        %215 = OpLoad %float %214
+        %217 = OpAccessChain %_ptr_Function_float %c %uint_2
+        %218 = OpFAdd %float %213 %215
+               OpStore %217 %218
                OpStore %x_129_phi %int_0
-               OpBranch %209
-        %209 = OpLabel
-               OpLoopMerge %210 %211 None
-               OpBranch %212
-        %212 = OpLabel
-        %214 = OpLoad %int %x_129_phi
-        %216 = OpSLessThan %bool %214 %int_3
-               OpSelectionMerge %217 None
-               OpBranchConditional %216 %218 %219
-        %218 = OpLabel
-               OpBranch %217
+               OpBranch %219
         %219 = OpLabel
-               OpBranch %210
-        %217 = OpLabel
-        %220 = OpAccessChain %_ptr_Function_float %c %214
-        %221 = OpLoad %float %220
-        %223 = OpFOrdGreaterThanEqual %bool %221 %float_1
-               OpSelectionMerge %224 None
-               OpBranchConditional %223 %225 %224
-        %225 = OpLabel
-        %226 = OpAccessChain %_ptr_Function_float %c %214
-        %227 = OpLoad %float %226
-        %228 = OpAccessChain %_ptr_Function_float %c %214
-        %229 = OpLoad %float %228
-        %230 = OpAccessChain %_ptr_Function_float %c %214
-        %231 = OpFMul %float %227 %229
-               OpStore %230 %231
-               OpBranch %224
-        %224 = OpLabel
-               OpBranch %211
-        %211 = OpLabel
-        %232 = OpIAdd %int %214 %int_1
-               OpStore %x_130 %232
-        %233 = OpLoad %int %x_130
-               OpStore %x_129_phi %233
-               OpBranch %209
-        %210 = OpLabel
-        %234 = OpLoad %v3float %c
-        %236 = OpExtInst %v3float %56 FAbs %234
-        %235 = OpExtInst %v3float %56 Normalize %236
-        %237 = OpCompositeExtract %float %235 0
-        %238 = OpCompositeExtract %float %235 1
-        %239 = OpCompositeExtract %float %235 2
-        %240 = OpCompositeConstruct %v4float %237 %238 %239 %float_1
-               OpStore %x_GLF_color %240
+               OpLoopMerge %220 %221 None
+               OpBranch %222
+        %222 = OpLabel
+        %224 = OpLoad %int %x_129_phi
+        %226 = OpSLessThan %bool %224 %int_3
+               OpSelectionMerge %227 None
+               OpBranchConditional %226 %228 %229
+        %228 = OpLabel
+               OpBranch %227
+        %229 = OpLabel
+               OpBranch %220
+        %227 = OpLabel
+        %230 = OpAccessChain %_ptr_Function_float %c %224
+        %231 = OpLoad %float %230
+        %233 = OpFOrdGreaterThanEqual %bool %231 %float_1
+               OpSelectionMerge %234 None
+               OpBranchConditional %233 %235 %234
+        %235 = OpLabel
+        %236 = OpAccessChain %_ptr_Function_float %c %224
+        %237 = OpLoad %float %236
+        %238 = OpAccessChain %_ptr_Function_float %c %224
+        %239 = OpLoad %float %238
+        %240 = OpAccessChain %_ptr_Function_float %c %224
+        %241 = OpFMul %float %237 %239
+               OpStore %240 %241
+               OpBranch %234
+        %234 = OpLabel
+               OpBranch %221
+        %221 = OpLabel
+        %242 = OpIAdd %int %224 %int_1
+               OpStore %x_130 %242
+        %243 = OpLoad %int %x_130
+               OpStore %x_129_phi %243
+               OpBranch %219
+        %220 = OpLabel
+        %244 = OpLoad %v3float %c
+        %246 = OpExtInst %v3float %56 FAbs %244
+        %245 = OpExtInst %v3float %56 Normalize %246
+        %247 = OpCompositeExtract %float %245 0
+        %248 = OpCompositeExtract %float %245 1
+        %249 = OpCompositeExtract %float %245 2
+        %250 = OpCompositeConstruct %v4float %247 %248 %249 %float_1
+               OpStore %x_GLF_color %250
                OpReturn
                OpFunctionEnd
-%tint_symbol_3 = OpFunction %void None %241
+%tint_symbol_3 = OpFunction %void None %251
 %tint_symbol_1 = OpFunctionParameter %main_out
-        %245 = OpLabel
-        %246 = OpCompositeExtract %v4float %tint_symbol_1 0
-               OpStore %tint_symbol_2 %246
+        %255 = OpLabel
+        %256 = OpCompositeExtract %v4float %tint_symbol_1 0
+               OpStore %tint_symbol_2 %256
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %15
-        %248 = OpLabel
-        %249 = OpLoad %v4float %tint_symbol
-               OpStore %gl_FragCoord %249
-        %250 = OpFunctionCall %void %main_1
-        %252 = OpLoad %v4float %x_GLF_color
-        %253 = OpCompositeConstruct %main_out %252
-        %251 = OpFunctionCall %void %tint_symbol_3 %253
+        %258 = OpLabel
+        %259 = OpLoad %v4float %tint_symbol
+               OpStore %gl_FragCoord %259
+        %260 = OpFunctionCall %void %main_1
+        %262 = OpLoad %v4float %x_GLF_color
+        %263 = OpCompositeConstruct %main_out %262
+        %261 = OpFunctionCall %void %tint_symbol_3 %263
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.wgsl
index 41e57f4..76331ce 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.wgsl
@@ -55,7 +55,7 @@
           x_56_phi = x_68;
         } else {
           x_76_phi = x_55;
-          if (((f32(x_58) % round(x_49)) <= 0.01)) {
+          if (((f32(x_58) - (round(x_49) * floor((f32(x_58) / round(x_49))))) <= 0.01)) {
             x_75 = (x_55 + 100.0);
             x_76_phi = x_75;
           }
@@ -123,7 +123,7 @@
           x_93_phi = x_105;
         } else {
           x_113_phi = x_92;
-          if (((f32(x_95) % round(x_49)) <= 0.01)) {
+          if (((f32(x_95) - (round(x_49) * floor((f32(x_95) / round(x_49))))) <= 0.01)) {
             x_112 = (x_92 + 100.0);
             x_113_phi = x_112;
           }
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.msl
index a68104d..ccd7c33 100755
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -59,7 +57,7 @@
           x_56_phi = x_68;
         } else {
           x_76_phi = x_55;
-          if (((float(x_58) % rint(x_49)) <= 0.01f)) {
+          if ((fmod(float(x_58), rint(x_49)) <= 0.01f)) {
             x_75 = (x_55 + 100.0f);
             x_76_phi = x_75;
           }
@@ -126,7 +124,7 @@
           x_93_phi = x_105;
         } else {
           x_113_phi = x_92;
-          if (((float(x_95) % rint(x_49)) <= 0.01f)) {
+          if ((fmod(float(x_95), rint(x_49)) <= 0.01f)) {
             x_112 = (x_92 + 100.0f);
             x_113_phi = x_112;
           }
@@ -198,11 +196,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\u938.0.metal:60:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_58) % rint(x_49)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-T:\tmp\u938.0.metal:127:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_95) % rint(x_49)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-2 errors generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.spvasm
index fdd3fe1..777603d 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.spvasm
@@ -207,7 +207,7 @@
                OpStore %x_76_phi %97
          %98 = OpConvertSToF %float %75
          %99 = OpExtInst %float %56 RoundEven %55
-        %100 = OpFMod %float %98 %99
+        %100 = OpFRem %float %98 %99
         %102 = OpFOrdLessThanEqual %bool %100 %float_0_00999999978
                OpSelectionMerge %103 None
                OpBranchConditional %102 %104 %103
@@ -313,7 +313,7 @@
                OpStore %x_113_phi %170
         %171 = OpConvertSToF %float %154
         %172 = OpExtInst %float %56 RoundEven %55
-        %173 = OpFMod %float %171 %172
+        %173 = OpFRem %float %171 %172
         %174 = OpFOrdLessThanEqual %bool %173 %float_0_00999999978
                OpSelectionMerge %175 None
                OpBranchConditional %174 %176 %175
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.hlsl
index f5c9fb0..c78548a 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.hlsl
@@ -56,7 +56,7 @@
           x_58_phi = x_70;
         } else {
           x_78_phi = x_57;
-          if (((float(x_60) % round(x_50)) <= 0.01f)) {
+          if (((float(x_60) - (round(x_50) * floor((float(x_60) / round(x_50))))) <= 0.01f)) {
             x_77 = (x_57 + 100.0f);
             x_78_phi = x_77;
           }
@@ -126,7 +126,7 @@
           x_99_phi = x_111;
         } else {
           x_119_phi = x_98;
-          if (((float(x_101) % round(x_50)) <= 0.01f)) {
+          if (((float(x_101) - (round(x_50) * floor((float(x_101) / round(x_50))))) <= 0.01f)) {
             x_118 = (x_98 + 100.0f);
             x_119_phi = x_118;
           }
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.msl
index 1a98de4..3a92f08 100755
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -61,7 +59,7 @@
           x_58_phi = x_70;
         } else {
           x_78_phi = x_57;
-          if (((float(x_60) % rint(x_50)) <= 0.01f)) {
+          if (((float(x_60) - (rint(x_50) * floor((float(x_60) / rint(x_50))))) <= 0.01f)) {
             x_77 = (x_57 + 100.0f);
             x_78_phi = x_77;
           }
@@ -131,7 +129,7 @@
           x_99_phi = x_111;
         } else {
           x_119_phi = x_98;
-          if (((float(x_101) % rint(x_50)) <= 0.01f)) {
+          if (((float(x_101) - (rint(x_50) * floor((float(x_101) / rint(x_50))))) <= 0.01f)) {
             x_118 = (x_98 + 100.0f);
             x_119_phi = x_118;
           }
@@ -203,11 +201,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\ufm8.0.metal:62:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_60) % rint(x_50)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-T:\tmp\ufm8.0.metal:132:30: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_101) % rint(x_50)) <= 0.01f)) {
-                ~~~~~~~~~~~~ ^ ~~~~~~~~~~
-2 errors generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.spvasm
index 59c0cdb..e2f80ed 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 267
+; Bound: 277
 ; Schema: 0
                OpCapability Shader
          %58 = OpExtInstImport "GLSL.std.450"
@@ -119,7 +119,7 @@
      %uint_2 = OpConstant %uint 2
       %int_3 = OpConstant %int 3
    %main_out = OpTypeStruct %v4float
-        %254 = OpTypeFunction %void %main_out
+        %264 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %15
          %18 = OpLabel
           %c = OpVariable %_ptr_Function_v3float Function %22
@@ -209,254 +209,264 @@
                OpStore %x_78_phi %100
         %101 = OpConvertSToF %float %79
         %102 = OpExtInst %float %58 RoundEven %57
-        %103 = OpFMod %float %101 %102
-        %105 = OpFOrdLessThanEqual %bool %103 %float_0_00999999978
-               OpSelectionMerge %106 None
-               OpBranchConditional %105 %107 %106
-        %107 = OpLabel
-        %108 = OpLoad %float %x_57
-        %110 = OpFAdd %float %108 %float_100
-               OpStore %x_77 %110
-        %111 = OpLoad %float %x_77
-               OpStore %x_78_phi %111
-               OpBranch %106
-        %106 = OpLabel
-        %112 = OpLoad %float %x_78_phi
-               OpStore %x_78 %112
-        %113 = OpLoad %float %x_78
-               OpStore %x_58_phi %113
+        %104 = OpConvertSToF %float %79
+        %105 = OpExtInst %float %58 RoundEven %57
+        %106 = OpFDiv %float %104 %105
+        %103 = OpExtInst %float %58 Floor %106
+        %107 = OpFMul %float %102 %103
+        %108 = OpFSub %float %101 %107
+        %110 = OpFOrdLessThanEqual %bool %108 %float_0_00999999978
+               OpSelectionMerge %111 None
+               OpBranchConditional %110 %112 %111
+        %112 = OpLabel
+        %113 = OpLoad %float %x_57
+        %115 = OpFAdd %float %113 %float_100
+               OpStore %x_77 %115
+        %116 = OpLoad %float %x_77
+               OpStore %x_78_phi %116
+               OpBranch %111
+        %111 = OpLabel
+        %117 = OpLoad %float %x_78_phi
+               OpStore %x_78 %117
+        %118 = OpLoad %float %x_78
+               OpStore %x_58_phi %118
                OpBranch %93
          %93 = OpLabel
-        %114 = OpLoad %float %x_58_phi
-               OpStore %x_58 %114
-        %115 = OpConvertSToF %float %79
-        %116 = OpLoad %float %x_53
-        %117 = OpFOrdGreaterThanEqual %bool %115 %116
-               OpSelectionMerge %118 None
-               OpBranchConditional %117 %119 %118
-        %119 = OpLabel
-        %120 = OpLoad %float %x_58
-               OpStore %x_83_phi %120
-        %121 = OpLoad %float %x_58
-               OpStore %x_84_phi %121
+        %119 = OpLoad %float %x_58_phi
+               OpStore %x_58 %119
+        %120 = OpConvertSToF %float %79
+        %121 = OpLoad %float %x_53
+        %122 = OpFOrdGreaterThanEqual %bool %120 %121
+               OpSelectionMerge %123 None
+               OpBranchConditional %122 %124 %123
+        %124 = OpLabel
+        %125 = OpLoad %float %x_58
+               OpStore %x_83_phi %125
+        %126 = OpLoad %float %x_58
+               OpStore %x_84_phi %126
                OpStore %x_85_phi %true
                OpBranch %71
-        %118 = OpLabel
+        %123 = OpLabel
                OpBranch %72
          %72 = OpLabel
-        %123 = OpIAdd %int %79 %int_1
-               OpStore %x_61 %123
-        %124 = OpLoad %float %x_58
-               OpStore %x_57_phi %124
-        %125 = OpLoad %int %x_61
-               OpStore %x_60_phi %125
+        %128 = OpIAdd %int %79 %int_1
+               OpStore %x_61 %128
+        %129 = OpLoad %float %x_58
+               OpStore %x_57_phi %129
+        %130 = OpLoad %int %x_61
+               OpStore %x_60_phi %130
                OpBranch %70
          %71 = OpLabel
-        %126 = OpLoad %float %x_83_phi
-               OpStore %x_83 %126
-        %127 = OpLoad %float %x_84_phi
-               OpStore %x_84 %127
-        %128 = OpLoad %bool %x_85_phi
-        %129 = OpLoad %float %x_83
-               OpStore %x_87_phi %129
-               OpSelectionMerge %130 None
-               OpBranchConditional %128 %131 %130
-        %131 = OpLabel
+        %131 = OpLoad %float %x_83_phi
+               OpStore %x_83 %131
+        %132 = OpLoad %float %x_84_phi
+               OpStore %x_84 %132
+        %133 = OpLoad %bool %x_85_phi
+        %134 = OpLoad %float %x_83
+               OpStore %x_87_phi %134
+               OpSelectionMerge %135 None
+               OpBranchConditional %133 %136 %135
+        %136 = OpLabel
                OpBranch %67
-        %130 = OpLabel
-        %132 = OpLoad %float %x_84
-               OpStore %x_87_phi %132
+        %135 = OpLabel
+        %137 = OpLoad %float %x_84
+               OpStore %x_87_phi %137
                OpBranch %67
          %67 = OpLabel
-        %141 = OpLoad %float %x_87_phi
-        %142 = OpLoad %float %x_84
-        %143 = OpLoad %float %x_83
-        %144 = OpCompositeConstruct %v4float %142 %float_0_400000006 %143 %float_0_400000006
-        %145 = OpAccessChain %_ptr_Function_float %c %uint_0
-               OpStore %145 %141
-        %147 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %148 = OpLoad %float %147
-               OpStore %x_92 %148
-               OpSelectionMerge %149 None
-               OpSwitch %uint_0 %150
-        %150 = OpLabel
-        %151 = OpCompositeExtract %float %63 0
-        %152 = OpCompositeExtract %float %63 1
-        %153 = OpLoad %float %x_57
-        %154 = OpCompositeConstruct %v4float %151 %152 %float_0 %153
-        %155 = OpCompositeExtract %float %56 0
-        %156 = OpCompositeExtract %float %56 1
-        %157 = OpCompositeConstruct %v3float %155 %156 %float_n0_5
-        %158 = OpCompositeExtract %float %157 2
-               OpStore %x_98_phi %158
+        %146 = OpLoad %float %x_87_phi
+        %147 = OpLoad %float %x_84
+        %148 = OpLoad %float %x_83
+        %149 = OpCompositeConstruct %v4float %147 %float_0_400000006 %148 %float_0_400000006
+        %150 = OpAccessChain %_ptr_Function_float %c %uint_0
+               OpStore %150 %146
+        %152 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %153 = OpLoad %float %152
+               OpStore %x_92 %153
+               OpSelectionMerge %154 None
+               OpSwitch %uint_0 %155
+        %155 = OpLabel
+        %156 = OpCompositeExtract %float %63 0
+        %157 = OpCompositeExtract %float %63 1
+        %158 = OpLoad %float %x_57
+        %159 = OpCompositeConstruct %v4float %156 %157 %float_0 %158
+        %160 = OpCompositeExtract %float %56 0
+        %161 = OpCompositeExtract %float %56 1
+        %162 = OpCompositeConstruct %v3float %160 %161 %float_n0_5
+        %163 = OpCompositeExtract %float %162 2
+               OpStore %x_98_phi %163
                OpStore %x_101_phi %int_1
-               OpBranch %159
-        %159 = OpLabel
-               OpLoopMerge %160 %161 None
-               OpBranch %162
-        %162 = OpLabel
-        %167 = OpLoad %float %x_98_phi
-               OpStore %x_98 %167
-        %168 = OpLoad %int %x_101_phi
+               OpBranch %164
+        %164 = OpLabel
+               OpLoopMerge %165 %166 None
+               OpBranch %167
+        %167 = OpLabel
+        %172 = OpLoad %float %x_98_phi
+               OpStore %x_98 %172
+        %173 = OpLoad %int %x_101_phi
                OpStore %x_124_phi %float_0
-        %169 = OpLoad %float %x_98
-               OpStore %x_125_phi %169
+        %174 = OpLoad %float %x_98
+               OpStore %x_125_phi %174
                OpStore %x_126_phi %false
-        %170 = OpSLessThan %bool %168 %int_800
-               OpSelectionMerge %171 None
-               OpBranchConditional %170 %172 %173
-        %172 = OpLabel
-               OpBranch %171
-        %173 = OpLabel
-               OpBranch %160
-        %171 = OpLabel
-        %176 = OpSMod %int %168 %int_32
-        %177 = OpIEqual %bool %176 %int_0
-               OpSelectionMerge %178 None
-               OpBranchConditional %177 %179 %180
-        %179 = OpLabel
-        %181 = OpLoad %float %x_98
-        %182 = OpFAdd %float %181 %float_0_400000006
-               OpStore %x_111 %182
-        %183 = OpLoad %float %x_111
-               OpStore %x_99_phi %183
-               OpBranch %178
-        %180 = OpLabel
-        %184 = OpLoad %float %x_98
-               OpStore %x_119_phi %184
-        %185 = OpConvertSToF %float %168
-        %186 = OpExtInst %float %58 RoundEven %57
-        %187 = OpFMod %float %185 %186
-        %188 = OpFOrdLessThanEqual %bool %187 %float_0_00999999978
-               OpSelectionMerge %189 None
-               OpBranchConditional %188 %190 %189
-        %190 = OpLabel
-        %191 = OpLoad %float %x_98
-        %192 = OpFAdd %float %191 %float_100
-               OpStore %x_118 %192
-        %193 = OpLoad %float %x_118
-               OpStore %x_119_phi %193
-               OpBranch %189
-        %189 = OpLabel
-        %194 = OpLoad %float %x_119_phi
-               OpStore %x_119 %194
-        %195 = OpLoad %float %x_119
-               OpStore %x_99_phi %195
-               OpBranch %178
+        %175 = OpSLessThan %bool %173 %int_800
+               OpSelectionMerge %176 None
+               OpBranchConditional %175 %177 %178
+        %177 = OpLabel
+               OpBranch %176
         %178 = OpLabel
-        %196 = OpLoad %float %x_99_phi
-               OpStore %x_99 %196
-        %197 = OpConvertSToF %float %168
-        %198 = OpLoad %float %x_92
-        %199 = OpFOrdGreaterThanEqual %bool %197 %198
-               OpSelectionMerge %200 None
-               OpBranchConditional %199 %201 %200
-        %201 = OpLabel
-        %202 = OpLoad %float %x_99
-               OpStore %x_124_phi %202
-        %203 = OpLoad %float %x_99
-               OpStore %x_125_phi %203
-               OpStore %x_126_phi %true
-               OpBranch %160
+               OpBranch %165
+        %176 = OpLabel
+        %181 = OpSMod %int %173 %int_32
+        %182 = OpIEqual %bool %181 %int_0
+               OpSelectionMerge %183 None
+               OpBranchConditional %182 %184 %185
+        %184 = OpLabel
+        %186 = OpLoad %float %x_98
+        %187 = OpFAdd %float %186 %float_0_400000006
+               OpStore %x_111 %187
+        %188 = OpLoad %float %x_111
+               OpStore %x_99_phi %188
+               OpBranch %183
+        %185 = OpLabel
+        %189 = OpLoad %float %x_98
+               OpStore %x_119_phi %189
+        %190 = OpConvertSToF %float %173
+        %191 = OpExtInst %float %58 RoundEven %57
+        %193 = OpConvertSToF %float %173
+        %194 = OpExtInst %float %58 RoundEven %57
+        %195 = OpFDiv %float %193 %194
+        %192 = OpExtInst %float %58 Floor %195
+        %196 = OpFMul %float %191 %192
+        %197 = OpFSub %float %190 %196
+        %198 = OpFOrdLessThanEqual %bool %197 %float_0_00999999978
+               OpSelectionMerge %199 None
+               OpBranchConditional %198 %200 %199
         %200 = OpLabel
-               OpBranch %161
-        %161 = OpLabel
-        %204 = OpIAdd %int %168 %int_1
-               OpStore %x_102 %204
-        %205 = OpLoad %float %x_99
-               OpStore %x_98_phi %205
-        %206 = OpLoad %int %x_102
-               OpStore %x_101_phi %206
-               OpBranch %159
-        %160 = OpLabel
-        %207 = OpLoad %float %x_124_phi
-               OpStore %x_124 %207
-        %208 = OpLoad %float %x_125_phi
-               OpStore %x_125 %208
-        %209 = OpLoad %bool %x_126_phi
-        %210 = OpLoad %float %x_124
-               OpStore %x_128_phi %210
-               OpSelectionMerge %211 None
-               OpBranchConditional %209 %212 %211
-        %212 = OpLabel
-               OpBranch %149
+        %201 = OpLoad %float %x_98
+        %202 = OpFAdd %float %201 %float_100
+               OpStore %x_118 %202
+        %203 = OpLoad %float %x_118
+               OpStore %x_119_phi %203
+               OpBranch %199
+        %199 = OpLabel
+        %204 = OpLoad %float %x_119_phi
+               OpStore %x_119 %204
+        %205 = OpLoad %float %x_119
+               OpStore %x_99_phi %205
+               OpBranch %183
+        %183 = OpLabel
+        %206 = OpLoad %float %x_99_phi
+               OpStore %x_99 %206
+        %207 = OpConvertSToF %float %173
+        %208 = OpLoad %float %x_92
+        %209 = OpFOrdGreaterThanEqual %bool %207 %208
+               OpSelectionMerge %210 None
+               OpBranchConditional %209 %211 %210
         %211 = OpLabel
-        %213 = OpLoad %float %x_125
-               OpStore %x_128_phi %213
-               OpBranch %149
-        %149 = OpLabel
-        %214 = OpLoad %float %x_128_phi
-        %215 = OpAccessChain %_ptr_Function_float %c %uint_1
-               OpStore %215 %214
-        %216 = OpAccessChain %_ptr_Function_float %c %uint_0
-        %217 = OpLoad %float %216
-        %218 = OpAccessChain %_ptr_Function_float %c %uint_1
-        %219 = OpLoad %float %218
-        %221 = OpAccessChain %_ptr_Function_float %c %uint_2
-        %222 = OpFAdd %float %217 %219
-               OpStore %221 %222
+        %212 = OpLoad %float %x_99
+               OpStore %x_124_phi %212
+        %213 = OpLoad %float %x_99
+               OpStore %x_125_phi %213
+               OpStore %x_126_phi %true
+               OpBranch %165
+        %210 = OpLabel
+               OpBranch %166
+        %166 = OpLabel
+        %214 = OpIAdd %int %173 %int_1
+               OpStore %x_102 %214
+        %215 = OpLoad %float %x_99
+               OpStore %x_98_phi %215
+        %216 = OpLoad %int %x_102
+               OpStore %x_101_phi %216
+               OpBranch %164
+        %165 = OpLabel
+        %217 = OpLoad %float %x_124_phi
+               OpStore %x_124 %217
+        %218 = OpLoad %float %x_125_phi
+               OpStore %x_125 %218
+        %219 = OpLoad %bool %x_126_phi
+        %220 = OpLoad %float %x_124
+               OpStore %x_128_phi %220
+               OpSelectionMerge %221 None
+               OpBranchConditional %219 %222 %221
+        %222 = OpLabel
+               OpBranch %154
+        %221 = OpLabel
+        %223 = OpLoad %float %x_125
+               OpStore %x_128_phi %223
+               OpBranch %154
+        %154 = OpLabel
+        %224 = OpLoad %float %x_128_phi
+        %225 = OpAccessChain %_ptr_Function_float %c %uint_1
+               OpStore %225 %224
+        %226 = OpAccessChain %_ptr_Function_float %c %uint_0
+        %227 = OpLoad %float %226
+        %228 = OpAccessChain %_ptr_Function_float %c %uint_1
+        %229 = OpLoad %float %228
+        %231 = OpAccessChain %_ptr_Function_float %c %uint_2
+        %232 = OpFAdd %float %227 %229
+               OpStore %231 %232
                OpStore %x_135_phi %int_0
-               OpBranch %223
-        %223 = OpLabel
-               OpLoopMerge %224 %225 None
-               OpBranch %226
-        %226 = OpLabel
-        %228 = OpLoad %int %x_135_phi
-        %230 = OpSLessThan %bool %228 %int_3
-               OpSelectionMerge %231 None
-               OpBranchConditional %230 %232 %233
-        %232 = OpLabel
-               OpBranch %231
+               OpBranch %233
         %233 = OpLabel
-               OpBranch %224
-        %231 = OpLabel
-        %234 = OpAccessChain %_ptr_Function_float %c %228
-        %235 = OpLoad %float %234
-        %236 = OpFOrdGreaterThanEqual %bool %235 %float_1
-               OpSelectionMerge %237 None
-               OpBranchConditional %236 %238 %237
-        %238 = OpLabel
-        %239 = OpAccessChain %_ptr_Function_float %c %228
-        %240 = OpLoad %float %239
-        %241 = OpAccessChain %_ptr_Function_float %c %228
-        %242 = OpLoad %float %241
-        %243 = OpAccessChain %_ptr_Function_float %c %228
-        %244 = OpFMul %float %240 %242
-               OpStore %243 %244
-               OpBranch %237
-        %237 = OpLabel
-               OpBranch %225
-        %225 = OpLabel
-        %245 = OpIAdd %int %228 %int_1
-               OpStore %x_136 %245
-        %246 = OpLoad %int %x_136
-               OpStore %x_135_phi %246
-               OpBranch %223
-        %224 = OpLabel
-        %247 = OpLoad %v3float %c
-        %249 = OpExtInst %v3float %58 FAbs %247
-        %248 = OpExtInst %v3float %58 Normalize %249
-        %250 = OpCompositeExtract %float %248 0
-        %251 = OpCompositeExtract %float %248 1
-        %252 = OpCompositeExtract %float %248 2
-        %253 = OpCompositeConstruct %v4float %250 %251 %252 %float_1
-               OpStore %x_GLF_color %253
+               OpLoopMerge %234 %235 None
+               OpBranch %236
+        %236 = OpLabel
+        %238 = OpLoad %int %x_135_phi
+        %240 = OpSLessThan %bool %238 %int_3
+               OpSelectionMerge %241 None
+               OpBranchConditional %240 %242 %243
+        %242 = OpLabel
+               OpBranch %241
+        %243 = OpLabel
+               OpBranch %234
+        %241 = OpLabel
+        %244 = OpAccessChain %_ptr_Function_float %c %238
+        %245 = OpLoad %float %244
+        %246 = OpFOrdGreaterThanEqual %bool %245 %float_1
+               OpSelectionMerge %247 None
+               OpBranchConditional %246 %248 %247
+        %248 = OpLabel
+        %249 = OpAccessChain %_ptr_Function_float %c %238
+        %250 = OpLoad %float %249
+        %251 = OpAccessChain %_ptr_Function_float %c %238
+        %252 = OpLoad %float %251
+        %253 = OpAccessChain %_ptr_Function_float %c %238
+        %254 = OpFMul %float %250 %252
+               OpStore %253 %254
+               OpBranch %247
+        %247 = OpLabel
+               OpBranch %235
+        %235 = OpLabel
+        %255 = OpIAdd %int %238 %int_1
+               OpStore %x_136 %255
+        %256 = OpLoad %int %x_136
+               OpStore %x_135_phi %256
+               OpBranch %233
+        %234 = OpLabel
+        %257 = OpLoad %v3float %c
+        %259 = OpExtInst %v3float %58 FAbs %257
+        %258 = OpExtInst %v3float %58 Normalize %259
+        %260 = OpCompositeExtract %float %258 0
+        %261 = OpCompositeExtract %float %258 1
+        %262 = OpCompositeExtract %float %258 2
+        %263 = OpCompositeConstruct %v4float %260 %261 %262 %float_1
+               OpStore %x_GLF_color %263
                OpReturn
                OpFunctionEnd
-%tint_symbol_3 = OpFunction %void None %254
+%tint_symbol_3 = OpFunction %void None %264
 %tint_symbol_1 = OpFunctionParameter %main_out
-        %258 = OpLabel
-        %259 = OpCompositeExtract %v4float %tint_symbol_1 0
-               OpStore %tint_symbol_2 %259
+        %268 = OpLabel
+        %269 = OpCompositeExtract %v4float %tint_symbol_1 0
+               OpStore %tint_symbol_2 %269
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %15
-        %261 = OpLabel
-        %262 = OpLoad %v4float %tint_symbol
-               OpStore %gl_FragCoord %262
-        %263 = OpFunctionCall %void %main_1
-        %265 = OpLoad %v4float %x_GLF_color
-        %266 = OpCompositeConstruct %main_out %265
-        %264 = OpFunctionCall %void %tint_symbol_3 %266
+        %271 = OpLabel
+        %272 = OpLoad %v4float %tint_symbol
+               OpStore %gl_FragCoord %272
+        %273 = OpFunctionCall %void %main_1
+        %275 = OpLoad %v4float %x_GLF_color
+        %276 = OpCompositeConstruct %main_out %275
+        %274 = OpFunctionCall %void %tint_symbol_3 %276
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.wgsl
index c2ad2e8..e1db4ce 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.wgsl
@@ -57,7 +57,7 @@
           x_58_phi = x_70;
         } else {
           x_78_phi = x_57;
-          if (((f32(x_60) % round(x_50)) <= 0.01)) {
+          if (((f32(x_60) - (round(x_50) * floor((f32(x_60) / round(x_50))))) <= 0.01)) {
             x_77 = (x_57 + 100.0);
             x_78_phi = x_77;
           }
@@ -128,7 +128,7 @@
           x_99_phi = x_111;
         } else {
           x_119_phi = x_98;
-          if (((f32(x_101) % round(x_50)) <= 0.01)) {
+          if (((f32(x_101) - (round(x_50) * floor((f32(x_101) / round(x_50))))) <= 0.01)) {
             x_118 = (x_98 + 100.0);
             x_119_phi = x_118;
           }
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.msl
index 4bdc690..05e2aaa 100755
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -61,7 +59,7 @@
           x_58_phi = x_70;
         } else {
           x_78_phi = x_57;
-          if (((float(x_60) % rint(x_50)) <= 0.01f)) {
+          if ((fmod(float(x_60), rint(x_50)) <= 0.01f)) {
             x_77 = (x_57 + 100.0f);
             x_78_phi = x_77;
           }
@@ -131,7 +129,7 @@
           x_99_phi = x_111;
         } else {
           x_119_phi = x_98;
-          if (((float(x_101) % rint(x_50)) <= 0.01f)) {
+          if ((fmod(float(x_101), rint(x_50)) <= 0.01f)) {
             x_118 = (x_98 + 100.0f);
             x_119_phi = x_118;
           }
@@ -203,11 +201,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\u9vw.0.metal:62:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_60) % rint(x_50)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-T:\tmp\u9vw.0.metal:132:30: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_101) % rint(x_50)) <= 0.01f)) {
-                ~~~~~~~~~~~~ ^ ~~~~~~~~~~
-2 errors generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.spvasm
index 59c0cdb..4f6810f 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.spvasm
@@ -209,7 +209,7 @@
                OpStore %x_78_phi %100
         %101 = OpConvertSToF %float %79
         %102 = OpExtInst %float %58 RoundEven %57
-        %103 = OpFMod %float %101 %102
+        %103 = OpFRem %float %101 %102
         %105 = OpFOrdLessThanEqual %bool %103 %float_0_00999999978
                OpSelectionMerge %106 None
                OpBranchConditional %105 %107 %106
@@ -326,7 +326,7 @@
                OpStore %x_119_phi %184
         %185 = OpConvertSToF %float %168
         %186 = OpExtInst %float %58 RoundEven %57
-        %187 = OpFMod %float %185 %186
+        %187 = OpFRem %float %185 %186
         %188 = OpFOrdLessThanEqual %bool %187 %float_0_00999999978
                OpSelectionMerge %189 None
                OpBranchConditional %188 %190 %189
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.hlsl
index 6f779cc..0e4020b 100755
--- a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.hlsl
@@ -1,10 +1,107 @@
-SKIP: FAILED
+struct buf0 {
+  float2 resolution;
+};
 
-..\..\src\writer\hlsl\generator_impl.cc:3099 internal compiler error: unhandled struct member attribute: offset
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
 
+void main_1() {
+  int x_195[256] = (int[256])0;
+  int x_196[256] = (int[256])0;
+  int x_197[256] = (int[256])0;
+  float2 x_208 = float2(0.0f, 0.0f);
+  int2 x_214 = int2(0, 0);
+  float4 x_249 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  float4 x_251 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  int2 x_218_phi = int2(0, 0);
+  float4 x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  bool x_252_phi = false;
+  float4 x_254_phi = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  const float4 x_198 = gl_FragCoord;
+  const float2 x_201 = asfloat(x_6[0].xy);
+  const float2 x_202 = (float2(x_198.x, x_198.y) / x_201);
+  const int x_204 = -(82);
+  x_208 = float2(0.0f, float4(x_201, 15.0f, 15.0f).z);
+  const int x_209 = (120 - 0);
+  x_214 = int2(int((x_202.x * 256.0f)), int((x_202.y * 256.0f)));
+  switch(0u) {
+    default: {
+      x_218_phi = x_214;
+      while (true) {
+        bool x_235 = false;
+        bool x_236_phi = false;
+        const int2 x_218 = x_218_phi;
+        const int x_221 = x_218.y;
+        x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f);
+        x_252_phi = false;
+        if ((x_221 != 256)) {
+        } else {
+          break;
+        }
+        const int x_225 = x_218.x;
+        const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94};
+        x_195 = tint_symbol_5;
+        const int x_227 = x_195[x_221];
+        const bool x_229 = (x_225 < (x_227 + 15));
+        x_236_phi = x_229;
+        if (x_229) {
+          const int tint_symbol_6[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94};
+          x_196 = tint_symbol_6;
+          const int x_233 = x_196[x_221];
+          x_235 = (x_225 > (x_233 - 15));
+          x_236_phi = x_235;
+        }
+        if (x_236_phi) {
+          const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94};
+          x_197 = tint_symbol_7;
+          const int x_240 = x_197[x_221];
+          const int x_244 = (91 + 244);
+          const buf0 tint_symbol_8 = {x_208};
+          const float x_248 = ((tint_symbol_8.resolution.y - abs(float((x_225 - x_240)))) * 0.06666667f);
+          x_249 = float4(x_248, x_248, x_248, 1.0f);
+          x_251_phi = x_249;
+          x_252_phi = true;
+          break;
+        }
+        int2 x_219_1 = x_218;
+        x_219_1.y = (x_221 + 1);
+        const int2 x_219 = x_219_1;
+        {
+          x_218_phi = x_219;
+        }
+      }
+      x_251 = x_251_phi;
+      const bool x_252 = x_252_phi;
+      x_254_phi = x_251;
+      if (x_252) {
+        break;
+      }
+      x_254_phi = float4(0.0f, 0.0f, 0.0f, 1.0f);
+      break;
+    }
+  }
+  x_GLF_color = x_254_phi;
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_3 = {x_GLF_color};
+  const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1};
+  return tint_symbol_9;
+}
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.hlsl
index 3102fad..0b4750a 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.hlsl
@@ -54,7 +54,7 @@
           x_56_phi = x_68;
         } else {
           x_76_phi = x_55;
-          if (((float(x_58) % round(x_49)) <= 0.01f)) {
+          if (((float(x_58) - (round(x_49) * floor((float(x_58) / round(x_49))))) <= 0.01f)) {
             x_75 = (x_55 + 100.0f);
             x_76_phi = x_75;
           }
@@ -121,7 +121,7 @@
           x_93_phi = x_113;
         } else {
           x_112_phi = x_92;
-          if (((float(x_95) % round(x_49)) <= 0.01f)) {
+          if (((float(x_95) - (round(x_49) * floor((float(x_95) / round(x_49))))) <= 0.01f)) {
             x_111 = (x_92 + 100.0f);
             x_112_phi = x_111;
           }
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.msl
index ccf66a6..6bbc2e7 100755
--- a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -59,7 +57,7 @@
           x_56_phi = x_68;
         } else {
           x_76_phi = x_55;
-          if (((float(x_58) % rint(x_49)) <= 0.01f)) {
+          if (((float(x_58) - (rint(x_49) * floor((float(x_58) / rint(x_49))))) <= 0.01f)) {
             x_75 = (x_55 + 100.0f);
             x_76_phi = x_75;
           }
@@ -126,7 +124,7 @@
           x_93_phi = x_113;
         } else {
           x_112_phi = x_92;
-          if (((float(x_95) % rint(x_49)) <= 0.01f)) {
+          if (((float(x_95) - (rint(x_49) * floor((float(x_95) / rint(x_49))))) <= 0.01f)) {
             x_111 = (x_92 + 100.0f);
             x_112_phi = x_111;
           }
@@ -198,11 +196,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\u3lk.0.metal:60:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_58) % rint(x_49)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-T:\tmp\u3lk.0.metal:127:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_95) % rint(x_49)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-2 errors generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.spvasm
index d596d85..2af7e74 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 254
+; Bound: 264
 ; Schema: 0
                OpCapability Shader
          %56 = OpExtInstImport "GLSL.std.450"
@@ -118,7 +118,7 @@
       %int_3 = OpConstant %int 3
     %float_1 = OpConstant %float 1
    %main_out = OpTypeStruct %v4float
-        %241 = OpTypeFunction %void %main_out
+        %251 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %15
          %18 = OpLabel
           %c = OpVariable %_ptr_Function_v3float Function %22
@@ -207,243 +207,253 @@
                OpStore %x_76_phi %97
          %98 = OpConvertSToF %float %75
          %99 = OpExtInst %float %56 RoundEven %55
-        %100 = OpFMod %float %98 %99
-        %102 = OpFOrdLessThanEqual %bool %100 %float_0_00999999978
-               OpSelectionMerge %103 None
-               OpBranchConditional %102 %104 %103
-        %104 = OpLabel
-        %105 = OpLoad %float %x_55
-        %107 = OpFAdd %float %105 %float_100
-               OpStore %x_75 %107
-        %108 = OpLoad %float %x_75
-               OpStore %x_76_phi %108
-               OpBranch %103
-        %103 = OpLabel
-        %109 = OpLoad %float %x_76_phi
-               OpStore %x_76 %109
-        %110 = OpLoad %float %x_76
-               OpStore %x_56_phi %110
+        %101 = OpConvertSToF %float %75
+        %102 = OpExtInst %float %56 RoundEven %55
+        %103 = OpFDiv %float %101 %102
+        %100 = OpExtInst %float %56 Floor %103
+        %104 = OpFMul %float %99 %100
+        %105 = OpFSub %float %98 %104
+        %107 = OpFOrdLessThanEqual %bool %105 %float_0_00999999978
+               OpSelectionMerge %108 None
+               OpBranchConditional %107 %109 %108
+        %109 = OpLabel
+        %110 = OpLoad %float %x_55
+        %112 = OpFAdd %float %110 %float_100
+               OpStore %x_75 %112
+        %113 = OpLoad %float %x_75
+               OpStore %x_76_phi %113
+               OpBranch %108
+        %108 = OpLabel
+        %114 = OpLoad %float %x_76_phi
+               OpStore %x_76 %114
+        %115 = OpLoad %float %x_76
+               OpStore %x_56_phi %115
                OpBranch %90
          %90 = OpLabel
-        %111 = OpLoad %float %x_56_phi
-               OpStore %x_56 %111
-        %112 = OpConvertSToF %float %75
-        %113 = OpLoad %float %x_51
-        %114 = OpFOrdGreaterThanEqual %bool %112 %113
-               OpSelectionMerge %115 None
-               OpBranchConditional %114 %116 %115
-        %116 = OpLabel
-        %117 = OpLoad %float %x_56
-               OpStore %x_81_phi %117
-        %118 = OpLoad %float %x_56
-               OpStore %x_82_phi %118
+        %116 = OpLoad %float %x_56_phi
+               OpStore %x_56 %116
+        %117 = OpConvertSToF %float %75
+        %118 = OpLoad %float %x_51
+        %119 = OpFOrdGreaterThanEqual %bool %117 %118
+               OpSelectionMerge %120 None
+               OpBranchConditional %119 %121 %120
+        %121 = OpLabel
+        %122 = OpLoad %float %x_56
+               OpStore %x_81_phi %122
+        %123 = OpLoad %float %x_56
+               OpStore %x_82_phi %123
                OpStore %x_83_phi %true
                OpBranch %67
-        %115 = OpLabel
+        %120 = OpLabel
                OpBranch %68
          %68 = OpLabel
-        %120 = OpIAdd %int %75 %int_1
-               OpStore %x_59 %120
-        %121 = OpLoad %float %x_56
-               OpStore %x_55_phi %121
-        %122 = OpLoad %int %x_59
-               OpStore %x_58_phi %122
+        %125 = OpIAdd %int %75 %int_1
+               OpStore %x_59 %125
+        %126 = OpLoad %float %x_56
+               OpStore %x_55_phi %126
+        %127 = OpLoad %int %x_59
+               OpStore %x_58_phi %127
                OpBranch %66
          %67 = OpLabel
-        %123 = OpLoad %float %x_81_phi
-               OpStore %x_81 %123
-        %124 = OpLoad %float %x_82_phi
-               OpStore %x_82 %124
-        %125 = OpLoad %bool %x_83_phi
-        %126 = OpLoad %float %x_81
-               OpStore %x_85_phi %126
-               OpSelectionMerge %127 None
-               OpBranchConditional %125 %128 %127
-        %128 = OpLabel
+        %128 = OpLoad %float %x_81_phi
+               OpStore %x_81 %128
+        %129 = OpLoad %float %x_82_phi
+               OpStore %x_82 %129
+        %130 = OpLoad %bool %x_83_phi
+        %131 = OpLoad %float %x_81
+               OpStore %x_85_phi %131
+               OpSelectionMerge %132 None
+               OpBranchConditional %130 %133 %132
+        %133 = OpLabel
                OpBranch %62
-        %127 = OpLabel
-        %129 = OpLoad %float %x_82
-               OpStore %x_85_phi %129
+        %132 = OpLabel
+        %134 = OpLoad %float %x_82
+               OpStore %x_85_phi %134
                OpBranch %62
          %62 = OpLabel
-        %138 = OpLoad %float %x_85_phi
-        %139 = OpAccessChain %_ptr_Function_float %c %uint_0
-               OpStore %139 %138
-        %141 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %142 = OpLoad %float %141
-               OpStore %x_88 %142
-               OpSelectionMerge %143 None
-               OpSwitch %uint_0 %144
-        %144 = OpLabel
+        %143 = OpLoad %float %x_85_phi
+        %144 = OpAccessChain %_ptr_Function_float %c %uint_0
+               OpStore %144 %143
+        %146 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %147 = OpLoad %float %146
+               OpStore %x_88 %147
+               OpSelectionMerge %148 None
+               OpSwitch %uint_0 %149
+        %149 = OpLabel
                OpStore %x_92_phi %float_n0_5
                OpStore %x_95_phi %int_1
-               OpBranch %145
-        %145 = OpLabel
-               OpLoopMerge %146 %147 None
+               OpBranch %150
+        %150 = OpLabel
+               OpLoopMerge %151 %152 None
+               OpBranch %153
+        %153 = OpLabel
+        %158 = OpLoad %float %x_92_phi
+               OpStore %x_92 %158
+        %159 = OpLoad %int %x_95_phi
+               OpStore %x_118_phi %float_0
+        %160 = OpLoad %float %x_92
+               OpStore %x_119_phi %160
+               OpStore %x_120_phi %false
+        %161 = OpSLessThan %bool %159 %int_800
+               OpSelectionMerge %162 None
+               OpBranchConditional %161 %163 %164
+        %163 = OpLabel
+               OpBranch %162
+        %164 = OpLabel
+               OpBranch %151
+        %162 = OpLabel
+        %167 = OpSMod %int %159 %int_32
+        %168 = OpIEqual %bool %167 %int_0
+               OpSelectionMerge %169 None
+               OpBranchConditional %168 %170 %171
+        %170 = OpLabel
+        %172 = OpLoad %float %x_92
+        %173 = OpFAdd %float %172 %float_0_400000006
+               OpStore %x_113 %173
+        %174 = OpLoad %float %x_113
+               OpStore %x_93_phi %174
+               OpBranch %169
+        %171 = OpLabel
+        %175 = OpLoad %float %x_92
+               OpStore %x_112_phi %175
+        %176 = OpConvertSToF %float %159
+        %177 = OpExtInst %float %56 RoundEven %55
+        %179 = OpConvertSToF %float %159
+        %180 = OpExtInst %float %56 RoundEven %55
+        %181 = OpFDiv %float %179 %180
+        %178 = OpExtInst %float %56 Floor %181
+        %182 = OpFMul %float %177 %178
+        %183 = OpFSub %float %176 %182
+        %184 = OpFOrdLessThanEqual %bool %183 %float_0_00999999978
+               OpSelectionMerge %185 None
+               OpBranchConditional %184 %186 %185
+        %186 = OpLabel
+        %187 = OpLoad %float %x_92
+        %188 = OpFAdd %float %187 %float_100
+               OpStore %x_111 %188
+        %189 = OpLoad %float %x_111
+               OpStore %x_112_phi %189
+               OpBranch %185
+        %185 = OpLabel
+        %190 = OpLoad %float %x_112_phi
+               OpStore %x_112 %190
+        %191 = OpLoad %float %x_112
+               OpStore %x_93_phi %191
+               OpBranch %169
+        %169 = OpLabel
+        %192 = OpLoad %float %x_93_phi
+               OpStore %x_93 %192
+        %193 = OpConvertSToF %float %159
+        %194 = OpLoad %float %x_88
+        %195 = OpFOrdGreaterThanEqual %bool %193 %194
+               OpSelectionMerge %196 None
+               OpBranchConditional %195 %197 %196
+        %197 = OpLabel
+        %198 = OpLoad %float %x_93
+               OpStore %x_118_phi %198
+        %199 = OpLoad %float %x_93
+               OpStore %x_119_phi %199
+               OpStore %x_120_phi %true
+               OpBranch %151
+        %196 = OpLabel
+               OpBranch %152
+        %152 = OpLabel
+        %200 = OpIAdd %int %159 %int_1
+               OpStore %x_96 %200
+        %201 = OpLoad %float %x_93
+               OpStore %x_92_phi %201
+        %202 = OpLoad %int %x_96
+               OpStore %x_95_phi %202
+               OpBranch %150
+        %151 = OpLabel
+        %203 = OpLoad %float %x_118_phi
+               OpStore %x_118 %203
+        %204 = OpLoad %float %x_119_phi
+               OpStore %x_119 %204
+        %205 = OpLoad %bool %x_120_phi
+        %206 = OpLoad %float %x_118
+               OpStore %x_122_phi %206
+               OpSelectionMerge %207 None
+               OpBranchConditional %205 %208 %207
+        %208 = OpLabel
+               OpBranch %148
+        %207 = OpLabel
+        %209 = OpLoad %float %x_119
+               OpStore %x_122_phi %209
                OpBranch %148
         %148 = OpLabel
-        %153 = OpLoad %float %x_92_phi
-               OpStore %x_92 %153
-        %154 = OpLoad %int %x_95_phi
-               OpStore %x_118_phi %float_0
-        %155 = OpLoad %float %x_92
-               OpStore %x_119_phi %155
-               OpStore %x_120_phi %false
-        %156 = OpSLessThan %bool %154 %int_800
-               OpSelectionMerge %157 None
-               OpBranchConditional %156 %158 %159
-        %158 = OpLabel
-               OpBranch %157
-        %159 = OpLabel
-               OpBranch %146
-        %157 = OpLabel
-        %162 = OpSMod %int %154 %int_32
-        %163 = OpIEqual %bool %162 %int_0
-               OpSelectionMerge %164 None
-               OpBranchConditional %163 %165 %166
-        %165 = OpLabel
-        %167 = OpLoad %float %x_92
-        %168 = OpFAdd %float %167 %float_0_400000006
-               OpStore %x_113 %168
-        %169 = OpLoad %float %x_113
-               OpStore %x_93_phi %169
-               OpBranch %164
-        %166 = OpLabel
-        %170 = OpLoad %float %x_92
-               OpStore %x_112_phi %170
-        %171 = OpConvertSToF %float %154
-        %172 = OpExtInst %float %56 RoundEven %55
-        %173 = OpFMod %float %171 %172
-        %174 = OpFOrdLessThanEqual %bool %173 %float_0_00999999978
-               OpSelectionMerge %175 None
-               OpBranchConditional %174 %176 %175
-        %176 = OpLabel
-        %177 = OpLoad %float %x_92
-        %178 = OpFAdd %float %177 %float_100
-               OpStore %x_111 %178
-        %179 = OpLoad %float %x_111
-               OpStore %x_112_phi %179
-               OpBranch %175
-        %175 = OpLabel
-        %180 = OpLoad %float %x_112_phi
-               OpStore %x_112 %180
-        %181 = OpLoad %float %x_112
-               OpStore %x_93_phi %181
-               OpBranch %164
-        %164 = OpLabel
-        %182 = OpLoad %float %x_93_phi
-               OpStore %x_93 %182
-        %183 = OpConvertSToF %float %154
-        %184 = OpLoad %float %x_88
-        %185 = OpFOrdGreaterThanEqual %bool %183 %184
-               OpSelectionMerge %186 None
-               OpBranchConditional %185 %187 %186
-        %187 = OpLabel
-        %188 = OpLoad %float %x_93
-               OpStore %x_118_phi %188
-        %189 = OpLoad %float %x_93
-               OpStore %x_119_phi %189
-               OpStore %x_120_phi %true
-               OpBranch %146
-        %186 = OpLabel
-               OpBranch %147
-        %147 = OpLabel
-        %190 = OpIAdd %int %154 %int_1
-               OpStore %x_96 %190
-        %191 = OpLoad %float %x_93
-               OpStore %x_92_phi %191
-        %192 = OpLoad %int %x_96
-               OpStore %x_95_phi %192
-               OpBranch %145
-        %146 = OpLabel
-        %193 = OpLoad %float %x_118_phi
-               OpStore %x_118 %193
-        %194 = OpLoad %float %x_119_phi
-               OpStore %x_119 %194
-        %195 = OpLoad %bool %x_120_phi
-        %196 = OpLoad %float %x_118
-               OpStore %x_122_phi %196
-               OpSelectionMerge %197 None
-               OpBranchConditional %195 %198 %197
-        %198 = OpLabel
-               OpBranch %143
-        %197 = OpLabel
-        %199 = OpLoad %float %x_119
-               OpStore %x_122_phi %199
-               OpBranch %143
-        %143 = OpLabel
-        %200 = OpLoad %float %x_122_phi
-        %201 = OpAccessChain %_ptr_Function_float %c %uint_1
-               OpStore %201 %200
-        %202 = OpAccessChain %_ptr_Function_float %c %uint_0
-        %203 = OpLoad %float %202
-        %204 = OpAccessChain %_ptr_Function_float %c %uint_1
-        %205 = OpLoad %float %204
-        %207 = OpAccessChain %_ptr_Function_float %c %uint_2
-        %208 = OpFAdd %float %203 %205
-               OpStore %207 %208
+        %210 = OpLoad %float %x_122_phi
+        %211 = OpAccessChain %_ptr_Function_float %c %uint_1
+               OpStore %211 %210
+        %212 = OpAccessChain %_ptr_Function_float %c %uint_0
+        %213 = OpLoad %float %212
+        %214 = OpAccessChain %_ptr_Function_float %c %uint_1
+        %215 = OpLoad %float %214
+        %217 = OpAccessChain %_ptr_Function_float %c %uint_2
+        %218 = OpFAdd %float %213 %215
+               OpStore %217 %218
                OpStore %x_129_phi %int_0
-               OpBranch %209
-        %209 = OpLabel
-               OpLoopMerge %210 %211 None
-               OpBranch %212
-        %212 = OpLabel
-        %214 = OpLoad %int %x_129_phi
-        %216 = OpSLessThan %bool %214 %int_3
-               OpSelectionMerge %217 None
-               OpBranchConditional %216 %218 %219
-        %218 = OpLabel
-               OpBranch %217
+               OpBranch %219
         %219 = OpLabel
-               OpBranch %210
-        %217 = OpLabel
-        %220 = OpAccessChain %_ptr_Function_float %c %214
-        %221 = OpLoad %float %220
-        %223 = OpFOrdGreaterThanEqual %bool %221 %float_1
-               OpSelectionMerge %224 None
-               OpBranchConditional %223 %225 %224
-        %225 = OpLabel
-        %226 = OpAccessChain %_ptr_Function_float %c %214
-        %227 = OpLoad %float %226
-        %228 = OpAccessChain %_ptr_Function_float %c %214
-        %229 = OpLoad %float %228
-        %230 = OpAccessChain %_ptr_Function_float %c %214
-        %231 = OpFMul %float %227 %229
-               OpStore %230 %231
-               OpBranch %224
-        %224 = OpLabel
-               OpBranch %211
-        %211 = OpLabel
-        %232 = OpIAdd %int %214 %int_1
-               OpStore %x_130 %232
-        %233 = OpLoad %int %x_130
-               OpStore %x_129_phi %233
-               OpBranch %209
-        %210 = OpLabel
-        %234 = OpLoad %v3float %c
-        %236 = OpExtInst %v3float %56 FAbs %234
-        %235 = OpExtInst %v3float %56 Normalize %236
-        %237 = OpCompositeExtract %float %235 0
-        %238 = OpCompositeExtract %float %235 1
-        %239 = OpCompositeExtract %float %235 2
-        %240 = OpCompositeConstruct %v4float %237 %238 %239 %float_1
-               OpStore %x_GLF_color %240
+               OpLoopMerge %220 %221 None
+               OpBranch %222
+        %222 = OpLabel
+        %224 = OpLoad %int %x_129_phi
+        %226 = OpSLessThan %bool %224 %int_3
+               OpSelectionMerge %227 None
+               OpBranchConditional %226 %228 %229
+        %228 = OpLabel
+               OpBranch %227
+        %229 = OpLabel
+               OpBranch %220
+        %227 = OpLabel
+        %230 = OpAccessChain %_ptr_Function_float %c %224
+        %231 = OpLoad %float %230
+        %233 = OpFOrdGreaterThanEqual %bool %231 %float_1
+               OpSelectionMerge %234 None
+               OpBranchConditional %233 %235 %234
+        %235 = OpLabel
+        %236 = OpAccessChain %_ptr_Function_float %c %224
+        %237 = OpLoad %float %236
+        %238 = OpAccessChain %_ptr_Function_float %c %224
+        %239 = OpLoad %float %238
+        %240 = OpAccessChain %_ptr_Function_float %c %224
+        %241 = OpFMul %float %237 %239
+               OpStore %240 %241
+               OpBranch %234
+        %234 = OpLabel
+               OpBranch %221
+        %221 = OpLabel
+        %242 = OpIAdd %int %224 %int_1
+               OpStore %x_130 %242
+        %243 = OpLoad %int %x_130
+               OpStore %x_129_phi %243
+               OpBranch %219
+        %220 = OpLabel
+        %244 = OpLoad %v3float %c
+        %246 = OpExtInst %v3float %56 FAbs %244
+        %245 = OpExtInst %v3float %56 Normalize %246
+        %247 = OpCompositeExtract %float %245 0
+        %248 = OpCompositeExtract %float %245 1
+        %249 = OpCompositeExtract %float %245 2
+        %250 = OpCompositeConstruct %v4float %247 %248 %249 %float_1
+               OpStore %x_GLF_color %250
                OpReturn
                OpFunctionEnd
-%tint_symbol_3 = OpFunction %void None %241
+%tint_symbol_3 = OpFunction %void None %251
 %tint_symbol_1 = OpFunctionParameter %main_out
-        %245 = OpLabel
-        %246 = OpCompositeExtract %v4float %tint_symbol_1 0
-               OpStore %tint_symbol_2 %246
+        %255 = OpLabel
+        %256 = OpCompositeExtract %v4float %tint_symbol_1 0
+               OpStore %tint_symbol_2 %256
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %15
-        %248 = OpLabel
-        %249 = OpLoad %v4float %tint_symbol
-               OpStore %gl_FragCoord %249
-        %250 = OpFunctionCall %void %main_1
-        %252 = OpLoad %v4float %x_GLF_color
-        %253 = OpCompositeConstruct %main_out %252
-        %251 = OpFunctionCall %void %tint_symbol_3 %253
+        %258 = OpLabel
+        %259 = OpLoad %v4float %tint_symbol
+               OpStore %gl_FragCoord %259
+        %260 = OpFunctionCall %void %main_1
+        %262 = OpLoad %v4float %x_GLF_color
+        %263 = OpCompositeConstruct %main_out %262
+        %261 = OpFunctionCall %void %tint_symbol_3 %263
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.wgsl
index 20e6da9..98a11e8 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.wgsl
@@ -55,7 +55,7 @@
           x_56_phi = x_68;
         } else {
           x_76_phi = x_55;
-          if (((f32(x_58) % round(x_49)) <= 0.01)) {
+          if (((f32(x_58) - (round(x_49) * floor((f32(x_58) / round(x_49))))) <= 0.01)) {
             x_75 = (x_55 + 100.0);
             x_76_phi = x_75;
           }
@@ -123,7 +123,7 @@
           x_93_phi = x_113;
         } else {
           x_112_phi = x_92;
-          if (((f32(x_95) % round(x_49)) <= 0.01)) {
+          if (((f32(x_95) - (round(x_49) * floor((f32(x_95) / round(x_49))))) <= 0.01)) {
             x_111 = (x_92 + 100.0);
             x_112_phi = x_111;
           }
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.msl
index f28bdc8..7df5ad7 100755
--- a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -59,7 +57,7 @@
           x_56_phi = x_68;
         } else {
           x_76_phi = x_55;
-          if (((float(x_58) % rint(x_49)) <= 0.01f)) {
+          if ((fmod(float(x_58), rint(x_49)) <= 0.01f)) {
             x_75 = (x_55 + 100.0f);
             x_76_phi = x_75;
           }
@@ -126,7 +124,7 @@
           x_93_phi = x_113;
         } else {
           x_112_phi = x_92;
-          if (((float(x_95) % rint(x_49)) <= 0.01f)) {
+          if ((fmod(float(x_95), rint(x_49)) <= 0.01f)) {
             x_111 = (x_92 + 100.0f);
             x_112_phi = x_111;
           }
@@ -198,11 +196,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\udmw.0.metal:60:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_58) % rint(x_49)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-T:\tmp\udmw.0.metal:127:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_95) % rint(x_49)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-2 errors generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.spvasm
index d596d85..d0770ba 100644
--- a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.spvasm
@@ -207,7 +207,7 @@
                OpStore %x_76_phi %97
          %98 = OpConvertSToF %float %75
          %99 = OpExtInst %float %56 RoundEven %55
-        %100 = OpFMod %float %98 %99
+        %100 = OpFRem %float %98 %99
         %102 = OpFOrdLessThanEqual %bool %100 %float_0_00999999978
                OpSelectionMerge %103 None
                OpBranchConditional %102 %104 %103
@@ -313,7 +313,7 @@
                OpStore %x_112_phi %170
         %171 = OpConvertSToF %float %154
         %172 = OpExtInst %float %56 RoundEven %55
-        %173 = OpFMod %float %171 %172
+        %173 = OpFRem %float %171 %172
         %174 = OpFOrdLessThanEqual %bool %173 %float_0_00999999978
                OpSelectionMerge %175 None
                OpBranchConditional %174 %176 %175
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.hlsl
index 1b409b0..c57ef0b 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.hlsl
@@ -57,7 +57,7 @@
           x_59_phi = x_71;
         } else {
           x_79_phi = x_58;
-          if (((float(x_61) % round(x_52)) <= 0.01f)) {
+          if (((float(x_61) - (round(x_52) * floor((float(x_61) / round(x_52))))) <= 0.01f)) {
             x_78 = (x_58 + 100.0f);
             x_79_phi = x_78;
           }
@@ -129,7 +129,7 @@
           x_103_phi = x_115;
         } else {
           x_123_phi = x_102;
-          if (((float(x_105) % round(x_52)) <= 0.01f)) {
+          if (((float(x_105) - (round(x_52) * floor((float(x_105) / round(x_52))))) <= 0.01f)) {
             x_122 = (x_102 + 100.0f);
             x_123_phi = x_122;
           }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.msl
index 81d5bd8..3f4d5cb 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -62,7 +60,7 @@
           x_59_phi = x_71;
         } else {
           x_79_phi = x_58;
-          if (((float(x_61) % rint(x_52)) <= 0.01f)) {
+          if (((float(x_61) - (rint(x_52) * floor((float(x_61) / rint(x_52))))) <= 0.01f)) {
             x_78 = (x_58 + 100.0f);
             x_79_phi = x_78;
           }
@@ -134,7 +132,7 @@
           x_103_phi = x_115;
         } else {
           x_123_phi = x_102;
-          if (((float(x_105) % rint(x_52)) <= 0.01f)) {
+          if (((float(x_105) - (rint(x_52) * floor((float(x_105) / rint(x_52))))) <= 0.01f)) {
             x_122 = (x_102 + 100.0f);
             x_123_phi = x_122;
           }
@@ -216,11 +214,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\u4dc.0.metal:63:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_61) % rint(x_52)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-T:\tmp\u4dc.0.metal:135:30: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_105) % rint(x_52)) <= 0.01f)) {
-                ~~~~~~~~~~~~ ^ ~~~~~~~~~~
-2 errors generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.spvasm
index 585bfcd..e4c4488 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 278
+; Bound: 288
 ; Schema: 0
                OpCapability Shader
          %59 = OpExtInstImport "GLSL.std.450"
@@ -129,7 +129,7 @@
       %int_3 = OpConstant %int 3
     %float_1 = OpConstant %float 1
    %main_out = OpTypeStruct %v4float
-        %265 = OpTypeFunction %void %main_out
+        %275 = OpTypeFunction %void %main_out
      %main_1 = OpFunction %void None %18
          %21 = OpLabel
           %c = OpVariable %_ptr_Function_v3float Function %25
@@ -218,273 +218,283 @@
                OpStore %x_79_phi %100
         %101 = OpConvertSToF %float %78
         %102 = OpExtInst %float %59 RoundEven %58
-        %103 = OpFMod %float %101 %102
-        %105 = OpFOrdLessThanEqual %bool %103 %float_0_00999999978
-               OpSelectionMerge %106 None
-               OpBranchConditional %105 %107 %106
-        %107 = OpLabel
-        %108 = OpLoad %float %x_58
-        %110 = OpFAdd %float %108 %float_100
-               OpStore %x_78 %110
-        %111 = OpLoad %float %x_78
-               OpStore %x_79_phi %111
-               OpBranch %106
-        %106 = OpLabel
-        %112 = OpLoad %float %x_79_phi
-               OpStore %x_79 %112
-        %113 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0
-        %114 = OpLoad %float %113
-        %116 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1
-        %117 = OpLoad %float %116
-        %118 = OpFOrdGreaterThan %bool %114 %117
-               OpSelectionMerge %119 None
-               OpBranchConditional %118 %120 %119
-        %120 = OpLabel
+        %104 = OpConvertSToF %float %78
+        %105 = OpExtInst %float %59 RoundEven %58
+        %106 = OpFDiv %float %104 %105
+        %103 = OpExtInst %float %59 Floor %106
+        %107 = OpFMul %float %102 %103
+        %108 = OpFSub %float %101 %107
+        %110 = OpFOrdLessThanEqual %bool %108 %float_0_00999999978
+               OpSelectionMerge %111 None
+               OpBranchConditional %110 %112 %111
+        %112 = OpLabel
+        %113 = OpLoad %float %x_58
+        %115 = OpFAdd %float %113 %float_100
+               OpStore %x_78 %115
+        %116 = OpLoad %float %x_78
+               OpStore %x_79_phi %116
+               OpBranch %111
+        %111 = OpLabel
+        %117 = OpLoad %float %x_79_phi
+               OpStore %x_79 %117
+        %118 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0
+        %119 = OpLoad %float %118
+        %121 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1
+        %122 = OpLoad %float %121
+        %123 = OpFOrdGreaterThan %bool %119 %122
+               OpSelectionMerge %124 None
+               OpBranchConditional %123 %125 %124
+        %125 = OpLabel
                OpKill
-        %119 = OpLabel
-        %121 = OpLoad %float %x_79
-               OpStore %x_59_phi %121
+        %124 = OpLabel
+        %126 = OpLoad %float %x_79
+               OpStore %x_59_phi %126
                OpBranch %93
          %93 = OpLabel
-        %122 = OpLoad %float %x_59_phi
-               OpStore %x_59 %122
-        %123 = OpConvertSToF %float %78
-        %124 = OpLoad %float %x_54
-        %125 = OpFOrdGreaterThanEqual %bool %123 %124
-               OpSelectionMerge %126 None
-               OpBranchConditional %125 %127 %126
-        %127 = OpLabel
-        %128 = OpLoad %float %x_59
-               OpStore %x_91_phi %128
-        %129 = OpLoad %float %x_59
-               OpStore %x_92_phi %129
+        %127 = OpLoad %float %x_59_phi
+               OpStore %x_59 %127
+        %128 = OpConvertSToF %float %78
+        %129 = OpLoad %float %x_54
+        %130 = OpFOrdGreaterThanEqual %bool %128 %129
+               OpSelectionMerge %131 None
+               OpBranchConditional %130 %132 %131
+        %132 = OpLabel
+        %133 = OpLoad %float %x_59
+               OpStore %x_91_phi %133
+        %134 = OpLoad %float %x_59
+               OpStore %x_92_phi %134
                OpStore %x_93_phi %true
                OpBranch %70
-        %126 = OpLabel
+        %131 = OpLabel
                OpBranch %71
          %71 = OpLabel
-        %131 = OpIAdd %int %78 %int_1
-               OpStore %x_62 %131
-        %132 = OpLoad %float %x_59
-               OpStore %x_58_phi %132
-        %133 = OpLoad %int %x_62
-               OpStore %x_61_phi %133
+        %136 = OpIAdd %int %78 %int_1
+               OpStore %x_62 %136
+        %137 = OpLoad %float %x_59
+               OpStore %x_58_phi %137
+        %138 = OpLoad %int %x_62
+               OpStore %x_61_phi %138
                OpBranch %69
          %70 = OpLabel
-        %134 = OpLoad %float %x_91_phi
-               OpStore %x_91 %134
-        %135 = OpLoad %float %x_92_phi
-               OpStore %x_92 %135
-        %136 = OpLoad %bool %x_93_phi
-        %137 = OpLoad %float %x_91
-               OpStore %x_95_phi %137
-               OpSelectionMerge %138 None
-               OpBranchConditional %136 %139 %138
-        %139 = OpLabel
+        %139 = OpLoad %float %x_91_phi
+               OpStore %x_91 %139
+        %140 = OpLoad %float %x_92_phi
+               OpStore %x_92 %140
+        %141 = OpLoad %bool %x_93_phi
+        %142 = OpLoad %float %x_91
+               OpStore %x_95_phi %142
+               OpSelectionMerge %143 None
+               OpBranchConditional %141 %144 %143
+        %144 = OpLabel
                OpBranch %65
-        %138 = OpLabel
-        %140 = OpLoad %float %x_92
-               OpStore %x_95_phi %140
+        %143 = OpLabel
+        %145 = OpLoad %float %x_92
+               OpStore %x_95_phi %145
                OpBranch %65
          %65 = OpLabel
-        %149 = OpLoad %float %x_95_phi
-        %150 = OpAccessChain %_ptr_Function_float %c %uint_0
-               OpStore %150 %149
-        %151 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %152 = OpLoad %float %151
-               OpStore %x_98 %152
-               OpSelectionMerge %153 None
-               OpSwitch %uint_0 %154
-        %154 = OpLabel
+        %154 = OpLoad %float %x_95_phi
+        %155 = OpAccessChain %_ptr_Function_float %c %uint_0
+               OpStore %155 %154
+        %156 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %157 = OpLoad %float %156
+               OpStore %x_98 %157
+               OpSelectionMerge %158 None
+               OpSwitch %uint_0 %159
+        %159 = OpLabel
                OpStore %x_102_phi %float_n0_5
                OpStore %x_105_phi %int_1
-               OpBranch %155
-        %155 = OpLabel
-               OpLoopMerge %156 %157 None
+               OpBranch %160
+        %160 = OpLabel
+               OpLoopMerge %161 %162 None
+               OpBranch %163
+        %163 = OpLabel
+        %168 = OpLoad %float %x_102_phi
+               OpStore %x_102 %168
+        %169 = OpLoad %int %x_105_phi
+               OpStore %x_135_phi %float_0
+        %170 = OpLoad %float %x_102
+               OpStore %x_136_phi %170
+               OpStore %x_137_phi %false
+        %171 = OpSLessThan %bool %169 %int_800
+               OpSelectionMerge %172 None
+               OpBranchConditional %171 %173 %174
+        %173 = OpLabel
+               OpBranch %172
+        %174 = OpLabel
+               OpBranch %161
+        %172 = OpLabel
+        %177 = OpSMod %int %169 %int_32
+        %178 = OpIEqual %bool %177 %int_0
+               OpSelectionMerge %179 None
+               OpBranchConditional %178 %180 %181
+        %180 = OpLabel
+        %182 = OpLoad %float %x_102
+        %183 = OpFAdd %float %182 %float_0_400000006
+               OpStore %x_115 %183
+        %184 = OpLoad %float %x_115
+               OpStore %x_103_phi %184
+               OpBranch %179
+        %181 = OpLabel
+        %185 = OpLoad %float %x_102
+               OpStore %x_123_phi %185
+        %186 = OpConvertSToF %float %169
+        %187 = OpExtInst %float %59 RoundEven %58
+        %189 = OpConvertSToF %float %169
+        %190 = OpExtInst %float %59 RoundEven %58
+        %191 = OpFDiv %float %189 %190
+        %188 = OpExtInst %float %59 Floor %191
+        %192 = OpFMul %float %187 %188
+        %193 = OpFSub %float %186 %192
+        %194 = OpFOrdLessThanEqual %bool %193 %float_0_00999999978
+               OpSelectionMerge %195 None
+               OpBranchConditional %194 %196 %195
+        %196 = OpLabel
+        %197 = OpLoad %float %x_102
+        %198 = OpFAdd %float %197 %float_100
+               OpStore %x_122 %198
+        %199 = OpLoad %float %x_122
+               OpStore %x_123_phi %199
+               OpBranch %195
+        %195 = OpLabel
+        %200 = OpLoad %float %x_123_phi
+               OpStore %x_123 %200
+        %201 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0
+        %202 = OpLoad %float %201
+        %203 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1
+        %204 = OpLoad %float %203
+        %205 = OpFOrdGreaterThan %bool %202 %204
+               OpSelectionMerge %206 None
+               OpBranchConditional %205 %207 %206
+        %207 = OpLabel
+               OpKill
+        %206 = OpLabel
+        %208 = OpLoad %float %x_123
+               OpStore %x_103_phi %208
+               OpBranch %179
+        %179 = OpLabel
+        %209 = OpLoad %float %x_103_phi
+               OpStore %x_103 %209
+        %210 = OpConvertSToF %float %169
+        %211 = OpLoad %float %x_98
+        %212 = OpFOrdGreaterThanEqual %bool %210 %211
+               OpSelectionMerge %213 None
+               OpBranchConditional %212 %214 %213
+        %214 = OpLabel
+        %215 = OpLoad %float %x_103
+               OpStore %x_135_phi %215
+        %216 = OpLoad %float %x_103
+               OpStore %x_136_phi %216
+               OpStore %x_137_phi %true
+               OpBranch %161
+        %213 = OpLabel
+               OpBranch %162
+        %162 = OpLabel
+        %217 = OpIAdd %int %169 %int_1
+               OpStore %x_106 %217
+        %218 = OpLoad %float %x_103
+               OpStore %x_102_phi %218
+        %219 = OpLoad %int %x_106
+               OpStore %x_105_phi %219
+               OpBranch %160
+        %161 = OpLabel
+        %220 = OpLoad %float %x_135_phi
+               OpStore %x_135 %220
+        %221 = OpLoad %float %x_136_phi
+               OpStore %x_136 %221
+        %222 = OpLoad %bool %x_137_phi
+        %223 = OpLoad %float %x_135
+               OpStore %x_139_phi %223
+               OpSelectionMerge %224 None
+               OpBranchConditional %222 %225 %224
+        %225 = OpLabel
+               OpBranch %158
+        %224 = OpLabel
+        %226 = OpLoad %float %x_136
+               OpStore %x_139_phi %226
                OpBranch %158
         %158 = OpLabel
-        %163 = OpLoad %float %x_102_phi
-               OpStore %x_102 %163
-        %164 = OpLoad %int %x_105_phi
-               OpStore %x_135_phi %float_0
-        %165 = OpLoad %float %x_102
-               OpStore %x_136_phi %165
-               OpStore %x_137_phi %false
-        %166 = OpSLessThan %bool %164 %int_800
-               OpSelectionMerge %167 None
-               OpBranchConditional %166 %168 %169
-        %168 = OpLabel
-               OpBranch %167
-        %169 = OpLabel
-               OpBranch %156
-        %167 = OpLabel
-        %172 = OpSMod %int %164 %int_32
-        %173 = OpIEqual %bool %172 %int_0
-               OpSelectionMerge %174 None
-               OpBranchConditional %173 %175 %176
-        %175 = OpLabel
-        %177 = OpLoad %float %x_102
-        %178 = OpFAdd %float %177 %float_0_400000006
-               OpStore %x_115 %178
-        %179 = OpLoad %float %x_115
-               OpStore %x_103_phi %179
-               OpBranch %174
-        %176 = OpLabel
-        %180 = OpLoad %float %x_102
-               OpStore %x_123_phi %180
-        %181 = OpConvertSToF %float %164
-        %182 = OpExtInst %float %59 RoundEven %58
-        %183 = OpFMod %float %181 %182
-        %184 = OpFOrdLessThanEqual %bool %183 %float_0_00999999978
-               OpSelectionMerge %185 None
-               OpBranchConditional %184 %186 %185
-        %186 = OpLabel
-        %187 = OpLoad %float %x_102
-        %188 = OpFAdd %float %187 %float_100
-               OpStore %x_122 %188
-        %189 = OpLoad %float %x_122
-               OpStore %x_123_phi %189
-               OpBranch %185
-        %185 = OpLabel
-        %190 = OpLoad %float %x_123_phi
-               OpStore %x_123 %190
-        %191 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0
-        %192 = OpLoad %float %191
-        %193 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1
-        %194 = OpLoad %float %193
-        %195 = OpFOrdGreaterThan %bool %192 %194
-               OpSelectionMerge %196 None
-               OpBranchConditional %195 %197 %196
-        %197 = OpLabel
-               OpKill
-        %196 = OpLabel
-        %198 = OpLoad %float %x_123
-               OpStore %x_103_phi %198
-               OpBranch %174
-        %174 = OpLabel
-        %199 = OpLoad %float %x_103_phi
-               OpStore %x_103 %199
-        %200 = OpConvertSToF %float %164
-        %201 = OpLoad %float %x_98
-        %202 = OpFOrdGreaterThanEqual %bool %200 %201
-               OpSelectionMerge %203 None
-               OpBranchConditional %202 %204 %203
-        %204 = OpLabel
-        %205 = OpLoad %float %x_103
-               OpStore %x_135_phi %205
-        %206 = OpLoad %float %x_103
-               OpStore %x_136_phi %206
-               OpStore %x_137_phi %true
-               OpBranch %156
-        %203 = OpLabel
-               OpBranch %157
-        %157 = OpLabel
-        %207 = OpIAdd %int %164 %int_1
-               OpStore %x_106 %207
-        %208 = OpLoad %float %x_103
-               OpStore %x_102_phi %208
-        %209 = OpLoad %int %x_106
-               OpStore %x_105_phi %209
-               OpBranch %155
-        %156 = OpLabel
-        %210 = OpLoad %float %x_135_phi
-               OpStore %x_135 %210
-        %211 = OpLoad %float %x_136_phi
-               OpStore %x_136 %211
-        %212 = OpLoad %bool %x_137_phi
-        %213 = OpLoad %float %x_135
-               OpStore %x_139_phi %213
-               OpSelectionMerge %214 None
-               OpBranchConditional %212 %215 %214
-        %215 = OpLabel
-               OpBranch %153
-        %214 = OpLabel
-        %216 = OpLoad %float %x_136
-               OpStore %x_139_phi %216
-               OpBranch %153
-        %153 = OpLabel
-        %217 = OpLoad %float %x_139_phi
-        %218 = OpAccessChain %_ptr_Function_float %c %uint_1
-               OpStore %218 %217
-        %219 = OpAccessChain %_ptr_Function_float %c %uint_0
-        %220 = OpLoad %float %219
-        %221 = OpAccessChain %_ptr_Function_float %c %uint_1
-        %222 = OpLoad %float %221
-        %224 = OpAccessChain %_ptr_Function_float %c %uint_2
-        %225 = OpFAdd %float %220 %222
-               OpStore %224 %225
+        %227 = OpLoad %float %x_139_phi
+        %228 = OpAccessChain %_ptr_Function_float %c %uint_1
+               OpStore %228 %227
+        %229 = OpAccessChain %_ptr_Function_float %c %uint_0
+        %230 = OpLoad %float %229
+        %231 = OpAccessChain %_ptr_Function_float %c %uint_1
+        %232 = OpLoad %float %231
+        %234 = OpAccessChain %_ptr_Function_float %c %uint_2
+        %235 = OpFAdd %float %230 %232
+               OpStore %234 %235
                OpStore %x_146_phi %int_0
-               OpBranch %226
-        %226 = OpLabel
-               OpLoopMerge %227 %228 None
-               OpBranch %229
-        %229 = OpLabel
-        %231 = OpLoad %int %x_146_phi
-        %233 = OpSLessThan %bool %231 %int_3
-               OpSelectionMerge %234 None
-               OpBranchConditional %233 %235 %236
-        %235 = OpLabel
-               OpBranch %234
+               OpBranch %236
         %236 = OpLabel
-               OpBranch %227
-        %234 = OpLabel
-        %237 = OpAccessChain %_ptr_Function_float %c %231
-        %238 = OpLoad %float %237
-        %240 = OpFOrdGreaterThanEqual %bool %238 %float_1
-               OpSelectionMerge %241 None
-               OpBranchConditional %240 %242 %241
-        %242 = OpLabel
-        %243 = OpAccessChain %_ptr_Function_float %c %231
-        %244 = OpLoad %float %243
-        %245 = OpAccessChain %_ptr_Function_float %c %231
-        %246 = OpLoad %float %245
-        %247 = OpAccessChain %_ptr_Function_float %c %231
-        %248 = OpFMul %float %244 %246
-               OpStore %247 %248
-        %249 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0
-        %250 = OpLoad %float %249
-        %251 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1
-        %252 = OpLoad %float %251
-        %253 = OpFOrdGreaterThan %bool %250 %252
-               OpSelectionMerge %254 None
-               OpBranchConditional %253 %255 %254
-        %255 = OpLabel
+               OpLoopMerge %237 %238 None
+               OpBranch %239
+        %239 = OpLabel
+        %241 = OpLoad %int %x_146_phi
+        %243 = OpSLessThan %bool %241 %int_3
+               OpSelectionMerge %244 None
+               OpBranchConditional %243 %245 %246
+        %245 = OpLabel
+               OpBranch %244
+        %246 = OpLabel
+               OpBranch %237
+        %244 = OpLabel
+        %247 = OpAccessChain %_ptr_Function_float %c %241
+        %248 = OpLoad %float %247
+        %250 = OpFOrdGreaterThanEqual %bool %248 %float_1
+               OpSelectionMerge %251 None
+               OpBranchConditional %250 %252 %251
+        %252 = OpLabel
+        %253 = OpAccessChain %_ptr_Function_float %c %241
+        %254 = OpLoad %float %253
+        %255 = OpAccessChain %_ptr_Function_float %c %241
+        %256 = OpLoad %float %255
+        %257 = OpAccessChain %_ptr_Function_float %c %241
+        %258 = OpFMul %float %254 %256
+               OpStore %257 %258
+        %259 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0
+        %260 = OpLoad %float %259
+        %261 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1
+        %262 = OpLoad %float %261
+        %263 = OpFOrdGreaterThan %bool %260 %262
+               OpSelectionMerge %264 None
+               OpBranchConditional %263 %265 %264
+        %265 = OpLabel
                OpKill
-        %254 = OpLabel
-               OpBranch %241
-        %241 = OpLabel
-               OpBranch %228
-        %228 = OpLabel
-        %256 = OpIAdd %int %231 %int_1
-               OpStore %x_147 %256
-        %257 = OpLoad %int %x_147
-               OpStore %x_146_phi %257
-               OpBranch %226
-        %227 = OpLabel
-        %258 = OpLoad %v3float %c
-        %260 = OpExtInst %v3float %59 FAbs %258
-        %259 = OpExtInst %v3float %59 Normalize %260
-        %261 = OpCompositeExtract %float %259 0
-        %262 = OpCompositeExtract %float %259 1
-        %263 = OpCompositeExtract %float %259 2
-        %264 = OpCompositeConstruct %v4float %261 %262 %263 %float_1
-               OpStore %x_GLF_color %264
+        %264 = OpLabel
+               OpBranch %251
+        %251 = OpLabel
+               OpBranch %238
+        %238 = OpLabel
+        %266 = OpIAdd %int %241 %int_1
+               OpStore %x_147 %266
+        %267 = OpLoad %int %x_147
+               OpStore %x_146_phi %267
+               OpBranch %236
+        %237 = OpLabel
+        %268 = OpLoad %v3float %c
+        %270 = OpExtInst %v3float %59 FAbs %268
+        %269 = OpExtInst %v3float %59 Normalize %270
+        %271 = OpCompositeExtract %float %269 0
+        %272 = OpCompositeExtract %float %269 1
+        %273 = OpCompositeExtract %float %269 2
+        %274 = OpCompositeConstruct %v4float %271 %272 %273 %float_1
+               OpStore %x_GLF_color %274
                OpReturn
                OpFunctionEnd
-%tint_symbol_3 = OpFunction %void None %265
+%tint_symbol_3 = OpFunction %void None %275
 %tint_symbol_1 = OpFunctionParameter %main_out
-        %269 = OpLabel
-        %270 = OpCompositeExtract %v4float %tint_symbol_1 0
-               OpStore %tint_symbol_2 %270
+        %279 = OpLabel
+        %280 = OpCompositeExtract %v4float %tint_symbol_1 0
+               OpStore %tint_symbol_2 %280
                OpReturn
                OpFunctionEnd
        %main = OpFunction %void None %18
-        %272 = OpLabel
-        %273 = OpLoad %v4float %tint_symbol
-               OpStore %gl_FragCoord %273
-        %274 = OpFunctionCall %void %main_1
-        %276 = OpLoad %v4float %x_GLF_color
-        %277 = OpCompositeConstruct %main_out %276
-        %275 = OpFunctionCall %void %tint_symbol_3 %277
+        %282 = OpLabel
+        %283 = OpLoad %v4float %tint_symbol
+               OpStore %gl_FragCoord %283
+        %284 = OpFunctionCall %void %main_1
+        %286 = OpLoad %v4float %x_GLF_color
+        %287 = OpCompositeConstruct %main_out %286
+        %285 = OpFunctionCall %void %tint_symbol_3 %287
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.wgsl
index 5688188..e8c696d 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.wgsl
@@ -62,7 +62,7 @@
           x_59_phi = x_71;
         } else {
           x_79_phi = x_58;
-          if (((f32(x_61) % round(x_52)) <= 0.01)) {
+          if (((f32(x_61) - (round(x_52) * floor((f32(x_61) / round(x_52))))) <= 0.01)) {
             x_78 = (x_58 + 100.0);
             x_79_phi = x_78;
           }
@@ -135,7 +135,7 @@
           x_103_phi = x_115;
         } else {
           x_123_phi = x_102;
-          if (((f32(x_105) % round(x_52)) <= 0.01)) {
+          if (((f32(x_105) - (round(x_52) * floor((f32(x_105) / round(x_52))))) <= 0.01)) {
             x_122 = (x_102 + 100.0);
             x_123_phi = x_122;
           }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.msl
index 1f4f528..b5f9f63 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -62,7 +60,7 @@
           x_59_phi = x_71;
         } else {
           x_79_phi = x_58;
-          if (((float(x_61) % rint(x_52)) <= 0.01f)) {
+          if ((fmod(float(x_61), rint(x_52)) <= 0.01f)) {
             x_78 = (x_58 + 100.0f);
             x_79_phi = x_78;
           }
@@ -134,7 +132,7 @@
           x_103_phi = x_115;
         } else {
           x_123_phi = x_102;
-          if (((float(x_105) % rint(x_52)) <= 0.01f)) {
+          if ((fmod(float(x_105), rint(x_52)) <= 0.01f)) {
             x_122 = (x_102 + 100.0f);
             x_123_phi = x_122;
           }
@@ -216,11 +214,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\ucz4.0.metal:63:29: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_61) % rint(x_52)) <= 0.01f)) {
-                ~~~~~~~~~~~ ^ ~~~~~~~~~~
-T:\tmp\ucz4.0.metal:135:30: error: invalid operands to binary expression ('float' and 'float')
-          if (((float(x_105) % rint(x_52)) <= 0.01f)) {
-                ~~~~~~~~~~~~ ^ ~~~~~~~~~~
-2 errors generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.spvasm
index 585bfcd..a037b9b 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.spvasm
@@ -218,7 +218,7 @@
                OpStore %x_79_phi %100
         %101 = OpConvertSToF %float %78
         %102 = OpExtInst %float %59 RoundEven %58
-        %103 = OpFMod %float %101 %102
+        %103 = OpFRem %float %101 %102
         %105 = OpFOrdLessThanEqual %bool %103 %float_0_00999999978
                OpSelectionMerge %106 None
                OpBranchConditional %105 %107 %106
@@ -334,7 +334,7 @@
                OpStore %x_123_phi %180
         %181 = OpConvertSToF %float %164
         %182 = OpExtInst %float %59 RoundEven %58
-        %183 = OpFMod %float %181 %182
+        %183 = OpFRem %float %181 %182
         %184 = OpFOrdLessThanEqual %bool %183 %float_0_00999999978
                OpSelectionMerge %185 None
                OpBranchConditional %184 %186 %185
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.hlsl
index 7295dbb..461df51 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.hlsl
@@ -20,7 +20,7 @@
       } else {
         const int x_122 = i;
         const float x_124 = thirty_two;
-        if (((float(x_122) % round(x_124)) <= 0.01f)) {
+        if (((float(x_122) - (round(x_124) * floor((float(x_122) / round(x_124))))) <= 0.01f)) {
           result = (result + 100.0f);
         }
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.msl
index 51d7aa0..b31b105 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -31,7 +29,7 @@
     } else {
       int const x_122 = i;
       float const x_124 = *(thirty_two);
-      if (((float(x_122) % rint(x_124)) <= 0.01f)) {
+      if (((float(x_122) - (rint(x_124) * floor((float(x_122) / rint(x_124))))) <= 0.01f)) {
         float const x_130 = result;
         result = (x_130 + 100.0f);
       }
@@ -115,8 +113,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\ufic.0.metal:32:26: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_122) % rint(x_124)) <= 0.01f)) {
-            ~~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.spvasm
index 15ed885..f7d8cfd 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 172
+; Bound: 177
 ; Schema: 0
                OpCapability Shader
          %56 = OpExtInstImport "GLSL.std.450"
@@ -71,14 +71,14 @@
 %float_0_00999999978 = OpConstant %float 0.00999999978
   %float_100 = OpConstant %float 100
        %void = OpTypeVoid
-         %76 = OpTypeFunction %void
+         %81 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %83 = OpConstantNull %v3float
+         %88 = OpConstantNull %v3float
     %float_7 = OpConstant %float 7
     %float_8 = OpConstant %float 8
     %float_9 = OpConstant %float 9
-         %93 = OpConstantComposite %v3float %float_7 %float_8 %float_9
+         %98 = OpConstantComposite %v3float %float_7 %float_8 %float_9
        %uint = OpTypeInt 32 0
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
@@ -88,7 +88,7 @@
       %int_3 = OpConstant %int 3
     %float_1 = OpConstant %float 1
    %main_out = OpTypeStruct %v4float
-        %159 = OpTypeFunction %void %main_out
+        %164 = OpTypeFunction %void %main_out
 %compute_value_f1_f1_ = OpFunction %float None %15
       %limit = OpFunctionParameter %_ptr_Function_float
  %thirty_two = OpFunctionParameter %_ptr_Function_float
@@ -126,141 +126,146 @@
          %53 = OpLoad %float %thirty_two
          %54 = OpConvertSToF %float %51
          %55 = OpExtInst %float %56 RoundEven %53
-         %57 = OpFMod %float %54 %55
-         %59 = OpFOrdLessThanEqual %bool %57 %float_0_00999999978
-               OpSelectionMerge %60 None
-               OpBranchConditional %59 %61 %60
-         %61 = OpLabel
-         %62 = OpLoad %float %result
-         %64 = OpFAdd %float %62 %float_100
-               OpStore %result %64
-               OpBranch %60
-         %60 = OpLabel
+         %58 = OpConvertSToF %float %51
+         %59 = OpExtInst %float %56 RoundEven %53
+         %60 = OpFDiv %float %58 %59
+         %57 = OpExtInst %float %56 Floor %60
+         %61 = OpFMul %float %55 %57
+         %62 = OpFSub %float %54 %61
+         %64 = OpFOrdLessThanEqual %bool %62 %float_0_00999999978
+               OpSelectionMerge %65 None
+               OpBranchConditional %64 %66 %65
+         %66 = OpLabel
+         %67 = OpLoad %float %result
+         %69 = OpFAdd %float %67 %float_100
+               OpStore %result %69
+               OpBranch %65
+         %65 = OpLabel
                OpBranch %45
          %45 = OpLabel
-         %65 = OpLoad %int %i
-         %67 = OpLoad %float %limit
-         %68 = OpConvertSToF %float %65
-         %69 = OpFOrdGreaterThanEqual %bool %68 %67
-               OpSelectionMerge %70 None
-               OpBranchConditional %69 %71 %70
-         %71 = OpLabel
-         %72 = OpLoad %float %result
-               OpReturnValue %72
-         %70 = OpLabel
+         %70 = OpLoad %int %i
+         %72 = OpLoad %float %limit
+         %73 = OpConvertSToF %float %70
+         %74 = OpFOrdGreaterThanEqual %bool %73 %72
+               OpSelectionMerge %75 None
+               OpBranchConditional %74 %76 %75
+         %76 = OpLabel
+         %77 = OpLoad %float %result
+               OpReturnValue %77
+         %75 = OpLabel
                OpBranch %31
          %31 = OpLabel
-         %73 = OpLoad %int %i
-         %74 = OpIAdd %int %73 %int_1
-               OpStore %i %74
+         %78 = OpLoad %int %i
+         %79 = OpIAdd %int %78 %int_1
+               OpStore %i %79
                OpBranch %29
          %30 = OpLabel
-         %75 = OpLoad %float %result
-               OpReturnValue %75
+         %80 = OpLoad %float %result
+               OpReturnValue %80
                OpFunctionEnd
-     %main_1 = OpFunction %void None %76
-         %79 = OpLabel
-          %c = OpVariable %_ptr_Function_v3float Function %83
+     %main_1 = OpFunction %void None %81
+         %84 = OpLabel
+          %c = OpVariable %_ptr_Function_v3float Function %88
 %thirty_two_1 = OpVariable %_ptr_Function_float Function %22
       %param = OpVariable %_ptr_Function_float Function %22
     %param_1 = OpVariable %_ptr_Function_float Function %22
     %param_2 = OpVariable %_ptr_Function_float Function %22
     %param_3 = OpVariable %_ptr_Function_float Function %22
         %i_1 = OpVariable %_ptr_Function_int Function %26
-               OpStore %c %93
-         %97 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0
-         %98 = OpLoad %float %97
-        %100 = OpFDiv %float %98 %float_8
-         %99 = OpExtInst %float %56 RoundEven %100
-               OpStore %thirty_two_1 %99
-        %102 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
+               OpStore %c %98
+        %102 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0
         %103 = OpLoad %float %102
-               OpStore %param %103
-        %104 = OpLoad %float %thirty_two_1
-               OpStore %param_1 %104
-        %105 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
-        %108 = OpAccessChain %_ptr_Function_float %c %uint_0
-               OpStore %108 %105
-        %110 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %111 = OpLoad %float %110
-               OpStore %param_2 %111
-        %112 = OpLoad %float %thirty_two_1
-               OpStore %param_3 %112
-        %113 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
-        %116 = OpAccessChain %_ptr_Function_float %c %uint_1
-               OpStore %116 %113
-        %117 = OpAccessChain %_ptr_Function_float %c %uint_0
-        %118 = OpLoad %float %117
-        %119 = OpAccessChain %_ptr_Function_float %c %uint_1
-        %120 = OpLoad %float %119
-        %122 = OpAccessChain %_ptr_Function_float %c %uint_2
-        %123 = OpFAdd %float %118 %120
-               OpStore %122 %123
+        %105 = OpFDiv %float %103 %float_8
+        %104 = OpExtInst %float %56 RoundEven %105
+               OpStore %thirty_two_1 %104
+        %107 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
+        %108 = OpLoad %float %107
+               OpStore %param %108
+        %109 = OpLoad %float %thirty_two_1
+               OpStore %param_1 %109
+        %110 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
+        %113 = OpAccessChain %_ptr_Function_float %c %uint_0
+               OpStore %113 %110
+        %115 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %116 = OpLoad %float %115
+               OpStore %param_2 %116
+        %117 = OpLoad %float %thirty_two_1
+               OpStore %param_3 %117
+        %118 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
+        %121 = OpAccessChain %_ptr_Function_float %c %uint_1
+               OpStore %121 %118
+        %122 = OpAccessChain %_ptr_Function_float %c %uint_0
+        %123 = OpLoad %float %122
+        %124 = OpAccessChain %_ptr_Function_float %c %uint_1
+        %125 = OpLoad %float %124
+        %127 = OpAccessChain %_ptr_Function_float %c %uint_2
+        %128 = OpFAdd %float %123 %125
+               OpStore %127 %128
                OpStore %i_1 %int_0
-               OpBranch %124
-        %124 = OpLabel
-               OpLoopMerge %125 %126 None
-               OpBranch %127
-        %127 = OpLabel
-        %128 = OpLoad %int %i_1
-        %130 = OpSLessThan %bool %128 %int_3
-               OpSelectionMerge %131 None
-               OpBranchConditional %130 %132 %133
+               OpBranch %129
+        %129 = OpLabel
+               OpLoopMerge %130 %131 None
+               OpBranch %132
         %132 = OpLabel
-               OpBranch %131
-        %133 = OpLabel
-               OpBranch %125
-        %131 = OpLabel
-        %134 = OpLoad %int %i_1
-        %135 = OpAccessChain %_ptr_Function_float %c %134
-        %136 = OpLoad %float %135
-        %138 = OpFOrdGreaterThanEqual %bool %136 %float_1
-               OpSelectionMerge %139 None
-               OpBranchConditional %138 %140 %139
-        %140 = OpLabel
-        %141 = OpLoad %int %i_1
-        %142 = OpLoad %int %i_1
-        %143 = OpAccessChain %_ptr_Function_float %c %142
-        %144 = OpLoad %float %143
-        %145 = OpLoad %int %i_1
-        %146 = OpAccessChain %_ptr_Function_float %c %145
-        %147 = OpLoad %float %146
-        %148 = OpAccessChain %_ptr_Function_float %c %141
-        %149 = OpFMul %float %144 %147
-               OpStore %148 %149
-               OpBranch %139
-        %139 = OpLabel
-               OpBranch %126
-        %126 = OpLabel
+        %133 = OpLoad %int %i_1
+        %135 = OpSLessThan %bool %133 %int_3
+               OpSelectionMerge %136 None
+               OpBranchConditional %135 %137 %138
+        %137 = OpLabel
+               OpBranch %136
+        %138 = OpLabel
+               OpBranch %130
+        %136 = OpLabel
+        %139 = OpLoad %int %i_1
+        %140 = OpAccessChain %_ptr_Function_float %c %139
+        %141 = OpLoad %float %140
+        %143 = OpFOrdGreaterThanEqual %bool %141 %float_1
+               OpSelectionMerge %144 None
+               OpBranchConditional %143 %145 %144
+        %145 = OpLabel
+        %146 = OpLoad %int %i_1
+        %147 = OpLoad %int %i_1
+        %148 = OpAccessChain %_ptr_Function_float %c %147
+        %149 = OpLoad %float %148
         %150 = OpLoad %int %i_1
-        %151 = OpIAdd %int %150 %int_1
-               OpStore %i_1 %151
-               OpBranch %124
-        %125 = OpLabel
-        %152 = OpLoad %v3float %c
-        %154 = OpExtInst %v3float %56 FAbs %152
-        %153 = OpExtInst %v3float %56 Normalize %154
-        %155 = OpCompositeExtract %float %153 0
-        %156 = OpCompositeExtract %float %153 1
-        %157 = OpCompositeExtract %float %153 2
-        %158 = OpCompositeConstruct %v4float %155 %156 %157 %float_1
-               OpStore %x_GLF_color %158
+        %151 = OpAccessChain %_ptr_Function_float %c %150
+        %152 = OpLoad %float %151
+        %153 = OpAccessChain %_ptr_Function_float %c %146
+        %154 = OpFMul %float %149 %152
+               OpStore %153 %154
+               OpBranch %144
+        %144 = OpLabel
+               OpBranch %131
+        %131 = OpLabel
+        %155 = OpLoad %int %i_1
+        %156 = OpIAdd %int %155 %int_1
+               OpStore %i_1 %156
+               OpBranch %129
+        %130 = OpLabel
+        %157 = OpLoad %v3float %c
+        %159 = OpExtInst %v3float %56 FAbs %157
+        %158 = OpExtInst %v3float %56 Normalize %159
+        %160 = OpCompositeExtract %float %158 0
+        %161 = OpCompositeExtract %float %158 1
+        %162 = OpCompositeExtract %float %158 2
+        %163 = OpCompositeConstruct %v4float %160 %161 %162 %float_1
+               OpStore %x_GLF_color %163
                OpReturn
                OpFunctionEnd
-%tint_symbol_3 = OpFunction %void None %159
+%tint_symbol_3 = OpFunction %void None %164
 %tint_symbol_1 = OpFunctionParameter %main_out
-        %163 = OpLabel
-        %164 = OpCompositeExtract %v4float %tint_symbol_1 0
-               OpStore %tint_symbol_2 %164
+        %168 = OpLabel
+        %169 = OpCompositeExtract %v4float %tint_symbol_1 0
+               OpStore %tint_symbol_2 %169
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %76
-        %166 = OpLabel
-        %167 = OpLoad %v4float %tint_symbol
-               OpStore %gl_FragCoord %167
-        %168 = OpFunctionCall %void %main_1
-        %170 = OpLoad %v4float %x_GLF_color
-        %171 = OpCompositeConstruct %main_out %170
-        %169 = OpFunctionCall %void %tint_symbol_3 %171
+       %main = OpFunction %void None %81
+        %171 = OpLabel
+        %172 = OpLoad %v4float %tint_symbol
+               OpStore %gl_FragCoord %172
+        %173 = OpFunctionCall %void %main_1
+        %175 = OpLoad %v4float %x_GLF_color
+        %176 = OpCompositeConstruct %main_out %175
+        %174 = OpFunctionCall %void %tint_symbol_3 %176
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.wgsl
index 82eab45..f3b8b01 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.wgsl
@@ -27,7 +27,7 @@
     } else {
       let x_122 : i32 = i;
       let x_124 : f32 = *(thirty_two);
-      if (((f32(x_122) % round(x_124)) <= 0.01)) {
+      if (((f32(x_122) - (round(x_124) * floor((f32(x_122) / round(x_124))))) <= 0.01)) {
         let x_130 : f32 = result;
         result = (x_130 + 100.0);
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.msl
index e209f72..8d2c08a 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -31,7 +29,7 @@
     } else {
       int const x_122 = i;
       float const x_124 = *(thirty_two);
-      if (((float(x_122) % rint(x_124)) <= 0.01f)) {
+      if ((fmod(float(x_122), rint(x_124)) <= 0.01f)) {
         float const x_130 = result;
         result = (x_130 + 100.0f);
       }
@@ -115,8 +113,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\u2a4.0.metal:32:26: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_122) % rint(x_124)) <= 0.01f)) {
-            ~~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.spvasm
index 15ed885..dfc561e 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.spvasm
@@ -126,7 +126,7 @@
          %53 = OpLoad %float %thirty_two
          %54 = OpConvertSToF %float %51
          %55 = OpExtInst %float %56 RoundEven %53
-         %57 = OpFMod %float %54 %55
+         %57 = OpFRem %float %54 %55
          %59 = OpFOrdLessThanEqual %bool %57 %float_0_00999999978
                OpSelectionMerge %60 None
                OpBranchConditional %59 %61 %60
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.hlsl
index 91938cd..645b4dc 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.hlsl
@@ -23,7 +23,7 @@
       } else {
         const int x_136 = i;
         const float x_138 = thirty_two;
-        if (((float(x_136) % round(x_138)) <= 0.01f)) {
+        if (((float(x_136) - (round(x_138) * floor((float(x_136) / round(x_138))))) <= 0.01f)) {
           result = (result + 100.0f);
         }
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.msl
index 6f17012..e87d98f 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -34,7 +32,7 @@
     } else {
       int const x_136 = i;
       float const x_138 = *(thirty_two);
-      if (((float(x_136) % rint(x_138)) <= 0.01f)) {
+      if (((float(x_136) - (rint(x_138) * floor((float(x_136) / rint(x_138))))) <= 0.01f)) {
         float const x_144 = result;
         result = (x_144 + 100.0f);
       }
@@ -128,8 +126,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\u8uo.0.metal:35:26: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_136) % rint(x_138)) <= 0.01f)) {
-            ~~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.spvasm
index 91ba40f..b1caf46 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 186
+; Bound: 191
 ; Schema: 0
                OpCapability Shader
          %59 = OpExtInstImport "GLSL.std.450"
@@ -83,14 +83,14 @@
 %float_0_00999999978 = OpConstant %float 0.00999999978
   %float_100 = OpConstant %float 100
        %void = OpTypeVoid
-         %79 = OpTypeFunction %void
+         %84 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %86 = OpConstantNull %v3float
+         %91 = OpConstantNull %v3float
     %float_7 = OpConstant %float 7
     %float_8 = OpConstant %float 8
     %float_9 = OpConstant %float 9
-         %97 = OpConstantComposite %v3float %float_7 %float_8 %float_9
+        %102 = OpConstantComposite %v3float %float_7 %float_8 %float_9
        %uint = OpTypeInt 32 0
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
@@ -100,7 +100,7 @@
       %int_3 = OpConstant %int 3
     %float_1 = OpConstant %float 1
    %main_out = OpTypeStruct %v4float
-        %173 = OpTypeFunction %void %main_out
+        %178 = OpTypeFunction %void %main_out
 %compute_value_f1_f1_ = OpFunction %float None %18
       %limit = OpFunctionParameter %_ptr_Function_float
  %thirty_two = OpFunctionParameter %_ptr_Function_float
@@ -138,158 +138,163 @@
          %56 = OpLoad %float %thirty_two
          %57 = OpConvertSToF %float %54
          %58 = OpExtInst %float %59 RoundEven %56
-         %60 = OpFMod %float %57 %58
-         %62 = OpFOrdLessThanEqual %bool %60 %float_0_00999999978
-               OpSelectionMerge %63 None
-               OpBranchConditional %62 %64 %63
-         %64 = OpLabel
-         %65 = OpLoad %float %result
-         %67 = OpFAdd %float %65 %float_100
-               OpStore %result %67
-               OpBranch %63
-         %63 = OpLabel
+         %61 = OpConvertSToF %float %54
+         %62 = OpExtInst %float %59 RoundEven %56
+         %63 = OpFDiv %float %61 %62
+         %60 = OpExtInst %float %59 Floor %63
+         %64 = OpFMul %float %58 %60
+         %65 = OpFSub %float %57 %64
+         %67 = OpFOrdLessThanEqual %bool %65 %float_0_00999999978
+               OpSelectionMerge %68 None
+               OpBranchConditional %67 %69 %68
+         %69 = OpLabel
+         %70 = OpLoad %float %result
+         %72 = OpFAdd %float %70 %float_100
+               OpStore %result %72
+               OpBranch %68
+         %68 = OpLabel
                OpBranch %48
          %48 = OpLabel
-         %68 = OpLoad %int %i
-         %70 = OpLoad %float %limit
-         %71 = OpConvertSToF %float %68
-         %72 = OpFOrdGreaterThanEqual %bool %71 %70
-               OpSelectionMerge %73 None
-               OpBranchConditional %72 %74 %73
-         %74 = OpLabel
-         %75 = OpLoad %float %result
-               OpReturnValue %75
-         %73 = OpLabel
+         %73 = OpLoad %int %i
+         %75 = OpLoad %float %limit
+         %76 = OpConvertSToF %float %73
+         %77 = OpFOrdGreaterThanEqual %bool %76 %75
+               OpSelectionMerge %78 None
+               OpBranchConditional %77 %79 %78
+         %79 = OpLabel
+         %80 = OpLoad %float %result
+               OpReturnValue %80
+         %78 = OpLabel
                OpBranch %34
          %34 = OpLabel
-         %76 = OpLoad %int %i
-         %77 = OpIAdd %int %76 %int_1
-               OpStore %i %77
+         %81 = OpLoad %int %i
+         %82 = OpIAdd %int %81 %int_1
+               OpStore %i %82
                OpBranch %32
          %33 = OpLabel
-         %78 = OpLoad %float %result
-               OpReturnValue %78
+         %83 = OpLoad %float %result
+               OpReturnValue %83
                OpFunctionEnd
-     %main_1 = OpFunction %void None %79
-         %82 = OpLabel
-          %c = OpVariable %_ptr_Function_v3float Function %86
+     %main_1 = OpFunction %void None %84
+         %87 = OpLabel
+          %c = OpVariable %_ptr_Function_v3float Function %91
 %thirty_two_1 = OpVariable %_ptr_Function_float Function %25
       %param = OpVariable %_ptr_Function_float Function %25
     %param_1 = OpVariable %_ptr_Function_float Function %25
     %param_2 = OpVariable %_ptr_Function_float Function %25
     %param_3 = OpVariable %_ptr_Function_float Function %25
         %i_1 = OpVariable %_ptr_Function_int Function %29
-       %x_58 = OpVariable %_ptr_Function_v3float Function %86
-               OpStore %c %97
-        %101 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0
-        %102 = OpLoad %float %101
-        %104 = OpFDiv %float %102 %float_8
-        %103 = OpExtInst %float %59 RoundEven %104
-               OpStore %thirty_two_1 %103
-        %106 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
+       %x_58 = OpVariable %_ptr_Function_v3float Function %91
+               OpStore %c %102
+        %106 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0
         %107 = OpLoad %float %106
-               OpStore %param %107
-        %108 = OpLoad %float %thirty_two_1
-               OpStore %param_1 %108
-        %109 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
-        %112 = OpAccessChain %_ptr_Function_float %c %uint_0
-               OpStore %112 %109
-        %114 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %115 = OpLoad %float %114
-               OpStore %param_2 %115
-        %116 = OpLoad %float %thirty_two_1
-               OpStore %param_3 %116
-        %117 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
-        %120 = OpAccessChain %_ptr_Function_float %c %uint_1
-               OpStore %120 %117
-        %121 = OpAccessChain %_ptr_Function_float %c %uint_0
-        %122 = OpLoad %float %121
-        %123 = OpAccessChain %_ptr_Function_float %c %uint_1
-        %124 = OpLoad %float %123
-        %126 = OpAccessChain %_ptr_Function_float %c %uint_2
-        %127 = OpFAdd %float %122 %124
-               OpStore %126 %127
+        %109 = OpFDiv %float %107 %float_8
+        %108 = OpExtInst %float %59 RoundEven %109
+               OpStore %thirty_two_1 %108
+        %111 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
+        %112 = OpLoad %float %111
+               OpStore %param %112
+        %113 = OpLoad %float %thirty_two_1
+               OpStore %param_1 %113
+        %114 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
+        %117 = OpAccessChain %_ptr_Function_float %c %uint_0
+               OpStore %117 %114
+        %119 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %120 = OpLoad %float %119
+               OpStore %param_2 %120
+        %121 = OpLoad %float %thirty_two_1
+               OpStore %param_3 %121
+        %122 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
+        %125 = OpAccessChain %_ptr_Function_float %c %uint_1
+               OpStore %125 %122
+        %126 = OpAccessChain %_ptr_Function_float %c %uint_0
+        %127 = OpLoad %float %126
+        %128 = OpAccessChain %_ptr_Function_float %c %uint_1
+        %129 = OpLoad %float %128
+        %131 = OpAccessChain %_ptr_Function_float %c %uint_2
+        %132 = OpFAdd %float %127 %129
+               OpStore %131 %132
                OpStore %i_1 %int_0
-               OpBranch %128
-        %128 = OpLabel
-               OpLoopMerge %129 %130 None
-               OpBranch %131
-        %131 = OpLabel
-        %132 = OpLoad %int %i_1
-        %134 = OpSLessThan %bool %132 %int_3
-               OpSelectionMerge %135 None
-               OpBranchConditional %134 %136 %137
+               OpBranch %133
+        %133 = OpLabel
+               OpLoopMerge %134 %135 None
+               OpBranch %136
         %136 = OpLabel
-               OpBranch %135
-        %137 = OpLabel
-               OpBranch %129
-        %135 = OpLabel
-        %138 = OpLoad %int %i_1
-        %139 = OpAccessChain %_ptr_Function_float %c %138
-        %140 = OpLoad %float %139
-        %142 = OpFOrdGreaterThanEqual %bool %140 %float_1
-               OpSelectionMerge %143 None
-               OpBranchConditional %142 %144 %143
-        %144 = OpLabel
-        %145 = OpLoad %int %i_1
-        %146 = OpLoad %int %i_1
-        %147 = OpAccessChain %_ptr_Function_float %c %146
-        %148 = OpLoad %float %147
-        %149 = OpLoad %int %i_1
-        %150 = OpAccessChain %_ptr_Function_float %c %149
-        %151 = OpLoad %float %150
-        %152 = OpAccessChain %_ptr_Function_float %c %145
-        %153 = OpFMul %float %148 %151
-               OpStore %152 %153
-               OpBranch %143
-        %143 = OpLabel
-               OpBranch %130
-        %130 = OpLabel
+        %137 = OpLoad %int %i_1
+        %139 = OpSLessThan %bool %137 %int_3
+               OpSelectionMerge %140 None
+               OpBranchConditional %139 %141 %142
+        %141 = OpLabel
+               OpBranch %140
+        %142 = OpLabel
+               OpBranch %134
+        %140 = OpLabel
+        %143 = OpLoad %int %i_1
+        %144 = OpAccessChain %_ptr_Function_float %c %143
+        %145 = OpLoad %float %144
+        %147 = OpFOrdGreaterThanEqual %bool %145 %float_1
+               OpSelectionMerge %148 None
+               OpBranchConditional %147 %149 %148
+        %149 = OpLabel
+        %150 = OpLoad %int %i_1
+        %151 = OpLoad %int %i_1
+        %152 = OpAccessChain %_ptr_Function_float %c %151
+        %153 = OpLoad %float %152
         %154 = OpLoad %int %i_1
-        %155 = OpIAdd %int %154 %int_1
-               OpStore %i_1 %155
-               OpBranch %128
-        %129 = OpLabel
-        %156 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_0
-        %157 = OpLoad %float %156
-        %158 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_1
-        %159 = OpLoad %float %158
-        %160 = OpFOrdLessThan %bool %157 %159
-               OpSelectionMerge %161 None
-               OpBranchConditional %160 %162 %163
-        %162 = OpLabel
-        %164 = OpLoad %v3float %c
-        %165 = OpExtInst %v3float %59 FAbs %164
-               OpStore %x_58 %165
-               OpBranch %161
-        %163 = OpLabel
-        %166 = OpLoad %v3float %c
-               OpStore %x_58 %166
-               OpBranch %161
-        %161 = OpLabel
-        %167 = OpLoad %v3float %x_58
-        %168 = OpExtInst %v3float %59 Normalize %167
-        %169 = OpCompositeExtract %float %168 0
-        %170 = OpCompositeExtract %float %168 1
-        %171 = OpCompositeExtract %float %168 2
-        %172 = OpCompositeConstruct %v4float %169 %170 %171 %float_1
-               OpStore %x_GLF_color %172
+        %155 = OpAccessChain %_ptr_Function_float %c %154
+        %156 = OpLoad %float %155
+        %157 = OpAccessChain %_ptr_Function_float %c %150
+        %158 = OpFMul %float %153 %156
+               OpStore %157 %158
+               OpBranch %148
+        %148 = OpLabel
+               OpBranch %135
+        %135 = OpLabel
+        %159 = OpLoad %int %i_1
+        %160 = OpIAdd %int %159 %int_1
+               OpStore %i_1 %160
+               OpBranch %133
+        %134 = OpLabel
+        %161 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_0
+        %162 = OpLoad %float %161
+        %163 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_1
+        %164 = OpLoad %float %163
+        %165 = OpFOrdLessThan %bool %162 %164
+               OpSelectionMerge %166 None
+               OpBranchConditional %165 %167 %168
+        %167 = OpLabel
+        %169 = OpLoad %v3float %c
+        %170 = OpExtInst %v3float %59 FAbs %169
+               OpStore %x_58 %170
+               OpBranch %166
+        %168 = OpLabel
+        %171 = OpLoad %v3float %c
+               OpStore %x_58 %171
+               OpBranch %166
+        %166 = OpLabel
+        %172 = OpLoad %v3float %x_58
+        %173 = OpExtInst %v3float %59 Normalize %172
+        %174 = OpCompositeExtract %float %173 0
+        %175 = OpCompositeExtract %float %173 1
+        %176 = OpCompositeExtract %float %173 2
+        %177 = OpCompositeConstruct %v4float %174 %175 %176 %float_1
+               OpStore %x_GLF_color %177
                OpReturn
                OpFunctionEnd
-%tint_symbol_3 = OpFunction %void None %173
+%tint_symbol_3 = OpFunction %void None %178
 %tint_symbol_1 = OpFunctionParameter %main_out
-        %177 = OpLabel
-        %178 = OpCompositeExtract %v4float %tint_symbol_1 0
-               OpStore %tint_symbol_2 %178
+        %182 = OpLabel
+        %183 = OpCompositeExtract %v4float %tint_symbol_1 0
+               OpStore %tint_symbol_2 %183
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %79
-        %180 = OpLabel
-        %181 = OpLoad %v4float %tint_symbol
-               OpStore %gl_FragCoord %181
-        %182 = OpFunctionCall %void %main_1
-        %184 = OpLoad %v4float %x_GLF_color
-        %185 = OpCompositeConstruct %main_out %184
-        %183 = OpFunctionCall %void %tint_symbol_3 %185
+       %main = OpFunction %void None %84
+        %185 = OpLabel
+        %186 = OpLoad %v4float %tint_symbol
+               OpStore %gl_FragCoord %186
+        %187 = OpFunctionCall %void %main_1
+        %189 = OpLoad %v4float %x_GLF_color
+        %190 = OpCompositeConstruct %main_out %189
+        %188 = OpFunctionCall %void %tint_symbol_3 %190
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.wgsl
index 60de1ab..b3b5f7c 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.wgsl
@@ -34,7 +34,7 @@
     } else {
       let x_136 : i32 = i;
       let x_138 : f32 = *(thirty_two);
-      if (((f32(x_136) % round(x_138)) <= 0.01)) {
+      if (((f32(x_136) - (round(x_138) * floor((f32(x_136) / round(x_138))))) <= 0.01)) {
         let x_144 : f32 = result;
         result = (x_144 + 100.0);
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.msl
index d03ce1e..2877362 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -34,7 +32,7 @@
     } else {
       int const x_136 = i;
       float const x_138 = *(thirty_two);
-      if (((float(x_136) % rint(x_138)) <= 0.01f)) {
+      if ((fmod(float(x_136), rint(x_138)) <= 0.01f)) {
         float const x_144 = result;
         result = (x_144 + 100.0f);
       }
@@ -128,8 +126,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\uf2s.0.metal:35:26: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_136) % rint(x_138)) <= 0.01f)) {
-            ~~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.spvasm
index 91ba40f..8fe03c2 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.spvasm
@@ -138,7 +138,7 @@
          %56 = OpLoad %float %thirty_two
          %57 = OpConvertSToF %float %54
          %58 = OpExtInst %float %59 RoundEven %56
-         %60 = OpFMod %float %57 %58
+         %60 = OpFRem %float %57 %58
          %62 = OpFOrdLessThanEqual %bool %60 %float_0_00999999978
                OpSelectionMerge %63 None
                OpBranchConditional %62 %64 %63
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.hlsl
index 125f7d9..d2c43f1 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.hlsl
@@ -33,7 +33,7 @@
     } else {
       const float x_106 = thirty_two;
       x_113_phi = x_91;
-      if (((float(x_94) % round(x_106)) <= 0.01f)) {
+      if (((float(x_94) - (round(x_106) * floor((float(x_94) / round(x_106))))) <= 0.01f)) {
         x_112 = (x_91 + 100.0f);
         x_113_phi = x_112;
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.msl
index 798c221..27db58e 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -38,7 +36,7 @@
     } else {
       float const x_106 = *(thirty_two);
       x_113_phi = x_91;
-      if (((float(x_94) % rint(x_106)) <= 0.01f)) {
+      if (((float(x_94) - (rint(x_106) * floor((float(x_94) / rint(x_106))))) <= 0.01f)) {
         x_112 = (x_91 + 100.0f);
         x_113_phi = x_112;
       }
@@ -119,8 +117,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\u26w.0.metal:39:25: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_94) % rint(x_106)) <= 0.01f)) {
-            ~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.spvasm
index 42303b9..a7cfea1 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 180
+; Bound: 185
 ; Schema: 0
                OpCapability Shader
          %64 = OpExtInstImport "GLSL.std.450"
@@ -79,14 +79,14 @@
 %float_0_00999999978 = OpConstant %float 0.00999999978
   %float_100 = OpConstant %float 100
        %void = OpTypeVoid
-         %89 = OpTypeFunction %void
+         %94 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %96 = OpConstantNull %v3float
+        %101 = OpConstantNull %v3float
     %float_7 = OpConstant %float 7
     %float_8 = OpConstant %float 8
     %float_9 = OpConstant %float 9
-        %105 = OpConstantComposite %v3float %float_7 %float_8 %float_9
+        %110 = OpConstantComposite %v3float %float_7 %float_8 %float_9
        %uint = OpTypeInt 32 0
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
@@ -97,7 +97,7 @@
       %int_3 = OpConstant %int 3
     %float_1 = OpConstant %float 1
    %main_out = OpTypeStruct %v4float
-        %167 = OpTypeFunction %void %main_out
+        %172 = OpTypeFunction %void %main_out
 %compute_value_f1_f1_ = OpFunction %float None %15
       %limit = OpFunctionParameter %_ptr_Function_float
  %thirty_two = OpFunctionParameter %_ptr_Function_float
@@ -147,145 +147,150 @@
                OpStore %x_113_phi %61
          %62 = OpConvertSToF %float %39
          %63 = OpExtInst %float %64 RoundEven %60
-         %65 = OpFMod %float %62 %63
-         %67 = OpFOrdLessThanEqual %bool %65 %float_0_00999999978
-               OpSelectionMerge %68 None
-               OpBranchConditional %67 %69 %68
-         %69 = OpLabel
-         %70 = OpLoad %float %x_91
-         %72 = OpFAdd %float %70 %float_100
-               OpStore %x_112 %72
-         %73 = OpLoad %float %x_112
-               OpStore %x_113_phi %73
-               OpBranch %68
-         %68 = OpLabel
-         %74 = OpLoad %float %x_113_phi
-               OpStore %x_113 %74
-         %75 = OpLoad %float %x_113
-               OpStore %x_92_phi %75
+         %66 = OpConvertSToF %float %39
+         %67 = OpExtInst %float %64 RoundEven %60
+         %68 = OpFDiv %float %66 %67
+         %65 = OpExtInst %float %64 Floor %68
+         %69 = OpFMul %float %63 %65
+         %70 = OpFSub %float %62 %69
+         %72 = OpFOrdLessThanEqual %bool %70 %float_0_00999999978
+               OpSelectionMerge %73 None
+               OpBranchConditional %72 %74 %73
+         %74 = OpLabel
+         %75 = OpLoad %float %x_91
+         %77 = OpFAdd %float %75 %float_100
+               OpStore %x_112 %77
+         %78 = OpLoad %float %x_112
+               OpStore %x_113_phi %78
+               OpBranch %73
+         %73 = OpLabel
+         %79 = OpLoad %float %x_113_phi
+               OpStore %x_113 %79
+         %80 = OpLoad %float %x_113
+               OpStore %x_92_phi %80
                OpBranch %52
          %52 = OpLabel
-         %77 = OpLoad %float %x_92_phi
-               OpStore %x_92 %77
-         %79 = OpLoad %float %limit
-         %80 = OpConvertSToF %float %39
-         %81 = OpFOrdGreaterThanEqual %bool %80 %79
-               OpSelectionMerge %82 None
-               OpBranchConditional %81 %83 %82
-         %83 = OpLabel
-         %84 = OpLoad %float %x_92
-               OpReturnValue %84
-         %82 = OpLabel
+         %82 = OpLoad %float %x_92_phi
+               OpStore %x_92 %82
+         %84 = OpLoad %float %limit
+         %85 = OpConvertSToF %float %39
+         %86 = OpFOrdGreaterThanEqual %bool %85 %84
+               OpSelectionMerge %87 None
+               OpBranchConditional %86 %88 %87
+         %88 = OpLabel
+         %89 = OpLoad %float %x_92
+               OpReturnValue %89
+         %87 = OpLabel
                OpBranch %32
          %32 = OpLabel
-         %85 = OpIAdd %int %39 %int_1
-               OpStore %x_95 %85
-         %86 = OpLoad %float %x_92
-               OpStore %x_91_phi %86
-         %87 = OpLoad %int %x_95
-               OpStore %x_94_phi %87
+         %90 = OpIAdd %int %39 %int_1
+               OpStore %x_95 %90
+         %91 = OpLoad %float %x_92
+               OpStore %x_91_phi %91
+         %92 = OpLoad %int %x_95
+               OpStore %x_94_phi %92
                OpBranch %30
          %31 = OpLabel
-         %88 = OpLoad %float %x_91
-               OpReturnValue %88
+         %93 = OpLoad %float %x_91
+               OpReturnValue %93
                OpFunctionEnd
-     %main_1 = OpFunction %void None %89
-         %92 = OpLabel
-          %c = OpVariable %_ptr_Function_v3float Function %96
+     %main_1 = OpFunction %void None %94
+         %97 = OpLabel
+          %c = OpVariable %_ptr_Function_v3float Function %101
       %param = OpVariable %_ptr_Function_float Function %22
     %param_1 = OpVariable %_ptr_Function_float Function %22
     %param_2 = OpVariable %_ptr_Function_float Function %22
     %param_3 = OpVariable %_ptr_Function_float Function %22
    %x_68_phi = OpVariable %_ptr_Function_int Function %27
        %x_69 = OpVariable %_ptr_Function_int Function %27
-               OpStore %c %105
-        %109 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0
-        %110 = OpLoad %float %109
-        %113 = OpFMul %float %110 %float_0_125
-        %111 = OpExtInst %float %64 RoundEven %113
-        %115 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
-        %116 = OpLoad %float %115
-               OpStore %param %116
-               OpStore %param_1 %111
-        %117 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
-        %120 = OpAccessChain %_ptr_Function_float %c %uint_0
-               OpStore %120 %117
-        %122 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %123 = OpLoad %float %122
-               OpStore %param_2 %123
-               OpStore %param_3 %111
-        %124 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
-        %127 = OpAccessChain %_ptr_Function_float %c %uint_1
-               OpStore %127 %124
-        %128 = OpAccessChain %_ptr_Function_float %c %uint_0
-        %129 = OpLoad %float %128
-        %130 = OpAccessChain %_ptr_Function_float %c %uint_1
-        %131 = OpLoad %float %130
-        %133 = OpAccessChain %_ptr_Function_float %c %uint_2
-        %134 = OpFAdd %float %129 %131
-               OpStore %133 %134
+               OpStore %c %110
+        %114 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0
+        %115 = OpLoad %float %114
+        %118 = OpFMul %float %115 %float_0_125
+        %116 = OpExtInst %float %64 RoundEven %118
+        %120 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
+        %121 = OpLoad %float %120
+               OpStore %param %121
+               OpStore %param_1 %116
+        %122 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
+        %125 = OpAccessChain %_ptr_Function_float %c %uint_0
+               OpStore %125 %122
+        %127 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %128 = OpLoad %float %127
+               OpStore %param_2 %128
+               OpStore %param_3 %116
+        %129 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
+        %132 = OpAccessChain %_ptr_Function_float %c %uint_1
+               OpStore %132 %129
+        %133 = OpAccessChain %_ptr_Function_float %c %uint_0
+        %134 = OpLoad %float %133
+        %135 = OpAccessChain %_ptr_Function_float %c %uint_1
+        %136 = OpLoad %float %135
+        %138 = OpAccessChain %_ptr_Function_float %c %uint_2
+        %139 = OpFAdd %float %134 %136
+               OpStore %138 %139
                OpStore %x_68_phi %int_0
-               OpBranch %135
-        %135 = OpLabel
-               OpLoopMerge %136 %137 None
-               OpBranch %138
-        %138 = OpLabel
-        %140 = OpLoad %int %x_68_phi
-        %142 = OpSLessThan %bool %140 %int_3
-               OpSelectionMerge %143 None
-               OpBranchConditional %142 %144 %145
-        %144 = OpLabel
+               OpBranch %140
+        %140 = OpLabel
+               OpLoopMerge %141 %142 None
                OpBranch %143
-        %145 = OpLabel
-               OpBranch %136
         %143 = OpLabel
-        %146 = OpAccessChain %_ptr_Function_float %c %140
-        %147 = OpLoad %float %146
-        %149 = OpFOrdGreaterThanEqual %bool %147 %float_1
-               OpSelectionMerge %150 None
-               OpBranchConditional %149 %151 %150
-        %151 = OpLabel
-        %152 = OpAccessChain %_ptr_Function_float %c %140
-        %153 = OpLoad %float %152
-        %154 = OpAccessChain %_ptr_Function_float %c %140
-        %155 = OpLoad %float %154
-        %156 = OpAccessChain %_ptr_Function_float %c %140
-        %157 = OpFMul %float %153 %155
-               OpStore %156 %157
-               OpBranch %150
+        %145 = OpLoad %int %x_68_phi
+        %147 = OpSLessThan %bool %145 %int_3
+               OpSelectionMerge %148 None
+               OpBranchConditional %147 %149 %150
+        %149 = OpLabel
+               OpBranch %148
         %150 = OpLabel
-               OpBranch %137
-        %137 = OpLabel
-        %158 = OpIAdd %int %140 %int_1
-               OpStore %x_69 %158
-        %159 = OpLoad %int %x_69
-               OpStore %x_68_phi %159
-               OpBranch %135
-        %136 = OpLabel
-        %160 = OpLoad %v3float %c
-        %162 = OpExtInst %v3float %64 FAbs %160
-        %161 = OpExtInst %v3float %64 Normalize %162
-        %163 = OpCompositeExtract %float %161 0
-        %164 = OpCompositeExtract %float %161 1
-        %165 = OpCompositeExtract %float %161 2
-        %166 = OpCompositeConstruct %v4float %163 %164 %165 %float_1
-               OpStore %x_GLF_color %166
+               OpBranch %141
+        %148 = OpLabel
+        %151 = OpAccessChain %_ptr_Function_float %c %145
+        %152 = OpLoad %float %151
+        %154 = OpFOrdGreaterThanEqual %bool %152 %float_1
+               OpSelectionMerge %155 None
+               OpBranchConditional %154 %156 %155
+        %156 = OpLabel
+        %157 = OpAccessChain %_ptr_Function_float %c %145
+        %158 = OpLoad %float %157
+        %159 = OpAccessChain %_ptr_Function_float %c %145
+        %160 = OpLoad %float %159
+        %161 = OpAccessChain %_ptr_Function_float %c %145
+        %162 = OpFMul %float %158 %160
+               OpStore %161 %162
+               OpBranch %155
+        %155 = OpLabel
+               OpBranch %142
+        %142 = OpLabel
+        %163 = OpIAdd %int %145 %int_1
+               OpStore %x_69 %163
+        %164 = OpLoad %int %x_69
+               OpStore %x_68_phi %164
+               OpBranch %140
+        %141 = OpLabel
+        %165 = OpLoad %v3float %c
+        %167 = OpExtInst %v3float %64 FAbs %165
+        %166 = OpExtInst %v3float %64 Normalize %167
+        %168 = OpCompositeExtract %float %166 0
+        %169 = OpCompositeExtract %float %166 1
+        %170 = OpCompositeExtract %float %166 2
+        %171 = OpCompositeConstruct %v4float %168 %169 %170 %float_1
+               OpStore %x_GLF_color %171
                OpReturn
                OpFunctionEnd
-%tint_symbol_3 = OpFunction %void None %167
+%tint_symbol_3 = OpFunction %void None %172
 %tint_symbol_1 = OpFunctionParameter %main_out
-        %171 = OpLabel
-        %172 = OpCompositeExtract %v4float %tint_symbol_1 0
-               OpStore %tint_symbol_2 %172
+        %176 = OpLabel
+        %177 = OpCompositeExtract %v4float %tint_symbol_1 0
+               OpStore %tint_symbol_2 %177
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %89
-        %174 = OpLabel
-        %175 = OpLoad %v4float %tint_symbol
-               OpStore %gl_FragCoord %175
-        %176 = OpFunctionCall %void %main_1
-        %178 = OpLoad %v4float %x_GLF_color
-        %179 = OpCompositeConstruct %main_out %178
-        %177 = OpFunctionCall %void %tint_symbol_3 %179
+       %main = OpFunction %void None %94
+        %179 = OpLabel
+        %180 = OpLoad %v4float %tint_symbol
+               OpStore %gl_FragCoord %180
+        %181 = OpFunctionCall %void %main_1
+        %183 = OpLoad %v4float %x_GLF_color
+        %184 = OpCompositeConstruct %main_out %183
+        %182 = OpFunctionCall %void %tint_symbol_3 %184
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.wgsl
index ba37d91..5452729 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.wgsl
@@ -34,7 +34,7 @@
     } else {
       let x_106 : f32 = *(thirty_two);
       x_113_phi = x_91;
-      if (((f32(x_94) % round(x_106)) <= 0.01)) {
+      if (((f32(x_94) - (round(x_106) * floor((f32(x_94) / round(x_106))))) <= 0.01)) {
         x_112 = (x_91 + 100.0);
         x_113_phi = x_112;
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.msl
index 5ee750f..bd3bd6f 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -38,7 +36,7 @@
     } else {
       float const x_106 = *(thirty_two);
       x_113_phi = x_91;
-      if (((float(x_94) % rint(x_106)) <= 0.01f)) {
+      if ((fmod(float(x_94), rint(x_106)) <= 0.01f)) {
         x_112 = (x_91 + 100.0f);
         x_113_phi = x_112;
       }
@@ -119,8 +117,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\u8cs.0.metal:39:25: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_94) % rint(x_106)) <= 0.01f)) {
-            ~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.spvasm
index 42303b9..f1e2c9b 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.spvasm
@@ -147,7 +147,7 @@
                OpStore %x_113_phi %61
          %62 = OpConvertSToF %float %39
          %63 = OpExtInst %float %64 RoundEven %60
-         %65 = OpFMod %float %62 %63
+         %65 = OpFRem %float %62 %63
          %67 = OpFOrdLessThanEqual %bool %65 %float_0_00999999978
                OpSelectionMerge %68 None
                OpBranchConditional %67 %69 %68
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.hlsl
index 3a417df..32ea2b3 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.hlsl
@@ -36,7 +36,7 @@
     } else {
       const float x_118 = thirty_two;
       x_125_phi = x_104;
-      if (((float(x_107) % round(x_118)) <= 0.01f)) {
+      if (((float(x_107) - (round(x_118) * floor((float(x_107) / round(x_118))))) <= 0.01f)) {
         x_124 = (x_104 + 100.0f);
         x_125_phi = x_124;
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.msl
index 45c08ae..a314658 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -41,7 +39,7 @@
     } else {
       float const x_118 = *(thirty_two);
       x_125_phi = x_104;
-      if (((float(x_107) % rint(x_118)) <= 0.01f)) {
+      if (((float(x_107) - (rint(x_118) * floor((float(x_107) / rint(x_118))))) <= 0.01f)) {
         x_124 = (x_104 + 100.0f);
         x_125_phi = x_124;
       }
@@ -130,8 +128,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\ufno.0.metal:42:26: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_107) % rint(x_118)) <= 0.01f)) {
-            ~~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.spvasm
index d622545..cc78cd7 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 192
+; Bound: 197
 ; Schema: 0
                OpCapability Shader
          %67 = OpExtInstImport "GLSL.std.450"
@@ -91,14 +91,14 @@
 %float_0_00999999978 = OpConstant %float 0.00999999978
   %float_100 = OpConstant %float 100
        %void = OpTypeVoid
-         %92 = OpTypeFunction %void
+         %97 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %99 = OpConstantNull %v3float
+        %104 = OpConstantNull %v3float
     %float_7 = OpConstant %float 7
     %float_8 = OpConstant %float 8
     %float_9 = OpConstant %float 9
-        %109 = OpConstantComposite %v3float %float_7 %float_8 %float_9
+        %114 = OpConstantComposite %v3float %float_7 %float_8 %float_9
        %uint = OpTypeInt 32 0
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
@@ -109,7 +109,7 @@
       %int_3 = OpConstant %int 3
     %float_1 = OpConstant %float 1
    %main_out = OpTypeStruct %v4float
-        %179 = OpTypeFunction %void %main_out
+        %184 = OpTypeFunction %void %main_out
 %compute_value_f1_f1_ = OpFunction %float None %18
       %limit = OpFunctionParameter %_ptr_Function_float
  %thirty_two = OpFunctionParameter %_ptr_Function_float
@@ -159,158 +159,163 @@
                OpStore %x_125_phi %64
          %65 = OpConvertSToF %float %42
          %66 = OpExtInst %float %67 RoundEven %63
-         %68 = OpFMod %float %65 %66
-         %70 = OpFOrdLessThanEqual %bool %68 %float_0_00999999978
-               OpSelectionMerge %71 None
-               OpBranchConditional %70 %72 %71
-         %72 = OpLabel
-         %73 = OpLoad %float %x_104
-         %75 = OpFAdd %float %73 %float_100
-               OpStore %x_124 %75
-         %76 = OpLoad %float %x_124
-               OpStore %x_125_phi %76
-               OpBranch %71
-         %71 = OpLabel
-         %77 = OpLoad %float %x_125_phi
-               OpStore %x_125 %77
-         %78 = OpLoad %float %x_125
-               OpStore %x_105_phi %78
+         %69 = OpConvertSToF %float %42
+         %70 = OpExtInst %float %67 RoundEven %63
+         %71 = OpFDiv %float %69 %70
+         %68 = OpExtInst %float %67 Floor %71
+         %72 = OpFMul %float %66 %68
+         %73 = OpFSub %float %65 %72
+         %75 = OpFOrdLessThanEqual %bool %73 %float_0_00999999978
+               OpSelectionMerge %76 None
+               OpBranchConditional %75 %77 %76
+         %77 = OpLabel
+         %78 = OpLoad %float %x_104
+         %80 = OpFAdd %float %78 %float_100
+               OpStore %x_124 %80
+         %81 = OpLoad %float %x_124
+               OpStore %x_125_phi %81
+               OpBranch %76
+         %76 = OpLabel
+         %82 = OpLoad %float %x_125_phi
+               OpStore %x_125 %82
+         %83 = OpLoad %float %x_125
+               OpStore %x_105_phi %83
                OpBranch %55
          %55 = OpLabel
-         %80 = OpLoad %float %x_105_phi
-               OpStore %x_105 %80
-         %82 = OpLoad %float %limit
-         %83 = OpConvertSToF %float %42
-         %84 = OpFOrdGreaterThanEqual %bool %83 %82
-               OpSelectionMerge %85 None
-               OpBranchConditional %84 %86 %85
-         %86 = OpLabel
-         %87 = OpLoad %float %x_105
-               OpReturnValue %87
-         %85 = OpLabel
+         %85 = OpLoad %float %x_105_phi
+               OpStore %x_105 %85
+         %87 = OpLoad %float %limit
+         %88 = OpConvertSToF %float %42
+         %89 = OpFOrdGreaterThanEqual %bool %88 %87
+               OpSelectionMerge %90 None
+               OpBranchConditional %89 %91 %90
+         %91 = OpLabel
+         %92 = OpLoad %float %x_105
+               OpReturnValue %92
+         %90 = OpLabel
                OpBranch %35
          %35 = OpLabel
-         %88 = OpIAdd %int %42 %int_1
-               OpStore %x_108 %88
-         %89 = OpLoad %float %x_105
-               OpStore %x_104_phi %89
-         %90 = OpLoad %int %x_108
-               OpStore %x_107_phi %90
+         %93 = OpIAdd %int %42 %int_1
+               OpStore %x_108 %93
+         %94 = OpLoad %float %x_105
+               OpStore %x_104_phi %94
+         %95 = OpLoad %int %x_108
+               OpStore %x_107_phi %95
                OpBranch %33
          %34 = OpLabel
-         %91 = OpLoad %float %x_104
-               OpReturnValue %91
+         %96 = OpLoad %float %x_104
+               OpReturnValue %96
                OpFunctionEnd
-     %main_1 = OpFunction %void None %92
-         %95 = OpLabel
-          %c = OpVariable %_ptr_Function_v3float Function %99
+     %main_1 = OpFunction %void None %97
+        %100 = OpLabel
+          %c = OpVariable %_ptr_Function_v3float Function %104
       %param = OpVariable %_ptr_Function_float Function %25
     %param_1 = OpVariable %_ptr_Function_float Function %25
     %param_2 = OpVariable %_ptr_Function_float Function %25
     %param_3 = OpVariable %_ptr_Function_float Function %25
-       %x_54 = OpVariable %_ptr_Function_v3float Function %99
+       %x_54 = OpVariable %_ptr_Function_v3float Function %104
    %x_74_phi = OpVariable %_ptr_Function_int Function %30
        %x_75 = OpVariable %_ptr_Function_int Function %30
-               OpStore %c %109
-        %113 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0
-        %114 = OpLoad %float %113
-        %117 = OpFMul %float %114 %float_0_125
-        %115 = OpExtInst %float %67 RoundEven %117
-        %119 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
-        %120 = OpLoad %float %119
-               OpStore %param %120
-               OpStore %param_1 %115
-        %121 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
-        %124 = OpAccessChain %_ptr_Function_float %c %uint_0
-               OpStore %124 %121
-        %126 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %127 = OpLoad %float %126
-               OpStore %param_2 %127
-               OpStore %param_3 %115
-        %128 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
-        %131 = OpAccessChain %_ptr_Function_float %c %uint_1
-               OpStore %131 %128
-        %132 = OpAccessChain %_ptr_Function_float %c %uint_0
-        %133 = OpLoad %float %132
-        %134 = OpLoad %v3float %c
-               OpStore %x_54 %134
-        %135 = OpAccessChain %_ptr_Function_float %x_54 %uint_1
-        %136 = OpLoad %float %135
-        %138 = OpAccessChain %_ptr_Function_float %c %uint_2
-        %139 = OpFAdd %float %133 %136
-               OpStore %138 %139
+               OpStore %c %114
+        %118 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0
+        %119 = OpLoad %float %118
+        %122 = OpFMul %float %119 %float_0_125
+        %120 = OpExtInst %float %67 RoundEven %122
+        %124 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
+        %125 = OpLoad %float %124
+               OpStore %param %125
+               OpStore %param_1 %120
+        %126 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
+        %129 = OpAccessChain %_ptr_Function_float %c %uint_0
+               OpStore %129 %126
+        %131 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %132 = OpLoad %float %131
+               OpStore %param_2 %132
+               OpStore %param_3 %120
+        %133 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
+        %136 = OpAccessChain %_ptr_Function_float %c %uint_1
+               OpStore %136 %133
+        %137 = OpAccessChain %_ptr_Function_float %c %uint_0
+        %138 = OpLoad %float %137
+        %139 = OpLoad %v3float %c
+               OpStore %x_54 %139
+        %140 = OpAccessChain %_ptr_Function_float %x_54 %uint_1
+        %141 = OpLoad %float %140
+        %143 = OpAccessChain %_ptr_Function_float %c %uint_2
+        %144 = OpFAdd %float %138 %141
+               OpStore %143 %144
                OpStore %x_74_phi %int_0
-               OpBranch %140
-        %140 = OpLabel
-               OpLoopMerge %141 %142 None
-               OpBranch %143
-        %143 = OpLabel
-        %145 = OpLoad %int %x_74_phi
-        %147 = OpSLessThan %bool %145 %int_3
-               OpSelectionMerge %148 None
-               OpBranchConditional %147 %149 %150
-        %149 = OpLabel
+               OpBranch %145
+        %145 = OpLabel
+               OpLoopMerge %146 %147 None
                OpBranch %148
-        %150 = OpLabel
-               OpBranch %141
         %148 = OpLabel
-        %151 = OpAccessChain %_ptr_Function_float %c %145
-        %152 = OpLoad %float %151
-        %154 = OpFOrdGreaterThanEqual %bool %152 %float_1
-               OpSelectionMerge %155 None
-               OpBranchConditional %154 %156 %155
-        %156 = OpLabel
-        %157 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0
-        %158 = OpLoad %float %157
-        %159 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1
-        %160 = OpLoad %float %159
-        %161 = OpFOrdGreaterThan %bool %158 %160
-               OpSelectionMerge %162 None
-               OpBranchConditional %161 %163 %162
-        %163 = OpLabel
-               OpKill
-        %162 = OpLabel
-        %164 = OpAccessChain %_ptr_Function_float %c %145
-        %165 = OpLoad %float %164
-        %166 = OpAccessChain %_ptr_Function_float %c %145
-        %167 = OpLoad %float %166
-        %168 = OpAccessChain %_ptr_Function_float %c %145
-        %169 = OpFMul %float %165 %167
-               OpStore %168 %169
-               OpBranch %155
+        %150 = OpLoad %int %x_74_phi
+        %152 = OpSLessThan %bool %150 %int_3
+               OpSelectionMerge %153 None
+               OpBranchConditional %152 %154 %155
+        %154 = OpLabel
+               OpBranch %153
         %155 = OpLabel
-               OpBranch %142
-        %142 = OpLabel
-        %170 = OpIAdd %int %145 %int_1
-               OpStore %x_75 %170
-        %171 = OpLoad %int %x_75
-               OpStore %x_74_phi %171
-               OpBranch %140
-        %141 = OpLabel
-        %172 = OpLoad %v3float %c
-        %174 = OpExtInst %v3float %67 FAbs %172
-        %173 = OpExtInst %v3float %67 Normalize %174
-        %175 = OpCompositeExtract %float %173 0
-        %176 = OpCompositeExtract %float %173 1
-        %177 = OpCompositeExtract %float %173 2
-        %178 = OpCompositeConstruct %v4float %175 %176 %177 %float_1
-               OpStore %x_GLF_color %178
+               OpBranch %146
+        %153 = OpLabel
+        %156 = OpAccessChain %_ptr_Function_float %c %150
+        %157 = OpLoad %float %156
+        %159 = OpFOrdGreaterThanEqual %bool %157 %float_1
+               OpSelectionMerge %160 None
+               OpBranchConditional %159 %161 %160
+        %161 = OpLabel
+        %162 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0
+        %163 = OpLoad %float %162
+        %164 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1
+        %165 = OpLoad %float %164
+        %166 = OpFOrdGreaterThan %bool %163 %165
+               OpSelectionMerge %167 None
+               OpBranchConditional %166 %168 %167
+        %168 = OpLabel
+               OpKill
+        %167 = OpLabel
+        %169 = OpAccessChain %_ptr_Function_float %c %150
+        %170 = OpLoad %float %169
+        %171 = OpAccessChain %_ptr_Function_float %c %150
+        %172 = OpLoad %float %171
+        %173 = OpAccessChain %_ptr_Function_float %c %150
+        %174 = OpFMul %float %170 %172
+               OpStore %173 %174
+               OpBranch %160
+        %160 = OpLabel
+               OpBranch %147
+        %147 = OpLabel
+        %175 = OpIAdd %int %150 %int_1
+               OpStore %x_75 %175
+        %176 = OpLoad %int %x_75
+               OpStore %x_74_phi %176
+               OpBranch %145
+        %146 = OpLabel
+        %177 = OpLoad %v3float %c
+        %179 = OpExtInst %v3float %67 FAbs %177
+        %178 = OpExtInst %v3float %67 Normalize %179
+        %180 = OpCompositeExtract %float %178 0
+        %181 = OpCompositeExtract %float %178 1
+        %182 = OpCompositeExtract %float %178 2
+        %183 = OpCompositeConstruct %v4float %180 %181 %182 %float_1
+               OpStore %x_GLF_color %183
                OpReturn
                OpFunctionEnd
-%tint_symbol_3 = OpFunction %void None %179
+%tint_symbol_3 = OpFunction %void None %184
 %tint_symbol_1 = OpFunctionParameter %main_out
-        %183 = OpLabel
-        %184 = OpCompositeExtract %v4float %tint_symbol_1 0
-               OpStore %tint_symbol_2 %184
+        %188 = OpLabel
+        %189 = OpCompositeExtract %v4float %tint_symbol_1 0
+               OpStore %tint_symbol_2 %189
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %92
-        %186 = OpLabel
-        %187 = OpLoad %v4float %tint_symbol
-               OpStore %gl_FragCoord %187
-        %188 = OpFunctionCall %void %main_1
-        %190 = OpLoad %v4float %x_GLF_color
-        %191 = OpCompositeConstruct %main_out %190
-        %189 = OpFunctionCall %void %tint_symbol_3 %191
+       %main = OpFunction %void None %97
+        %191 = OpLabel
+        %192 = OpLoad %v4float %tint_symbol
+               OpStore %gl_FragCoord %192
+        %193 = OpFunctionCall %void %main_1
+        %195 = OpLoad %v4float %x_GLF_color
+        %196 = OpCompositeConstruct %main_out %195
+        %194 = OpFunctionCall %void %tint_symbol_3 %196
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.wgsl
index 57edb9b..76b1a5d 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.wgsl
@@ -41,7 +41,7 @@
     } else {
       let x_118 : f32 = *(thirty_two);
       x_125_phi = x_104;
-      if (((f32(x_107) % round(x_118)) <= 0.01)) {
+      if (((f32(x_107) - (round(x_118) * floor((f32(x_107) / round(x_118))))) <= 0.01)) {
         x_124 = (x_104 + 100.0);
         x_125_phi = x_124;
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.msl
index 12d7016..d609e54 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -41,7 +39,7 @@
     } else {
       float const x_118 = *(thirty_two);
       x_125_phi = x_104;
-      if (((float(x_107) % rint(x_118)) <= 0.01f)) {
+      if ((fmod(float(x_107), rint(x_118)) <= 0.01f)) {
         x_124 = (x_104 + 100.0f);
         x_125_phi = x_124;
       }
@@ -130,8 +128,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\uq0.0.metal:42:26: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_107) % rint(x_118)) <= 0.01f)) {
-            ~~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.spvasm
index d622545..a05688b 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.spvasm
@@ -159,7 +159,7 @@
                OpStore %x_125_phi %64
          %65 = OpConvertSToF %float %42
          %66 = OpExtInst %float %67 RoundEven %63
-         %68 = OpFMod %float %65 %66
+         %68 = OpFRem %float %65 %66
          %70 = OpFOrdLessThanEqual %bool %68 %float_0_00999999978
                OpSelectionMerge %71 None
                OpBranchConditional %70 %72 %71
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.hlsl
index 8f3bad1..4740814 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.hlsl
@@ -23,7 +23,7 @@
       } else {
         const int x_155 = i;
         const float x_157 = thirty_two;
-        if (((float(x_155) % round(x_157)) <= 0.01f)) {
+        if (((float(x_155) - (round(x_157) * floor((float(x_155) / round(x_157))))) <= 0.01f)) {
           result = (result + 100.0f);
         }
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.msl
index 721f3ab..ac14c85 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -34,7 +32,7 @@
     } else {
       int const x_155 = i;
       float const x_157 = *(thirty_two);
-      if (((float(x_155) % rint(x_157)) <= 0.01f)) {
+      if (((float(x_155) - (rint(x_157) * floor((float(x_155) / rint(x_157))))) <= 0.01f)) {
         float const x_163 = result;
         result = (x_163 + 100.0f);
       }
@@ -144,8 +142,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\ufhc.0.metal:35:26: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_155) % rint(x_157)) <= 0.01f)) {
-            ~~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.spvasm
index 304913e..ddb9a0a 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 207
+; Bound: 212
 ; Schema: 0
                OpCapability Shader
          %59 = OpExtInstImport "GLSL.std.450"
@@ -84,14 +84,14 @@
 %float_0_00999999978 = OpConstant %float 0.00999999978
   %float_100 = OpConstant %float 100
        %void = OpTypeVoid
-         %79 = OpTypeFunction %void
+         %84 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %86 = OpConstantNull %v3float
+         %91 = OpConstantNull %v3float
     %float_7 = OpConstant %float 7
     %float_8 = OpConstant %float 8
     %float_9 = OpConstant %float 9
-         %98 = OpConstantComposite %v3float %float_7 %float_8 %float_9
+        %103 = OpConstantComposite %v3float %float_7 %float_8 %float_9
        %uint = OpTypeInt 32 0
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
@@ -103,7 +103,7 @@
     %float_1 = OpConstant %float 1
     %float_0 = OpConstant %float 0
    %main_out = OpTypeStruct %v4float
-        %194 = OpTypeFunction %void %main_out
+        %199 = OpTypeFunction %void %main_out
 %compute_value_f1_f1_ = OpFunction %float None %18
       %limit = OpFunctionParameter %_ptr_Function_float
  %thirty_two = OpFunctionParameter %_ptr_Function_float
@@ -141,191 +141,196 @@
          %56 = OpLoad %float %thirty_two
          %57 = OpConvertSToF %float %54
          %58 = OpExtInst %float %59 RoundEven %56
-         %60 = OpFMod %float %57 %58
-         %62 = OpFOrdLessThanEqual %bool %60 %float_0_00999999978
-               OpSelectionMerge %63 None
-               OpBranchConditional %62 %64 %63
-         %64 = OpLabel
-         %65 = OpLoad %float %result
-         %67 = OpFAdd %float %65 %float_100
-               OpStore %result %67
-               OpBranch %63
-         %63 = OpLabel
+         %61 = OpConvertSToF %float %54
+         %62 = OpExtInst %float %59 RoundEven %56
+         %63 = OpFDiv %float %61 %62
+         %60 = OpExtInst %float %59 Floor %63
+         %64 = OpFMul %float %58 %60
+         %65 = OpFSub %float %57 %64
+         %67 = OpFOrdLessThanEqual %bool %65 %float_0_00999999978
+               OpSelectionMerge %68 None
+               OpBranchConditional %67 %69 %68
+         %69 = OpLabel
+         %70 = OpLoad %float %result
+         %72 = OpFAdd %float %70 %float_100
+               OpStore %result %72
+               OpBranch %68
+         %68 = OpLabel
                OpBranch %48
          %48 = OpLabel
-         %68 = OpLoad %int %i
-         %70 = OpLoad %float %limit
-         %71 = OpConvertSToF %float %68
-         %72 = OpFOrdGreaterThanEqual %bool %71 %70
-               OpSelectionMerge %73 None
-               OpBranchConditional %72 %74 %73
-         %74 = OpLabel
-         %75 = OpLoad %float %result
-               OpReturnValue %75
-         %73 = OpLabel
+         %73 = OpLoad %int %i
+         %75 = OpLoad %float %limit
+         %76 = OpConvertSToF %float %73
+         %77 = OpFOrdGreaterThanEqual %bool %76 %75
+               OpSelectionMerge %78 None
+               OpBranchConditional %77 %79 %78
+         %79 = OpLabel
+         %80 = OpLoad %float %result
+               OpReturnValue %80
+         %78 = OpLabel
                OpBranch %34
          %34 = OpLabel
-         %76 = OpLoad %int %i
-         %77 = OpIAdd %int %76 %int_1
-               OpStore %i %77
+         %81 = OpLoad %int %i
+         %82 = OpIAdd %int %81 %int_1
+               OpStore %i %82
                OpBranch %32
          %33 = OpLabel
-         %78 = OpLoad %float %result
-               OpReturnValue %78
+         %83 = OpLoad %float %result
+               OpReturnValue %83
                OpFunctionEnd
-     %main_1 = OpFunction %void None %79
-         %82 = OpLabel
-          %c = OpVariable %_ptr_Function_v3float Function %86
+     %main_1 = OpFunction %void None %84
+         %87 = OpLabel
+          %c = OpVariable %_ptr_Function_v3float Function %91
 %thirty_two_1 = OpVariable %_ptr_Function_float Function %25
       %param = OpVariable %_ptr_Function_float Function %25
     %param_1 = OpVariable %_ptr_Function_float Function %25
     %param_2 = OpVariable %_ptr_Function_float Function %25
     %param_3 = OpVariable %_ptr_Function_float Function %25
-       %x_61 = OpVariable %_ptr_Function_v3float Function %86
+       %x_61 = OpVariable %_ptr_Function_v3float Function %91
         %i_1 = OpVariable %_ptr_Function_int Function %29
           %j = OpVariable %_ptr_Function_float Function %25
-               OpStore %c %98
-        %102 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0
-        %103 = OpLoad %float %102
-        %105 = OpFDiv %float %103 %float_8
-        %104 = OpExtInst %float %59 RoundEven %105
-               OpStore %thirty_two_1 %104
-        %107 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
+               OpStore %c %103
+        %107 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0
         %108 = OpLoad %float %107
-               OpStore %param %108
-        %109 = OpLoad %float %thirty_two_1
-               OpStore %param_1 %109
-        %110 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
-        %113 = OpAccessChain %_ptr_Function_float %c %uint_0
-               OpStore %113 %110
-        %115 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %116 = OpLoad %float %115
-               OpStore %param_2 %116
-        %117 = OpLoad %float %thirty_two_1
-               OpStore %param_3 %117
-        %118 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
-        %121 = OpAccessChain %_ptr_Function_float %c %uint_1
-               OpStore %121 %118
-        %122 = OpAccessChain %_ptr_Function_float %c %uint_0
-        %123 = OpLoad %float %122
-               OpSelectionMerge %125 None
-               OpBranchConditional %true %126 %127
-        %126 = OpLabel
-        %128 = OpLoad %v3float %c
-               OpStore %x_61 %128
-               OpBranch %125
-        %127 = OpLabel
-        %129 = OpLoad %v3float %c
-        %130 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0
-        %131 = OpLoad %float %130
-        %132 = OpVectorTimesScalar %v3float %129 %131
-               OpStore %x_61 %132
-               OpBranch %125
-        %125 = OpLabel
-        %133 = OpAccessChain %_ptr_Function_float %x_61 %uint_1
-        %134 = OpLoad %float %133
-        %136 = OpAccessChain %_ptr_Function_float %c %uint_2
-        %137 = OpFAdd %float %123 %134
-               OpStore %136 %137
+        %110 = OpFDiv %float %108 %float_8
+        %109 = OpExtInst %float %59 RoundEven %110
+               OpStore %thirty_two_1 %109
+        %112 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
+        %113 = OpLoad %float %112
+               OpStore %param %113
+        %114 = OpLoad %float %thirty_two_1
+               OpStore %param_1 %114
+        %115 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
+        %118 = OpAccessChain %_ptr_Function_float %c %uint_0
+               OpStore %118 %115
+        %120 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %121 = OpLoad %float %120
+               OpStore %param_2 %121
+        %122 = OpLoad %float %thirty_two_1
+               OpStore %param_3 %122
+        %123 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
+        %126 = OpAccessChain %_ptr_Function_float %c %uint_1
+               OpStore %126 %123
+        %127 = OpAccessChain %_ptr_Function_float %c %uint_0
+        %128 = OpLoad %float %127
+               OpSelectionMerge %130 None
+               OpBranchConditional %true %131 %132
+        %131 = OpLabel
+        %133 = OpLoad %v3float %c
+               OpStore %x_61 %133
+               OpBranch %130
+        %132 = OpLabel
+        %134 = OpLoad %v3float %c
+        %135 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0
+        %136 = OpLoad %float %135
+        %137 = OpVectorTimesScalar %v3float %134 %136
+               OpStore %x_61 %137
+               OpBranch %130
+        %130 = OpLabel
+        %138 = OpAccessChain %_ptr_Function_float %x_61 %uint_1
+        %139 = OpLoad %float %138
+        %141 = OpAccessChain %_ptr_Function_float %c %uint_2
+        %142 = OpFAdd %float %128 %139
+               OpStore %141 %142
                OpStore %i_1 %int_0
-               OpBranch %138
-        %138 = OpLabel
-               OpLoopMerge %139 %140 None
-               OpBranch %141
-        %141 = OpLabel
-        %142 = OpLoad %int %i_1
-        %144 = OpSLessThan %bool %142 %int_3
-               OpSelectionMerge %145 None
-               OpBranchConditional %144 %146 %147
+               OpBranch %143
+        %143 = OpLabel
+               OpLoopMerge %144 %145 None
+               OpBranch %146
         %146 = OpLabel
-               OpBranch %145
-        %147 = OpLabel
-               OpBranch %139
-        %145 = OpLabel
-        %148 = OpLoad %int %i_1
-        %149 = OpAccessChain %_ptr_Function_float %c %148
-        %150 = OpLoad %float %149
-        %152 = OpFOrdGreaterThanEqual %bool %150 %float_1
-               OpSelectionMerge %153 None
-               OpBranchConditional %152 %154 %153
-        %154 = OpLabel
-        %155 = OpLoad %int %i_1
-        %156 = OpLoad %int %i_1
-        %157 = OpAccessChain %_ptr_Function_float %c %156
-        %158 = OpLoad %float %157
-        %159 = OpLoad %int %i_1
-        %160 = OpAccessChain %_ptr_Function_float %c %159
-        %161 = OpLoad %float %160
-        %162 = OpAccessChain %_ptr_Function_float %c %155
-        %163 = OpFMul %float %158 %161
-               OpStore %162 %163
-               OpBranch %153
-        %153 = OpLabel
+        %147 = OpLoad %int %i_1
+        %149 = OpSLessThan %bool %147 %int_3
+               OpSelectionMerge %150 None
+               OpBranchConditional %149 %151 %152
+        %151 = OpLabel
+               OpBranch %150
+        %152 = OpLabel
+               OpBranch %144
+        %150 = OpLabel
+        %153 = OpLoad %int %i_1
+        %154 = OpAccessChain %_ptr_Function_float %c %153
+        %155 = OpLoad %float %154
+        %157 = OpFOrdGreaterThanEqual %bool %155 %float_1
+               OpSelectionMerge %158 None
+               OpBranchConditional %157 %159 %158
+        %159 = OpLabel
+        %160 = OpLoad %int %i_1
+        %161 = OpLoad %int %i_1
+        %162 = OpAccessChain %_ptr_Function_float %c %161
+        %163 = OpLoad %float %162
+        %164 = OpLoad %int %i_1
+        %165 = OpAccessChain %_ptr_Function_float %c %164
+        %166 = OpLoad %float %165
+        %167 = OpAccessChain %_ptr_Function_float %c %160
+        %168 = OpFMul %float %163 %166
+               OpStore %167 %168
+               OpBranch %158
+        %158 = OpLabel
                OpStore %j %float_0
-               OpBranch %165
-        %165 = OpLabel
-               OpLoopMerge %166 %167 None
-               OpBranch %168
-        %168 = OpLabel
-        %169 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0
-        %170 = OpLoad %float %169
-        %171 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_1
-        %172 = OpLoad %float %171
-        %173 = OpFOrdGreaterThan %bool %170 %172
-               OpSelectionMerge %174 None
-               OpBranchConditional %173 %175 %176
-        %175 = OpLabel
-               OpBranch %174
-        %176 = OpLabel
-               OpBranch %166
-        %174 = OpLabel
-        %177 = OpLoad %float %j
-        %178 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0
-        %179 = OpLoad %float %178
-        %180 = OpFOrdGreaterThanEqual %bool %177 %179
-               OpSelectionMerge %181 None
-               OpBranchConditional %180 %182 %181
-        %182 = OpLabel
-               OpBranch %166
+               OpBranch %170
+        %170 = OpLabel
+               OpLoopMerge %171 %172 None
+               OpBranch %173
+        %173 = OpLabel
+        %174 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0
+        %175 = OpLoad %float %174
+        %176 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_1
+        %177 = OpLoad %float %176
+        %178 = OpFOrdGreaterThan %bool %175 %177
+               OpSelectionMerge %179 None
+               OpBranchConditional %178 %180 %181
+        %180 = OpLabel
+               OpBranch %179
         %181 = OpLabel
-        %183 = OpLoad %float %j
-        %184 = OpFAdd %float %183 %float_1
-               OpStore %j %184
-               OpBranch %167
-        %167 = OpLabel
-               OpBranch %165
-        %166 = OpLabel
-               OpBranch %140
-        %140 = OpLabel
-        %185 = OpLoad %int %i_1
-        %186 = OpIAdd %int %185 %int_1
-               OpStore %i_1 %186
-               OpBranch %138
-        %139 = OpLabel
-        %187 = OpLoad %v3float %c
-        %189 = OpExtInst %v3float %59 FAbs %187
-        %188 = OpExtInst %v3float %59 Normalize %189
-        %190 = OpCompositeExtract %float %188 0
-        %191 = OpCompositeExtract %float %188 1
-        %192 = OpCompositeExtract %float %188 2
-        %193 = OpCompositeConstruct %v4float %190 %191 %192 %float_1
-               OpStore %x_GLF_color %193
+               OpBranch %171
+        %179 = OpLabel
+        %182 = OpLoad %float %j
+        %183 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0
+        %184 = OpLoad %float %183
+        %185 = OpFOrdGreaterThanEqual %bool %182 %184
+               OpSelectionMerge %186 None
+               OpBranchConditional %185 %187 %186
+        %187 = OpLabel
+               OpBranch %171
+        %186 = OpLabel
+        %188 = OpLoad %float %j
+        %189 = OpFAdd %float %188 %float_1
+               OpStore %j %189
+               OpBranch %172
+        %172 = OpLabel
+               OpBranch %170
+        %171 = OpLabel
+               OpBranch %145
+        %145 = OpLabel
+        %190 = OpLoad %int %i_1
+        %191 = OpIAdd %int %190 %int_1
+               OpStore %i_1 %191
+               OpBranch %143
+        %144 = OpLabel
+        %192 = OpLoad %v3float %c
+        %194 = OpExtInst %v3float %59 FAbs %192
+        %193 = OpExtInst %v3float %59 Normalize %194
+        %195 = OpCompositeExtract %float %193 0
+        %196 = OpCompositeExtract %float %193 1
+        %197 = OpCompositeExtract %float %193 2
+        %198 = OpCompositeConstruct %v4float %195 %196 %197 %float_1
+               OpStore %x_GLF_color %198
                OpReturn
                OpFunctionEnd
-%tint_symbol_3 = OpFunction %void None %194
+%tint_symbol_3 = OpFunction %void None %199
 %tint_symbol_1 = OpFunctionParameter %main_out
-        %198 = OpLabel
-        %199 = OpCompositeExtract %v4float %tint_symbol_1 0
-               OpStore %tint_symbol_2 %199
+        %203 = OpLabel
+        %204 = OpCompositeExtract %v4float %tint_symbol_1 0
+               OpStore %tint_symbol_2 %204
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %79
-        %201 = OpLabel
-        %202 = OpLoad %v4float %tint_symbol
-               OpStore %gl_FragCoord %202
-        %203 = OpFunctionCall %void %main_1
-        %205 = OpLoad %v4float %x_GLF_color
-        %206 = OpCompositeConstruct %main_out %205
-        %204 = OpFunctionCall %void %tint_symbol_3 %206
+       %main = OpFunction %void None %84
+        %206 = OpLabel
+        %207 = OpLoad %v4float %tint_symbol
+               OpStore %gl_FragCoord %207
+        %208 = OpFunctionCall %void %main_1
+        %210 = OpLoad %v4float %x_GLF_color
+        %211 = OpCompositeConstruct %main_out %210
+        %209 = OpFunctionCall %void %tint_symbol_3 %211
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.wgsl
index 97ffaf9..4920c6d 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.wgsl
@@ -34,7 +34,7 @@
     } else {
       let x_155 : i32 = i;
       let x_157 : f32 = *(thirty_two);
-      if (((f32(x_155) % round(x_157)) <= 0.01)) {
+      if (((f32(x_155) - (round(x_157) * floor((f32(x_155) / round(x_157))))) <= 0.01)) {
         let x_163 : f32 = result;
         result = (x_163 + 100.0);
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.msl
index 2641e75..e9ded5d 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -34,7 +32,7 @@
     } else {
       int const x_155 = i;
       float const x_157 = *(thirty_two);
-      if (((float(x_155) % rint(x_157)) <= 0.01f)) {
+      if ((fmod(float(x_155), rint(x_157)) <= 0.01f)) {
         float const x_163 = result;
         result = (x_163 + 100.0f);
       }
@@ -144,8 +142,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\u7k8.0.metal:35:26: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_155) % rint(x_157)) <= 0.01f)) {
-            ~~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.spvasm
index 304913e..9faf394 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.spvasm
@@ -141,7 +141,7 @@
          %56 = OpLoad %float %thirty_two
          %57 = OpConvertSToF %float %54
          %58 = OpExtInst %float %59 RoundEven %56
-         %60 = OpFMod %float %57 %58
+         %60 = OpFRem %float %57 %58
          %62 = OpFOrdLessThanEqual %bool %60 %float_0_00999999978
                OpSelectionMerge %63 None
                OpBranchConditional %62 %64 %63
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.hlsl
index 20808b2..66c6ab5 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.hlsl
@@ -20,7 +20,7 @@
       } else {
         const int x_147 = i;
         const float x_149 = thirty_two;
-        if (((float(x_147) % round(x_149)) <= 0.01f)) {
+        if (((float(x_147) - (round(x_149) * floor((float(x_147) / round(x_149))))) <= 0.01f)) {
           result = (result + 100.0f);
         }
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.msl
index 223b0b5..f0268f3 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -31,7 +29,7 @@
     } else {
       int const x_147 = i;
       float const x_149 = *(thirty_two);
-      if (((float(x_147) % rint(x_149)) <= 0.01f)) {
+      if (((float(x_147) - (rint(x_149) * floor((float(x_147) / rint(x_149))))) <= 0.01f)) {
         float const x_155 = result;
         result = (x_155 + 100.0f);
       }
@@ -120,8 +118,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\uajw.0.metal:32:26: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_147) % rint(x_149)) <= 0.01f)) {
-            ~~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.spvasm
index 8feef9e..ab70f51 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 199
+; Bound: 204
 ; Schema: 0
                OpCapability Shader
          %56 = OpExtInstImport "GLSL.std.450"
@@ -71,14 +71,14 @@
 %float_0_00999999978 = OpConstant %float 0.00999999978
   %float_100 = OpConstant %float 100
        %void = OpTypeVoid
-         %76 = OpTypeFunction %void
+         %81 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %83 = OpConstantNull %v3float
+         %88 = OpConstantNull %v3float
     %float_7 = OpConstant %float 7
     %float_8 = OpConstant %float 8
     %float_9 = OpConstant %float 9
-         %93 = OpConstantComposite %v3float %float_7 %float_8 %float_9
+         %98 = OpConstantComposite %v3float %float_7 %float_8 %float_9
        %uint = OpTypeInt 32 0
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
@@ -87,16 +87,16 @@
 %mat4v2float = OpTypeMatrix %v2float 4
     %float_1 = OpConstant %float 1
     %float_0 = OpConstant %float 0
-        %127 = OpConstantComposite %v2float %float_1 %float_0
+        %132 = OpConstantComposite %v2float %float_1 %float_0
      %uint_2 = OpConstant %uint 2
 %mat3v3float = OpTypeMatrix %v3float 3
-        %132 = OpConstantComposite %v3float %float_1 %float_0 %float_0
-        %133 = OpConstantComposite %v3float %float_0 %float_1 %float_0
-        %134 = OpConstantComposite %v3float %float_0 %float_0 %float_1
-        %135 = OpConstantComposite %mat3v3float %132 %133 %134
+        %137 = OpConstantComposite %v3float %float_1 %float_0 %float_0
+        %138 = OpConstantComposite %v3float %float_0 %float_1 %float_0
+        %139 = OpConstantComposite %v3float %float_0 %float_0 %float_1
+        %140 = OpConstantComposite %mat3v3float %137 %138 %139
       %int_3 = OpConstant %int 3
    %main_out = OpTypeStruct %v4float
-        %186 = OpTypeFunction %void %main_out
+        %191 = OpTypeFunction %void %main_out
 %compute_value_f1_f1_ = OpFunction %float None %15
       %limit = OpFunctionParameter %_ptr_Function_float
  %thirty_two = OpFunctionParameter %_ptr_Function_float
@@ -134,163 +134,168 @@
          %53 = OpLoad %float %thirty_two
          %54 = OpConvertSToF %float %51
          %55 = OpExtInst %float %56 RoundEven %53
-         %57 = OpFMod %float %54 %55
-         %59 = OpFOrdLessThanEqual %bool %57 %float_0_00999999978
-               OpSelectionMerge %60 None
-               OpBranchConditional %59 %61 %60
-         %61 = OpLabel
-         %62 = OpLoad %float %result
-         %64 = OpFAdd %float %62 %float_100
-               OpStore %result %64
-               OpBranch %60
-         %60 = OpLabel
+         %58 = OpConvertSToF %float %51
+         %59 = OpExtInst %float %56 RoundEven %53
+         %60 = OpFDiv %float %58 %59
+         %57 = OpExtInst %float %56 Floor %60
+         %61 = OpFMul %float %55 %57
+         %62 = OpFSub %float %54 %61
+         %64 = OpFOrdLessThanEqual %bool %62 %float_0_00999999978
+               OpSelectionMerge %65 None
+               OpBranchConditional %64 %66 %65
+         %66 = OpLabel
+         %67 = OpLoad %float %result
+         %69 = OpFAdd %float %67 %float_100
+               OpStore %result %69
+               OpBranch %65
+         %65 = OpLabel
                OpBranch %45
          %45 = OpLabel
-         %65 = OpLoad %int %i
-         %67 = OpLoad %float %limit
-         %68 = OpConvertSToF %float %65
-         %69 = OpFOrdGreaterThanEqual %bool %68 %67
-               OpSelectionMerge %70 None
-               OpBranchConditional %69 %71 %70
-         %71 = OpLabel
-         %72 = OpLoad %float %result
-               OpReturnValue %72
-         %70 = OpLabel
+         %70 = OpLoad %int %i
+         %72 = OpLoad %float %limit
+         %73 = OpConvertSToF %float %70
+         %74 = OpFOrdGreaterThanEqual %bool %73 %72
+               OpSelectionMerge %75 None
+               OpBranchConditional %74 %76 %75
+         %76 = OpLabel
+         %77 = OpLoad %float %result
+               OpReturnValue %77
+         %75 = OpLabel
                OpBranch %31
          %31 = OpLabel
-         %73 = OpLoad %int %i
-         %74 = OpIAdd %int %73 %int_1
-               OpStore %i %74
+         %78 = OpLoad %int %i
+         %79 = OpIAdd %int %78 %int_1
+               OpStore %i %79
                OpBranch %29
          %30 = OpLabel
-         %75 = OpLoad %float %result
-               OpReturnValue %75
+         %80 = OpLoad %float %result
+               OpReturnValue %80
                OpFunctionEnd
-     %main_1 = OpFunction %void None %76
-         %79 = OpLabel
-          %c = OpVariable %_ptr_Function_v3float Function %83
+     %main_1 = OpFunction %void None %81
+         %84 = OpLabel
+          %c = OpVariable %_ptr_Function_v3float Function %88
 %thirty_two_1 = OpVariable %_ptr_Function_float Function %22
       %param = OpVariable %_ptr_Function_float Function %22
     %param_1 = OpVariable %_ptr_Function_float Function %22
     %param_2 = OpVariable %_ptr_Function_float Function %22
     %param_3 = OpVariable %_ptr_Function_float Function %22
         %i_1 = OpVariable %_ptr_Function_int Function %26
-               OpStore %c %93
-         %97 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0
-         %98 = OpLoad %float %97
-        %100 = OpFDiv %float %98 %float_8
-         %99 = OpExtInst %float %56 RoundEven %100
-               OpStore %thirty_two_1 %99
-        %102 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
+               OpStore %c %98
+        %102 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0
         %103 = OpLoad %float %102
-               OpStore %param %103
-        %104 = OpLoad %float %thirty_two_1
-               OpStore %param_1 %104
-        %105 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
-        %108 = OpAccessChain %_ptr_Function_float %c %uint_0
-               OpStore %108 %105
-        %110 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %111 = OpLoad %float %110
-               OpStore %param_2 %111
-        %112 = OpLoad %float %thirty_two_1
-               OpStore %param_3 %112
-        %113 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
-        %116 = OpAccessChain %_ptr_Function_float %c %uint_1
-               OpStore %116 %113
-        %117 = OpLoad %v3float %c
-        %118 = OpLoad %v3float %c
-        %120 = OpCompositeExtract %float %118 0
-        %121 = OpCompositeExtract %float %118 1
-        %122 = OpCompositeConstruct %v2float %120 %121
-        %123 = OpCompositeExtract %float %118 2
-        %125 = OpCompositeConstruct %v2float %123 %float_1
-        %128 = OpCompositeConstruct %mat4v2float %122 %125 %127 %127
-        %130 = OpAccessChain %_ptr_Function_float %c %uint_2
-        %136 = OpVectorTimesMatrix %v3float %117 %135
-        %137 = OpCompositeExtract %float %136 0
-        %138 = OpCompositeExtract %v2float %128 0
-        %139 = OpCompositeExtract %float %138 0
-        %140 = OpCompositeExtract %v2float %128 0
-        %141 = OpCompositeExtract %float %140 1
-        %142 = OpCompositeExtract %v2float %128 1
-        %143 = OpCompositeExtract %float %142 0
-        %144 = OpCompositeConstruct %v3float %139 %141 %143
-        %145 = OpCompositeExtract %float %144 1
-        %146 = OpFAdd %float %137 %145
-               OpStore %130 %146
+        %105 = OpFDiv %float %103 %float_8
+        %104 = OpExtInst %float %56 RoundEven %105
+               OpStore %thirty_two_1 %104
+        %107 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
+        %108 = OpLoad %float %107
+               OpStore %param %108
+        %109 = OpLoad %float %thirty_two_1
+               OpStore %param_1 %109
+        %110 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1
+        %113 = OpAccessChain %_ptr_Function_float %c %uint_0
+               OpStore %113 %110
+        %115 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %116 = OpLoad %float %115
+               OpStore %param_2 %116
+        %117 = OpLoad %float %thirty_two_1
+               OpStore %param_3 %117
+        %118 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3
+        %121 = OpAccessChain %_ptr_Function_float %c %uint_1
+               OpStore %121 %118
+        %122 = OpLoad %v3float %c
+        %123 = OpLoad %v3float %c
+        %125 = OpCompositeExtract %float %123 0
+        %126 = OpCompositeExtract %float %123 1
+        %127 = OpCompositeConstruct %v2float %125 %126
+        %128 = OpCompositeExtract %float %123 2
+        %130 = OpCompositeConstruct %v2float %128 %float_1
+        %133 = OpCompositeConstruct %mat4v2float %127 %130 %132 %132
+        %135 = OpAccessChain %_ptr_Function_float %c %uint_2
+        %141 = OpVectorTimesMatrix %v3float %122 %140
+        %142 = OpCompositeExtract %float %141 0
+        %143 = OpCompositeExtract %v2float %133 0
+        %144 = OpCompositeExtract %float %143 0
+        %145 = OpCompositeExtract %v2float %133 0
+        %146 = OpCompositeExtract %float %145 1
+        %147 = OpCompositeExtract %v2float %133 1
+        %148 = OpCompositeExtract %float %147 0
+        %149 = OpCompositeConstruct %v3float %144 %146 %148
+        %150 = OpCompositeExtract %float %149 1
+        %151 = OpFAdd %float %142 %150
+               OpStore %135 %151
                OpStore %i_1 %int_0
-               OpBranch %147
-        %147 = OpLabel
-               OpLoopMerge %148 %149 None
-               OpBranch %150
-        %150 = OpLabel
-        %151 = OpLoad %int %i_1
-        %153 = OpSLessThan %bool %151 %int_3
-               OpSelectionMerge %154 None
-               OpBranchConditional %153 %155 %156
+               OpBranch %152
+        %152 = OpLabel
+               OpLoopMerge %153 %154 None
+               OpBranch %155
         %155 = OpLabel
-               OpBranch %154
-        %156 = OpLabel
-               OpBranch %148
-        %154 = OpLabel
-        %157 = OpLoad %int %i_1
-        %158 = OpAccessChain %_ptr_Function_float %c %157
-        %159 = OpLoad %float %158
-        %160 = OpFOrdGreaterThanEqual %bool %159 %float_1
-               OpSelectionMerge %161 None
-               OpBranchConditional %160 %162 %161
-        %162 = OpLabel
-        %163 = OpLoad %int %i_1
-        %164 = OpLoad %int %i_1
-        %165 = OpAccessChain %_ptr_Function_float %c %164
-        %166 = OpLoad %float %165
-        %167 = OpLoad %int %i_1
-        %168 = OpAccessChain %_ptr_Function_float %c %167
-        %169 = OpLoad %float %168
-        %170 = OpAccessChain %_ptr_Function_float %c %163
-        %171 = OpFMul %float %166 %169
-               OpStore %170 %171
-        %172 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
-        %173 = OpLoad %float %172
-        %174 = OpFOrdLessThan %bool %173 %float_0
-               OpSelectionMerge %175 None
-               OpBranchConditional %174 %176 %175
-        %176 = OpLabel
-               OpBranch %148
-        %175 = OpLabel
-               OpBranch %161
+        %156 = OpLoad %int %i_1
+        %158 = OpSLessThan %bool %156 %int_3
+               OpSelectionMerge %159 None
+               OpBranchConditional %158 %160 %161
+        %160 = OpLabel
+               OpBranch %159
         %161 = OpLabel
-               OpBranch %149
-        %149 = OpLabel
-        %177 = OpLoad %int %i_1
-        %178 = OpIAdd %int %177 %int_1
-               OpStore %i_1 %178
-               OpBranch %147
-        %148 = OpLabel
-        %179 = OpLoad %v3float %c
-        %181 = OpExtInst %v3float %56 FAbs %179
-        %180 = OpExtInst %v3float %56 Normalize %181
-        %182 = OpCompositeExtract %float %180 0
-        %183 = OpCompositeExtract %float %180 1
-        %184 = OpCompositeExtract %float %180 2
-        %185 = OpCompositeConstruct %v4float %182 %183 %184 %float_1
-               OpStore %x_GLF_color %185
+               OpBranch %153
+        %159 = OpLabel
+        %162 = OpLoad %int %i_1
+        %163 = OpAccessChain %_ptr_Function_float %c %162
+        %164 = OpLoad %float %163
+        %165 = OpFOrdGreaterThanEqual %bool %164 %float_1
+               OpSelectionMerge %166 None
+               OpBranchConditional %165 %167 %166
+        %167 = OpLabel
+        %168 = OpLoad %int %i_1
+        %169 = OpLoad %int %i_1
+        %170 = OpAccessChain %_ptr_Function_float %c %169
+        %171 = OpLoad %float %170
+        %172 = OpLoad %int %i_1
+        %173 = OpAccessChain %_ptr_Function_float %c %172
+        %174 = OpLoad %float %173
+        %175 = OpAccessChain %_ptr_Function_float %c %168
+        %176 = OpFMul %float %171 %174
+               OpStore %175 %176
+        %177 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
+        %178 = OpLoad %float %177
+        %179 = OpFOrdLessThan %bool %178 %float_0
+               OpSelectionMerge %180 None
+               OpBranchConditional %179 %181 %180
+        %181 = OpLabel
+               OpBranch %153
+        %180 = OpLabel
+               OpBranch %166
+        %166 = OpLabel
+               OpBranch %154
+        %154 = OpLabel
+        %182 = OpLoad %int %i_1
+        %183 = OpIAdd %int %182 %int_1
+               OpStore %i_1 %183
+               OpBranch %152
+        %153 = OpLabel
+        %184 = OpLoad %v3float %c
+        %186 = OpExtInst %v3float %56 FAbs %184
+        %185 = OpExtInst %v3float %56 Normalize %186
+        %187 = OpCompositeExtract %float %185 0
+        %188 = OpCompositeExtract %float %185 1
+        %189 = OpCompositeExtract %float %185 2
+        %190 = OpCompositeConstruct %v4float %187 %188 %189 %float_1
+               OpStore %x_GLF_color %190
                OpReturn
                OpFunctionEnd
-%tint_symbol_3 = OpFunction %void None %186
+%tint_symbol_3 = OpFunction %void None %191
 %tint_symbol_1 = OpFunctionParameter %main_out
-        %190 = OpLabel
-        %191 = OpCompositeExtract %v4float %tint_symbol_1 0
-               OpStore %tint_symbol_2 %191
+        %195 = OpLabel
+        %196 = OpCompositeExtract %v4float %tint_symbol_1 0
+               OpStore %tint_symbol_2 %196
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %76
-        %193 = OpLabel
-        %194 = OpLoad %v4float %tint_symbol
-               OpStore %gl_FragCoord %194
-        %195 = OpFunctionCall %void %main_1
-        %197 = OpLoad %v4float %x_GLF_color
-        %198 = OpCompositeConstruct %main_out %197
-        %196 = OpFunctionCall %void %tint_symbol_3 %198
+       %main = OpFunction %void None %81
+        %198 = OpLabel
+        %199 = OpLoad %v4float %tint_symbol
+               OpStore %gl_FragCoord %199
+        %200 = OpFunctionCall %void %main_1
+        %202 = OpLoad %v4float %x_GLF_color
+        %203 = OpCompositeConstruct %main_out %202
+        %201 = OpFunctionCall %void %tint_symbol_3 %203
                OpReturn
                OpFunctionEnd
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.wgsl
index ee16548..6d227b7 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.wgsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.wgsl
@@ -27,7 +27,7 @@
     } else {
       let x_147 : i32 = i;
       let x_149 : f32 = *(thirty_two);
-      if (((f32(x_147) % round(x_149)) <= 0.01)) {
+      if (((f32(x_147) - (round(x_149) * floor((f32(x_147) / round(x_149))))) <= 0.01)) {
         let x_155 : f32 = result;
         result = (x_155 + 100.0);
       }
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.msl
index 4db0bfd..2d76e0b 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.msl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.msl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #include <metal_stdlib>
 
 using namespace metal;
@@ -31,7 +29,7 @@
     } else {
       int const x_147 = i;
       float const x_149 = *(thirty_two);
-      if (((float(x_147) % rint(x_149)) <= 0.01f)) {
+      if ((fmod(float(x_147), rint(x_149)) <= 0.01f)) {
         float const x_155 = result;
         result = (x_155 + 100.0f);
       }
@@ -120,8 +118,3 @@
   return tint_symbol_4;
 }
 
-T:\tmp\uet8.0.metal:32:26: error: invalid operands to binary expression ('float' and 'float')
-      if (((float(x_147) % rint(x_149)) <= 0.01f)) {
-            ~~~~~~~~~~~~ ^ ~~~~~~~~~~~
-1 error generated.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.spvasm
index 8feef9e..b1061a2 100644
--- a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.spvasm
+++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.spvasm
@@ -134,7 +134,7 @@
          %53 = OpLoad %float %thirty_two
          %54 = OpConvertSToF %float %51
          %55 = OpExtInst %float %56 RoundEven %53
-         %57 = OpFMod %float %54 %55
+         %57 = OpFRem %float %54 %55
          %59 = OpFOrdLessThanEqual %bool %57 %float_0_00999999978
                OpSelectionMerge %60 None
                OpBranchConditional %59 %61 %60