From 02d4ea06b9ad4ed7d48664c9518e7241c9425a39 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 10 Nov 2022 15:52:41 +0000 Subject: [PATCH] Add const-eval for `cos` and `cosh` This CL adds const-eval for `cos` and `cosh`. Bug: tint:1581 Change-Id: I8df8f979a7b351288cadccda88940fdb5a20d18f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109561 Commit-Queue: Dan Sinclair Kokoro: Kokoro Reviewed-by: Antonio Maiorano --- src/tint/intrinsics.def | 8 +-- src/tint/resolver/const_eval.cc | 26 ++++++++ src/tint/resolver/const_eval.h | 18 +++++ src/tint/resolver/const_eval_builtin_test.cc | 45 +++++++++++++ src/tint/resolver/intrinsic_table.inl | 24 +++---- .../tint/builtins/gen/literal/cos/0835a8.wgsl | 2 +- .../literal/cos/0835a8.wgsl.expected.dxc.hlsl | 2 +- .../gen/literal/cos/0835a8.wgsl.expected.glsl | 6 +- .../gen/literal/cos/0835a8.wgsl.expected.msl | 2 +- .../literal/cos/0835a8.wgsl.expected.spvasm | 34 +++++----- .../gen/literal/cos/0835a8.wgsl.expected.wgsl | 2 +- .../tint/builtins/gen/literal/cos/0a89f7.wgsl | 2 +- .../literal/cos/0a89f7.wgsl.expected.dxc.hlsl | 2 +- .../gen/literal/cos/0a89f7.wgsl.expected.glsl | 6 +- .../gen/literal/cos/0a89f7.wgsl.expected.msl | 2 +- .../literal/cos/0a89f7.wgsl.expected.spvasm | 34 +++++----- .../gen/literal/cos/0a89f7.wgsl.expected.wgsl | 2 +- .../tint/builtins/gen/literal/cos/16dc15.wgsl | 2 +- .../literal/cos/16dc15.wgsl.expected.dxc.hlsl | 2 +- .../literal/cos/16dc15.wgsl.expected.fxc.hlsl | 2 +- .../gen/literal/cos/16dc15.wgsl.expected.glsl | 6 +- .../gen/literal/cos/16dc15.wgsl.expected.msl | 2 +- .../literal/cos/16dc15.wgsl.expected.spvasm | 34 +++++----- .../gen/literal/cos/16dc15.wgsl.expected.wgsl | 2 +- .../tint/builtins/gen/literal/cos/29d66d.wgsl | 2 +- .../literal/cos/29d66d.wgsl.expected.dxc.hlsl | 2 +- .../literal/cos/29d66d.wgsl.expected.fxc.hlsl | 2 +- .../gen/literal/cos/29d66d.wgsl.expected.glsl | 6 +- .../gen/literal/cos/29d66d.wgsl.expected.msl | 2 +- .../literal/cos/29d66d.wgsl.expected.spvasm | 30 ++++----- .../gen/literal/cos/29d66d.wgsl.expected.wgsl | 2 +- .../tint/builtins/gen/literal/cos/47d768.wgsl | 43 ++++++++++++ .../literal/cos/47d768.wgsl.expected.dxc.hlsl | 30 +++++++++ .../literal/cos/47d768.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/literal/cos/47d768.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/cos/47d768.wgsl.expected.msl | 33 ++++++++++ .../literal/cos/47d768.wgsl.expected.spvasm | 64 ++++++++++++++++++ .../gen/literal/cos/47d768.wgsl.expected.wgsl | 19 ++++++ .../tint/builtins/gen/literal/cos/5bc2c6.wgsl | 2 +- .../literal/cos/5bc2c6.wgsl.expected.dxc.hlsl | 2 +- .../gen/literal/cos/5bc2c6.wgsl.expected.glsl | 6 +- .../gen/literal/cos/5bc2c6.wgsl.expected.msl | 2 +- .../literal/cos/5bc2c6.wgsl.expected.spvasm | 34 +++++----- .../gen/literal/cos/5bc2c6.wgsl.expected.wgsl | 2 +- .../tint/builtins/gen/literal/cos/6b1fdf.wgsl | 43 ++++++++++++ .../literal/cos/6b1fdf.wgsl.expected.dxc.hlsl | 30 +++++++++ .../literal/cos/6b1fdf.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/literal/cos/6b1fdf.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/cos/6b1fdf.wgsl.expected.msl | 33 ++++++++++ .../literal/cos/6b1fdf.wgsl.expected.spvasm | 66 +++++++++++++++++++ .../gen/literal/cos/6b1fdf.wgsl.expected.wgsl | 19 ++++++ .../tint/builtins/gen/literal/cos/a297d4.wgsl | 43 ++++++++++++ .../literal/cos/a297d4.wgsl.expected.dxc.hlsl | 30 +++++++++ .../literal/cos/a297d4.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/literal/cos/a297d4.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/cos/a297d4.wgsl.expected.msl | 33 ++++++++++ .../literal/cos/a297d4.wgsl.expected.spvasm | 63 ++++++++++++++++++ .../gen/literal/cos/a297d4.wgsl.expected.wgsl | 19 ++++++ .../tint/builtins/gen/literal/cos/af7447.wgsl | 43 ++++++++++++ .../literal/cos/af7447.wgsl.expected.dxc.hlsl | 30 +++++++++ .../literal/cos/af7447.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/literal/cos/af7447.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/cos/af7447.wgsl.expected.msl | 33 ++++++++++ .../literal/cos/af7447.wgsl.expected.spvasm | 66 +++++++++++++++++++ .../gen/literal/cos/af7447.wgsl.expected.wgsl | 19 ++++++ .../tint/builtins/gen/literal/cos/c3b486.wgsl | 2 +- .../literal/cos/c3b486.wgsl.expected.dxc.hlsl | 2 +- .../literal/cos/c3b486.wgsl.expected.fxc.hlsl | 2 +- .../gen/literal/cos/c3b486.wgsl.expected.glsl | 6 +- .../gen/literal/cos/c3b486.wgsl.expected.msl | 2 +- .../literal/cos/c3b486.wgsl.expected.spvasm | 34 +++++----- .../gen/literal/cos/c3b486.wgsl.expected.wgsl | 2 +- .../tint/builtins/gen/literal/cos/c5c28e.wgsl | 2 +- .../literal/cos/c5c28e.wgsl.expected.dxc.hlsl | 2 +- .../literal/cos/c5c28e.wgsl.expected.fxc.hlsl | 2 +- .../gen/literal/cos/c5c28e.wgsl.expected.glsl | 6 +- .../gen/literal/cos/c5c28e.wgsl.expected.msl | 2 +- .../literal/cos/c5c28e.wgsl.expected.spvasm | 28 ++++---- .../gen/literal/cos/c5c28e.wgsl.expected.wgsl | 2 +- .../tint/builtins/gen/literal/cos/fc047d.wgsl | 2 +- .../literal/cos/fc047d.wgsl.expected.dxc.hlsl | 2 +- .../gen/literal/cos/fc047d.wgsl.expected.glsl | 6 +- .../gen/literal/cos/fc047d.wgsl.expected.msl | 2 +- .../literal/cos/fc047d.wgsl.expected.spvasm | 32 +++++---- .../gen/literal/cos/fc047d.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/cosh/2ed778.wgsl | 2 +- .../cosh/2ed778.wgsl.expected.dxc.hlsl | 2 +- .../literal/cosh/2ed778.wgsl.expected.glsl | 6 +- .../gen/literal/cosh/2ed778.wgsl.expected.msl | 2 +- .../literal/cosh/2ed778.wgsl.expected.spvasm | 32 +++++---- .../literal/cosh/2ed778.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/cosh/377652.wgsl | 2 +- .../cosh/377652.wgsl.expected.dxc.hlsl | 2 +- .../cosh/377652.wgsl.expected.fxc.hlsl | 2 +- .../literal/cosh/377652.wgsl.expected.glsl | 6 +- .../gen/literal/cosh/377652.wgsl.expected.msl | 2 +- .../literal/cosh/377652.wgsl.expected.spvasm | 34 +++++----- .../literal/cosh/377652.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/cosh/3b7bbf.wgsl | 2 +- .../cosh/3b7bbf.wgsl.expected.dxc.hlsl | 2 +- .../literal/cosh/3b7bbf.wgsl.expected.glsl | 6 +- .../gen/literal/cosh/3b7bbf.wgsl.expected.msl | 2 +- .../literal/cosh/3b7bbf.wgsl.expected.spvasm | 34 +++++----- .../literal/cosh/3b7bbf.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/cosh/432645.wgsl | 43 ++++++++++++ .../cosh/432645.wgsl.expected.dxc.hlsl | 30 +++++++++ .../cosh/432645.wgsl.expected.fxc.hlsl | 30 +++++++++ .../literal/cosh/432645.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/cosh/432645.wgsl.expected.msl | 33 ++++++++++ .../literal/cosh/432645.wgsl.expected.spvasm | 66 +++++++++++++++++++ .../literal/cosh/432645.wgsl.expected.wgsl | 19 ++++++ .../builtins/gen/literal/cosh/43b672.wgsl | 2 +- .../cosh/43b672.wgsl.expected.dxc.hlsl | 2 +- .../literal/cosh/43b672.wgsl.expected.glsl | 6 +- .../gen/literal/cosh/43b672.wgsl.expected.msl | 2 +- .../literal/cosh/43b672.wgsl.expected.spvasm | 34 +++++----- .../literal/cosh/43b672.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/cosh/b1b8a0.wgsl | 2 +- .../cosh/b1b8a0.wgsl.expected.dxc.hlsl | 2 +- .../literal/cosh/b1b8a0.wgsl.expected.glsl | 6 +- .../gen/literal/cosh/b1b8a0.wgsl.expected.msl | 2 +- .../literal/cosh/b1b8a0.wgsl.expected.spvasm | 34 +++++----- .../literal/cosh/b1b8a0.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/cosh/c13756.wgsl | 2 +- .../cosh/c13756.wgsl.expected.dxc.hlsl | 2 +- .../cosh/c13756.wgsl.expected.fxc.hlsl | 2 +- .../literal/cosh/c13756.wgsl.expected.glsl | 6 +- .../gen/literal/cosh/c13756.wgsl.expected.msl | 2 +- .../literal/cosh/c13756.wgsl.expected.spvasm | 34 +++++----- .../literal/cosh/c13756.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/cosh/c892bb.wgsl | 43 ++++++++++++ .../cosh/c892bb.wgsl.expected.dxc.hlsl | 30 +++++++++ .../cosh/c892bb.wgsl.expected.fxc.hlsl | 30 +++++++++ .../literal/cosh/c892bb.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/cosh/c892bb.wgsl.expected.msl | 33 ++++++++++ .../literal/cosh/c892bb.wgsl.expected.spvasm | 63 ++++++++++++++++++ .../literal/cosh/c892bb.wgsl.expected.wgsl | 19 ++++++ .../builtins/gen/literal/cosh/d8dee7.wgsl | 43 ++++++++++++ .../cosh/d8dee7.wgsl.expected.dxc.hlsl | 30 +++++++++ .../cosh/d8dee7.wgsl.expected.fxc.hlsl | 30 +++++++++ .../literal/cosh/d8dee7.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/cosh/d8dee7.wgsl.expected.msl | 33 ++++++++++ .../literal/cosh/d8dee7.wgsl.expected.spvasm | 64 ++++++++++++++++++ .../literal/cosh/d8dee7.wgsl.expected.wgsl | 19 ++++++ .../builtins/gen/literal/cosh/da92dd.wgsl | 2 +- .../cosh/da92dd.wgsl.expected.dxc.hlsl | 2 +- .../cosh/da92dd.wgsl.expected.fxc.hlsl | 2 +- .../literal/cosh/da92dd.wgsl.expected.glsl | 6 +- .../gen/literal/cosh/da92dd.wgsl.expected.msl | 2 +- .../literal/cosh/da92dd.wgsl.expected.spvasm | 28 ++++---- .../literal/cosh/da92dd.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/cosh/e0c1de.wgsl | 2 +- .../cosh/e0c1de.wgsl.expected.dxc.hlsl | 2 +- .../cosh/e0c1de.wgsl.expected.fxc.hlsl | 2 +- .../literal/cosh/e0c1de.wgsl.expected.glsl | 6 +- .../gen/literal/cosh/e0c1de.wgsl.expected.msl | 2 +- .../literal/cosh/e0c1de.wgsl.expected.spvasm | 30 ++++----- .../literal/cosh/e0c1de.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/cosh/f67ff1.wgsl | 43 ++++++++++++ .../cosh/f67ff1.wgsl.expected.dxc.hlsl | 30 +++++++++ .../cosh/f67ff1.wgsl.expected.fxc.hlsl | 30 +++++++++ .../literal/cosh/f67ff1.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/cosh/f67ff1.wgsl.expected.msl | 33 ++++++++++ .../literal/cosh/f67ff1.wgsl.expected.spvasm | 66 +++++++++++++++++++ .../literal/cosh/f67ff1.wgsl.expected.wgsl | 19 ++++++ test/tint/builtins/gen/var/cos/0835a8.wgsl | 2 +- .../gen/var/cos/0835a8.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cos/0835a8.wgsl.expected.glsl | 6 +- .../gen/var/cos/0835a8.wgsl.expected.msl | 2 +- .../gen/var/cos/0835a8.wgsl.expected.spvasm | 42 ++++++------ .../gen/var/cos/0835a8.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cos/0a89f7.wgsl | 2 +- .../gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cos/0a89f7.wgsl.expected.glsl | 6 +- .../gen/var/cos/0a89f7.wgsl.expected.msl | 2 +- .../gen/var/cos/0a89f7.wgsl.expected.spvasm | 42 ++++++------ .../gen/var/cos/0a89f7.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cos/16dc15.wgsl | 2 +- .../gen/var/cos/16dc15.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cos/16dc15.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/cos/16dc15.wgsl.expected.glsl | 6 +- .../gen/var/cos/16dc15.wgsl.expected.msl | 2 +- .../gen/var/cos/16dc15.wgsl.expected.spvasm | 43 ++++++------ .../gen/var/cos/16dc15.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cos/29d66d.wgsl | 2 +- .../gen/var/cos/29d66d.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cos/29d66d.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/cos/29d66d.wgsl.expected.glsl | 6 +- .../gen/var/cos/29d66d.wgsl.expected.msl | 2 +- .../gen/var/cos/29d66d.wgsl.expected.spvasm | 37 +++++------ .../gen/var/cos/29d66d.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cos/47d768.wgsl | 44 +++++++++++++ .../gen/var/cos/47d768.wgsl.expected.dxc.hlsl | 30 +++++++++ .../gen/var/cos/47d768.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/cos/47d768.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/cos/47d768.wgsl.expected.msl | 33 ++++++++++ .../gen/var/cos/47d768.wgsl.expected.spvasm | 64 ++++++++++++++++++ .../gen/var/cos/47d768.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/cos/5bc2c6.wgsl | 2 +- .../gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cos/5bc2c6.wgsl.expected.glsl | 6 +- .../gen/var/cos/5bc2c6.wgsl.expected.msl | 2 +- .../gen/var/cos/5bc2c6.wgsl.expected.spvasm | 42 ++++++------ .../gen/var/cos/5bc2c6.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cos/6b1fdf.wgsl | 44 +++++++++++++ .../gen/var/cos/6b1fdf.wgsl.expected.dxc.hlsl | 30 +++++++++ .../gen/var/cos/6b1fdf.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/cos/6b1fdf.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/cos/6b1fdf.wgsl.expected.msl | 33 ++++++++++ .../gen/var/cos/6b1fdf.wgsl.expected.spvasm | 66 +++++++++++++++++++ .../gen/var/cos/6b1fdf.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/cos/a297d4.wgsl | 44 +++++++++++++ .../gen/var/cos/a297d4.wgsl.expected.dxc.hlsl | 30 +++++++++ .../gen/var/cos/a297d4.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/cos/a297d4.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/cos/a297d4.wgsl.expected.msl | 33 ++++++++++ .../gen/var/cos/a297d4.wgsl.expected.spvasm | 63 ++++++++++++++++++ .../gen/var/cos/a297d4.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/cos/af7447.wgsl | 44 +++++++++++++ .../gen/var/cos/af7447.wgsl.expected.dxc.hlsl | 30 +++++++++ .../gen/var/cos/af7447.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/cos/af7447.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/cos/af7447.wgsl.expected.msl | 33 ++++++++++ .../gen/var/cos/af7447.wgsl.expected.spvasm | 66 +++++++++++++++++++ .../gen/var/cos/af7447.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/cos/c3b486.wgsl | 2 +- .../gen/var/cos/c3b486.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cos/c3b486.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/cos/c3b486.wgsl.expected.glsl | 6 +- .../gen/var/cos/c3b486.wgsl.expected.msl | 2 +- .../gen/var/cos/c3b486.wgsl.expected.spvasm | 43 ++++++------ .../gen/var/cos/c3b486.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cos/c5c28e.wgsl | 2 +- .../gen/var/cos/c5c28e.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cos/c5c28e.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/cos/c5c28e.wgsl.expected.glsl | 6 +- .../gen/var/cos/c5c28e.wgsl.expected.msl | 2 +- .../gen/var/cos/c5c28e.wgsl.expected.spvasm | 26 ++++---- .../gen/var/cos/c5c28e.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cos/fc047d.wgsl | 2 +- .../gen/var/cos/fc047d.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cos/fc047d.wgsl.expected.glsl | 6 +- .../gen/var/cos/fc047d.wgsl.expected.msl | 2 +- .../gen/var/cos/fc047d.wgsl.expected.spvasm | 41 ++++++------ .../gen/var/cos/fc047d.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cosh/2ed778.wgsl | 2 +- .../var/cosh/2ed778.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cosh/2ed778.wgsl.expected.glsl | 6 +- .../gen/var/cosh/2ed778.wgsl.expected.msl | 2 +- .../gen/var/cosh/2ed778.wgsl.expected.spvasm | 41 ++++++------ .../gen/var/cosh/2ed778.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cosh/377652.wgsl | 2 +- .../var/cosh/377652.wgsl.expected.dxc.hlsl | 2 +- .../var/cosh/377652.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/cosh/377652.wgsl.expected.glsl | 6 +- .../gen/var/cosh/377652.wgsl.expected.msl | 2 +- .../gen/var/cosh/377652.wgsl.expected.spvasm | 43 ++++++------ .../gen/var/cosh/377652.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cosh/3b7bbf.wgsl | 2 +- .../var/cosh/3b7bbf.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cosh/3b7bbf.wgsl.expected.glsl | 6 +- .../gen/var/cosh/3b7bbf.wgsl.expected.msl | 2 +- .../gen/var/cosh/3b7bbf.wgsl.expected.spvasm | 42 ++++++------ .../gen/var/cosh/3b7bbf.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cosh/432645.wgsl | 44 +++++++++++++ .../var/cosh/432645.wgsl.expected.dxc.hlsl | 30 +++++++++ .../var/cosh/432645.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/cosh/432645.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/cosh/432645.wgsl.expected.msl | 33 ++++++++++ .../gen/var/cosh/432645.wgsl.expected.spvasm | 66 +++++++++++++++++++ .../gen/var/cosh/432645.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/cosh/43b672.wgsl | 2 +- .../var/cosh/43b672.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cosh/43b672.wgsl.expected.glsl | 6 +- .../gen/var/cosh/43b672.wgsl.expected.msl | 2 +- .../gen/var/cosh/43b672.wgsl.expected.spvasm | 42 ++++++------ .../gen/var/cosh/43b672.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cosh/b1b8a0.wgsl | 2 +- .../var/cosh/b1b8a0.wgsl.expected.dxc.hlsl | 2 +- .../gen/var/cosh/b1b8a0.wgsl.expected.glsl | 6 +- .../gen/var/cosh/b1b8a0.wgsl.expected.msl | 2 +- .../gen/var/cosh/b1b8a0.wgsl.expected.spvasm | 42 ++++++------ .../gen/var/cosh/b1b8a0.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cosh/c13756.wgsl | 2 +- .../var/cosh/c13756.wgsl.expected.dxc.hlsl | 2 +- .../var/cosh/c13756.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/cosh/c13756.wgsl.expected.glsl | 6 +- .../gen/var/cosh/c13756.wgsl.expected.msl | 2 +- .../gen/var/cosh/c13756.wgsl.expected.spvasm | 43 ++++++------ .../gen/var/cosh/c13756.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cosh/c892bb.wgsl | 44 +++++++++++++ .../var/cosh/c892bb.wgsl.expected.dxc.hlsl | 30 +++++++++ .../var/cosh/c892bb.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/cosh/c892bb.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/cosh/c892bb.wgsl.expected.msl | 33 ++++++++++ .../gen/var/cosh/c892bb.wgsl.expected.spvasm | 63 ++++++++++++++++++ .../gen/var/cosh/c892bb.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/cosh/d8dee7.wgsl | 44 +++++++++++++ .../var/cosh/d8dee7.wgsl.expected.dxc.hlsl | 30 +++++++++ .../var/cosh/d8dee7.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/cosh/d8dee7.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/cosh/d8dee7.wgsl.expected.msl | 33 ++++++++++ .../gen/var/cosh/d8dee7.wgsl.expected.spvasm | 64 ++++++++++++++++++ .../gen/var/cosh/d8dee7.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/cosh/da92dd.wgsl | 2 +- .../var/cosh/da92dd.wgsl.expected.dxc.hlsl | 2 +- .../var/cosh/da92dd.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/cosh/da92dd.wgsl.expected.glsl | 6 +- .../gen/var/cosh/da92dd.wgsl.expected.msl | 2 +- .../gen/var/cosh/da92dd.wgsl.expected.spvasm | 26 ++++---- .../gen/var/cosh/da92dd.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cosh/e0c1de.wgsl | 2 +- .../var/cosh/e0c1de.wgsl.expected.dxc.hlsl | 2 +- .../var/cosh/e0c1de.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/cosh/e0c1de.wgsl.expected.glsl | 6 +- .../gen/var/cosh/e0c1de.wgsl.expected.msl | 2 +- .../gen/var/cosh/e0c1de.wgsl.expected.spvasm | 37 +++++------ .../gen/var/cosh/e0c1de.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/cosh/f67ff1.wgsl | 44 +++++++++++++ .../var/cosh/f67ff1.wgsl.expected.dxc.hlsl | 30 +++++++++ .../var/cosh/f67ff1.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/cosh/f67ff1.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/cosh/f67ff1.wgsl.expected.msl | 33 ++++++++++ .../gen/var/cosh/f67ff1.wgsl.expected.spvasm | 66 +++++++++++++++++++ .../gen/var/cosh/f67ff1.wgsl.expected.wgsl | 20 ++++++ 325 files changed, 5211 insertions(+), 858 deletions(-) create mode 100644 test/tint/builtins/gen/literal/cos/47d768.wgsl create mode 100644 test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/cos/6b1fdf.wgsl create mode 100644 test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/cos/a297d4.wgsl create mode 100644 test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/cos/af7447.wgsl create mode 100644 test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/cosh/432645.wgsl create mode 100644 test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/cosh/c892bb.wgsl create mode 100644 test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/cosh/d8dee7.wgsl create mode 100644 test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/cosh/f67ff1.wgsl create mode 100644 test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cos/47d768.wgsl create mode 100644 test/tint/builtins/gen/var/cos/47d768.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/cos/47d768.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/cos/47d768.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cos/47d768.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cos/47d768.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cos/47d768.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cos/6b1fdf.wgsl create mode 100644 test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cos/a297d4.wgsl create mode 100644 test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cos/af7447.wgsl create mode 100644 test/tint/builtins/gen/var/cos/af7447.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/cos/af7447.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/cos/af7447.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cos/af7447.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cos/af7447.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cos/af7447.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/432645.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/432645.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/432645.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/432645.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cosh/432645.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cosh/432645.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cosh/432645.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/c892bb.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/d8dee7.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/f67ff1.wgsl create mode 100644 test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.wgsl diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def index 0a7fe52059..b067e376b2 100644 --- a/src/tint/intrinsics.def +++ b/src/tint/intrinsics.def @@ -429,10 +429,10 @@ fn arrayLength(ptr, A>) -> u32 @const fn ceil(@test_value(1.5) vec) -> vec @const fn clamp(T, T, T) -> T @const fn clamp(vec, vec, vec) -> vec -fn cos(T) -> T -fn cos(vec) -> vec -fn cosh(T) -> T -fn cosh(vec) -> vec +@const fn cos(@test_value(0) T) -> T +@const fn cos(@test_value(0) vec) -> vec +@const fn cosh(@test_value(0) T) -> T +@const fn cosh(@test_value(0) vec) -> vec @const fn countLeadingZeros(T) -> T @const fn countLeadingZeros(vec) -> vec @const fn countOneBits(T) -> T diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc index 504c64e54a..e1a9f8b022 100644 --- a/src/tint/resolver/const_eval.cc +++ b/src/tint/resolver/const_eval.cc @@ -1804,6 +1804,32 @@ ConstEval::Result ConstEval::clamp(const sem::Type* ty, return TransformElements(builder, ty, transform, args[0], args[1], args[2]); } +ConstEval::Result ConstEval::cos(const sem::Type* ty, + utils::VectorRef args, + const Source&) { + auto transform = [&](const sem::Constant* c0) { + auto create = [&](auto i) -> ImplResult { + using NumberT = decltype(i); + return CreateElement(builder, c0->Type(), NumberT(std::cos(i.value))); + }; + return Dispatch_fa_f32_f16(create, c0); + }; + return TransformElements(builder, ty, transform, args[0]); +} + +ConstEval::Result ConstEval::cosh(const sem::Type* ty, + utils::VectorRef args, + const Source&) { + auto transform = [&](const sem::Constant* c0) { + auto create = [&](auto i) -> ImplResult { + using NumberT = decltype(i); + return CreateElement(builder, c0->Type(), NumberT(std::cosh(i.value))); + }; + return Dispatch_fa_f32_f16(create, c0); + }; + return TransformElements(builder, ty, transform, args[0]); +} + ConstEval::Result ConstEval::countLeadingZeros(const sem::Type* ty, utils::VectorRef args, const Source&) { diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h index 1d1be15882..bd93f99153 100644 --- a/src/tint/resolver/const_eval.h +++ b/src/tint/resolver/const_eval.h @@ -485,6 +485,24 @@ class ConstEval { utils::VectorRef args, const Source& source); + /// cos builtin + /// @param ty the expression type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the result value, or null if the value cannot be calculated + Result cos(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + + /// cosh builtin + /// @param ty the expression type + /// @param args the input arguments + /// @param source the source location of the conversion + /// @return the result value, or null if the value cannot be calculated + Result cosh(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + /// countLeadingZeros builtin /// @param ty the expression type /// @param args the input arguments diff --git a/src/tint/resolver/const_eval_builtin_test.cc b/src/tint/resolver/const_eval_builtin_test.cc index 10e1d6646a..fe40cdca36 100644 --- a/src/tint/resolver/const_eval_builtin_test.cc +++ b/src/tint/resolver/const_eval_builtin_test.cc @@ -685,6 +685,51 @@ INSTANTIATE_TEST_SUITE_P( // ClampCases(), ClampCases())))); +template +std::vector CosCases() { + std::vector cases = { + C({-T(0)}, T(1)), + C({T(0)}, T(1)), + + C({T(0.75)}, T(0.7316888689)).FloatComp(), + + // Vector test + C({Vec(T(0), -T(0), T(0.75))}, Vec(T(1), T(1), T(0.7316888689))).FloatComp(), + }; + + return cases; +} +INSTANTIATE_TEST_SUITE_P( // + Cos, + ResolverConstEvalBuiltinTest, + testing::Combine(testing::Values(sem::BuiltinType::kCos), + testing::ValuesIn(Concat(CosCases(), // + CosCases(), + CosCases())))); + +template +std::vector CoshCases() { + std::vector cases = { + C({T(0)}, T(1)), + C({-T(0)}, T(1)), + C({T(1)}, T(1.5430806348)).FloatComp(), + + C({T(.75)}, T(1.2946832847)).FloatComp(), + + // Vector tests + C({Vec(T(0), -T(0), T(1))}, Vec(T(1), T(1), T(1.5430806348))).FloatComp(), + }; + + return cases; +} +INSTANTIATE_TEST_SUITE_P( // + Cosh, + ResolverConstEvalBuiltinTest, + testing::Combine(testing::Values(sem::BuiltinType::kCosh), + testing::ValuesIn(Concat(CoshCases(), // + CoshCases(), + CoshCases())))); + template std::vector CountLeadingZerosCases() { using B = BitValues; diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl index d6df7d58b0..8c200054ea 100644 --- a/src/tint/resolver/intrinsic_table.inl +++ b/src/tint/resolver/intrinsic_table.inl @@ -12777,48 +12777,48 @@ constexpr OverloadInfo kOverloads[] = { /* num parameters */ 1, /* num template types */ 1, /* num template numbers */ 0, - /* template types */ &kTemplateTypes[25], + /* template types */ &kTemplateTypes[24], /* template numbers */ &kTemplateNumbers[10], /* parameters */ &kParameters[856], /* return matcher indices */ &kMatcherIndices[1], /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), - /* const eval */ nullptr, + /* const eval */ &ConstEval::cos, }, { /* [371] */ /* num parameters */ 1, /* num template types */ 1, /* num template numbers */ 1, - /* template types */ &kTemplateTypes[25], + /* template types */ &kTemplateTypes[24], /* template numbers */ &kTemplateNumbers[5], /* parameters */ &kParameters[855], /* return matcher indices */ &kMatcherIndices[30], /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), - /* const eval */ nullptr, + /* const eval */ &ConstEval::cos, }, { /* [372] */ /* num parameters */ 1, /* num template types */ 1, /* num template numbers */ 0, - /* template types */ &kTemplateTypes[25], + /* template types */ &kTemplateTypes[24], /* template numbers */ &kTemplateNumbers[10], /* parameters */ &kParameters[854], /* return matcher indices */ &kMatcherIndices[1], /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), - /* const eval */ nullptr, + /* const eval */ &ConstEval::cosh, }, { /* [373] */ /* num parameters */ 1, /* num template types */ 1, /* num template numbers */ 1, - /* template types */ &kTemplateTypes[25], + /* template types */ &kTemplateTypes[24], /* template numbers */ &kTemplateNumbers[5], /* parameters */ &kParameters[853], /* return matcher indices */ &kMatcherIndices[30], /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), - /* const eval */ nullptr, + /* const eval */ &ConstEval::cosh, }, { /* [374] */ @@ -14103,15 +14103,15 @@ constexpr IntrinsicInfo kBuiltins[] = { }, { /* [13] */ - /* fn cos(T) -> T */ - /* fn cos(vec) -> vec */ + /* fn cos(@test_value(0) T) -> T */ + /* fn cos(@test_value(0) vec) -> vec */ /* num overloads */ 2, /* overloads */ &kOverloads[370], }, { /* [14] */ - /* fn cosh(T) -> T */ - /* fn cosh(vec) -> vec */ + /* fn cosh(@test_value(0) T) -> T */ + /* fn cosh(@test_value(0) vec) -> vec */ /* num overloads */ 2, /* overloads */ &kOverloads[372], }, diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl index 658ff3ffb1..d1d62e3732 100644 --- a/test/tint/builtins/gen/literal/cos/0835a8.wgsl +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cos(vec<3, f16>) -> vec<3, f16> fn cos_0835a8() { - var res: vec3 = cos(vec3(1.h)); + var res: vec3 = cos(vec3(0.h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.dxc.hlsl index 41ab0488a4..d8034aae13 100644 --- a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_0835a8() { - vector res = cos((float16_t(1.0h)).xxx); + vector res = (float16_t(1.0h)).xxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.glsl index 50495bb5ac..5dac11b003 100644 --- a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cos_0835a8() { - f16vec3 res = cos(f16vec3(1.0hf)); + f16vec3 res = f16vec3(1.0hf); } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void cos_0835a8() { - f16vec3 res = cos(f16vec3(1.0hf)); + f16vec3 res = f16vec3(1.0hf); } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cos_0835a8() { - f16vec3 res = cos(f16vec3(1.0hf)); + f16vec3 res = f16vec3(1.0hf); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.msl index 3f5c8a13d4..3c7c2be852 100644 --- a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_0835a8() { - half3 res = cos(half3(1.0h)); + half3 res = half3(1.0h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.spvasm index 1ea6d2667c..a7fdda5bde 100644 --- a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.spvasm @@ -1,14 +1,13 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 34 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,37 +37,36 @@ %half = OpTypeFloat 16 %v3half = OpTypeVector %half 3 %half_0x1p_0 = OpConstant %half 0x1p+0 - %18 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %16 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %_ptr_Function_v3half = OpTypePointer Function %v3half - %21 = OpConstantNull %v3half - %22 = OpTypeFunction %v4float + %19 = OpConstantNull %v3half + %20 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cos_0835a8 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v3half Function %21 - %13 = OpExtInst %v3half %16 Cos %18 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v3half Function %19 + OpStore %res %16 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %cos_0835a8 +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_0835a8 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cos_0835a8 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_0835a8 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cos_0835a8 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_0835a8 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.wgsl index 6ef5216d4f..5ffc3a059a 100644 --- a/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cos/0835a8.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cos_0835a8() { - var res : vec3 = cos(vec3(1.0h)); + var res : vec3 = cos(vec3(0.0h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl index 661ceb1b15..391b81e376 100644 --- a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cos(vec<4, f16>) -> vec<4, f16> fn cos_0a89f7() { - var res: vec4 = cos(vec4(1.h)); + var res: vec4 = cos(vec4(0.h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.dxc.hlsl index 65a7dc437c..5539b63a77 100644 --- a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_0a89f7() { - vector res = cos((float16_t(1.0h)).xxxx); + vector res = (float16_t(1.0h)).xxxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.glsl index acc022218d..6409128535 100644 --- a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cos_0a89f7() { - f16vec4 res = cos(f16vec4(1.0hf)); + f16vec4 res = f16vec4(1.0hf); } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void cos_0a89f7() { - f16vec4 res = cos(f16vec4(1.0hf)); + f16vec4 res = f16vec4(1.0hf); } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cos_0a89f7() { - f16vec4 res = cos(f16vec4(1.0hf)); + f16vec4 res = f16vec4(1.0hf); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.msl index d8c7d2426a..6498f29a62 100644 --- a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_0a89f7() { - half4 res = cos(half4(1.0h)); + half4 res = half4(1.0h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.spvasm index 0f37534982..d18e77507f 100644 --- a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.spvasm @@ -1,14 +1,13 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 34 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,37 +37,36 @@ %half = OpTypeFloat 16 %v4half = OpTypeVector %half 4 %half_0x1p_0 = OpConstant %half 0x1p+0 - %18 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %16 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %_ptr_Function_v4half = OpTypePointer Function %v4half - %21 = OpConstantNull %v4half - %22 = OpTypeFunction %v4float + %19 = OpConstantNull %v4half + %20 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cos_0a89f7 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v4half Function %21 - %13 = OpExtInst %v4half %16 Cos %18 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v4half Function %19 + OpStore %res %16 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %cos_0a89f7 +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_0a89f7 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cos_0a89f7 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_0a89f7 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cos_0a89f7 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_0a89f7 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.wgsl index 2617a7f81c..79f9568302 100644 --- a/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cos/0a89f7.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cos_0a89f7() { - var res : vec4 = cos(vec4(1.0h)); + var res : vec4 = cos(vec4(0.0h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl index 10964b4ef3..020b64f8c6 100644 --- a/test/tint/builtins/gen/literal/cos/16dc15.wgsl +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl @@ -23,7 +23,7 @@ // fn cos(vec<3, f32>) -> vec<3, f32> fn cos_16dc15() { - var res: vec3 = cos(vec3(1.f)); + var res: vec3 = cos(vec3(0.f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.dxc.hlsl index 1a92b74610..939a4bd8d1 100644 --- a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_16dc15() { - float3 res = cos((1.0f).xxx); + float3 res = (1.0f).xxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.fxc.hlsl index 1a92b74610..939a4bd8d1 100644 --- a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cos_16dc15() { - float3 res = cos((1.0f).xxx); + float3 res = (1.0f).xxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.glsl index 9d03c9ebb7..c269742533 100644 --- a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cos_16dc15() { - vec3 res = cos(vec3(1.0f)); + vec3 res = vec3(1.0f); } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void cos_16dc15() { - vec3 res = cos(vec3(1.0f)); + vec3 res = vec3(1.0f); } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void cos_16dc15() { - vec3 res = cos(vec3(1.0f)); + vec3 res = vec3(1.0f); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.msl index e93c8db520..9965150a29 100644 --- a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_16dc15() { - float3 res = cos(float3(1.0f)); + float3 res = float3(1.0f); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.spvasm index 6909542830..3e664f2204 100644 --- a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 32 ; Schema: 0 OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -33,36 +32,35 @@ %9 = OpTypeFunction %void %v3float = OpTypeVector %float 3 %float_1 = OpConstant %float 1 - %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 %_ptr_Function_v3float = OpTypePointer Function %v3float - %20 = OpConstantNull %v3float - %21 = OpTypeFunction %v4float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float %cos_16dc15 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %20 - %13 = OpExtInst %v3float %15 Cos %17 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %cos_16dc15 +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_16dc15 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cos_16dc15 + %27 = OpLabel + %28 = OpFunctionCall %void %cos_16dc15 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %cos_16dc15 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_16dc15 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.wgsl index ef3e9a25e8..e3c1486f2c 100644 --- a/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cos/16dc15.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cos_16dc15() { - var res : vec3 = cos(vec3(1.0f)); + var res : vec3 = cos(vec3(0.0f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl index cb0bcf592e..4e87050fbf 100644 --- a/test/tint/builtins/gen/literal/cos/29d66d.wgsl +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl @@ -23,7 +23,7 @@ // fn cos(vec<4, f32>) -> vec<4, f32> fn cos_29d66d() { - var res: vec4 = cos(vec4(1.f)); + var res: vec4 = cos(vec4(0.f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.dxc.hlsl index c0cdea9312..a0efab19cc 100644 --- a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_29d66d() { - float4 res = cos((1.0f).xxxx); + float4 res = (1.0f).xxxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.fxc.hlsl index c0cdea9312..a0efab19cc 100644 --- a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cos_29d66d() { - float4 res = cos((1.0f).xxxx); + float4 res = (1.0f).xxxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.glsl index 9dfa5c949f..32ebb3a266 100644 --- a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cos_29d66d() { - vec4 res = cos(vec4(1.0f)); + vec4 res = vec4(1.0f); } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void cos_29d66d() { - vec4 res = cos(vec4(1.0f)); + vec4 res = vec4(1.0f); } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void cos_29d66d() { - vec4 res = cos(vec4(1.0f)); + vec4 res = vec4(1.0f); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.msl index 055aad554a..0bcf095507 100644 --- a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_29d66d() { - float4 res = cos(float4(1.0f)); + float4 res = float4(1.0f); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.spvasm index 2b5cebc1a9..fdd927cf75 100644 --- a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 30 ; Schema: 0 OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -32,35 +31,34 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %float_1 = OpConstant %float 1 - %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %_ptr_Function_v4float = OpTypePointer Function %v4float - %19 = OpTypeFunction %v4float + %17 = OpTypeFunction %v4float %cos_29d66d = OpFunction %void None %9 %12 = OpLabel %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Cos %16 - OpStore %res %13 + OpStore %res %14 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %cos_29d66d +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %cos_29d66d OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %void %cos_29d66d + %25 = OpLabel + %26 = OpFunctionCall %void %cos_29d66d OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %cos_29d66d + %28 = OpLabel + %29 = OpFunctionCall %void %cos_29d66d OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.wgsl index fe681bef56..f1e7ea0d0f 100644 --- a/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cos/29d66d.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cos_29d66d() { - var res : vec4 = cos(vec4(1.0f)); + var res : vec4 = cos(vec4(0.0f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/47d768.wgsl b/test/tint/builtins/gen/literal/cos/47d768.wgsl new file mode 100644 index 0000000000..af5450356b --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/47d768.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<4, fa>) -> vec<4, fa> +fn cos_47d768() { + var res = cos(vec4(0.)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_47d768(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_47d768(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_47d768(); +} diff --git a/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e60270e372 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_47d768() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_47d768(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_47d768(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_47d768(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e60270e372 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_47d768() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_47d768(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_47d768(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_47d768(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.glsl new file mode 100644 index 0000000000..7df432a234 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_47d768() { + vec4 res = vec4(1.0f); +} + +vec4 vertex_main() { + cos_47d768(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_47d768() { + vec4 res = vec4(1.0f); +} + +void fragment_main() { + cos_47d768(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_47d768() { + vec4 res = vec4(1.0f); +} + +void compute_main() { + cos_47d768(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.msl new file mode 100644 index 0000000000..664fd805b8 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_47d768() { + float4 res = float4(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_47d768(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_47d768(); + return; +} + +kernel void compute_main() { + cos_47d768(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.spvasm new file mode 100644 index 0000000000..0dfefb2fce --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_47d768 "cos_47d768" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float + %cos_47d768 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %cos_47d768 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %void %cos_47d768 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cos_47d768 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.wgsl new file mode 100644 index 0000000000..b75843933b --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/47d768.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cos_47d768() { + var res = cos(vec4(0.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_47d768(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_47d768(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_47d768(); +} diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl index 5bb51fa2c2..36f9ccb1c6 100644 --- a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cos(vec<2, f16>) -> vec<2, f16> fn cos_5bc2c6() { - var res: vec2 = cos(vec2(1.h)); + var res: vec2 = cos(vec2(0.h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.dxc.hlsl index 2bf3bea507..2003bbfbee 100644 --- a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_5bc2c6() { - vector res = cos((float16_t(1.0h)).xx); + vector res = (float16_t(1.0h)).xx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.glsl index e0f5f471bf..3c24e5601f 100644 --- a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cos_5bc2c6() { - f16vec2 res = cos(f16vec2(1.0hf)); + f16vec2 res = f16vec2(1.0hf); } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void cos_5bc2c6() { - f16vec2 res = cos(f16vec2(1.0hf)); + f16vec2 res = f16vec2(1.0hf); } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cos_5bc2c6() { - f16vec2 res = cos(f16vec2(1.0hf)); + f16vec2 res = f16vec2(1.0hf); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.msl index 96d7029d7a..469a84f2a2 100644 --- a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_5bc2c6() { - half2 res = cos(half2(1.0h)); + half2 res = half2(1.0h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.spvasm index 3ad7b966ee..5935f706c4 100644 --- a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.spvasm @@ -1,14 +1,13 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 34 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,37 +37,36 @@ %half = OpTypeFloat 16 %v2half = OpTypeVector %half 2 %half_0x1p_0 = OpConstant %half 0x1p+0 - %18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %16 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 %_ptr_Function_v2half = OpTypePointer Function %v2half - %21 = OpConstantNull %v2half - %22 = OpTypeFunction %v4float + %19 = OpConstantNull %v2half + %20 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cos_5bc2c6 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v2half Function %21 - %13 = OpExtInst %v2half %16 Cos %18 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v2half Function %19 + OpStore %res %16 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %cos_5bc2c6 +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cos_5bc2c6 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cos_5bc2c6 + %29 = OpLabel + %30 = OpFunctionCall %void %cos_5bc2c6 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cos_5bc2c6 + %32 = OpLabel + %33 = OpFunctionCall %void %cos_5bc2c6 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.wgsl index fc78f888ea..d8bcd66f67 100644 --- a/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cos/5bc2c6.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cos_5bc2c6() { - var res : vec2 = cos(vec2(1.0h)); + var res : vec2 = cos(vec2(0.0h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl new file mode 100644 index 0000000000..765254e6a8 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<3, fa>) -> vec<3, fa> +fn cos_6b1fdf() { + var res = cos(vec3(0.)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_6b1fdf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_6b1fdf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_6b1fdf(); +} diff --git a/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..889d228074 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_6b1fdf() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_6b1fdf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_6b1fdf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_6b1fdf(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..889d228074 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_6b1fdf() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_6b1fdf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_6b1fdf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_6b1fdf(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.glsl new file mode 100644 index 0000000000..0d745deb66 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_6b1fdf() { + vec3 res = vec3(1.0f); +} + +vec4 vertex_main() { + cos_6b1fdf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_6b1fdf() { + vec3 res = vec3(1.0f); +} + +void fragment_main() { + cos_6b1fdf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_6b1fdf() { + vec3 res = vec3(1.0f); +} + +void compute_main() { + cos_6b1fdf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.msl new file mode 100644 index 0000000000..e4855df6f0 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_6b1fdf() { + float3 res = float3(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_6b1fdf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_6b1fdf(); + return; +} + +kernel void compute_main() { + cos_6b1fdf(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5ebbe189c --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_6b1fdf "cos_6b1fdf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float + %cos_6b1fdf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_6b1fdf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cos_6b1fdf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_6b1fdf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.wgsl new file mode 100644 index 0000000000..3287606dc6 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/6b1fdf.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cos_6b1fdf() { + var res = cos(vec3(0.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_6b1fdf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_6b1fdf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_6b1fdf(); +} diff --git a/test/tint/builtins/gen/literal/cos/a297d4.wgsl b/test/tint/builtins/gen/literal/cos/a297d4.wgsl new file mode 100644 index 0000000000..b53ac0a0f7 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/a297d4.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(fa) -> fa +fn cos_a297d4() { + var res = cos(0.); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_a297d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_a297d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_a297d4(); +} diff --git a/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..94ef8f55e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_a297d4() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_a297d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_a297d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_a297d4(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..94ef8f55e2 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_a297d4() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_a297d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_a297d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_a297d4(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.glsl new file mode 100644 index 0000000000..77e46e1e05 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_a297d4() { + float res = 1.0f; +} + +vec4 vertex_main() { + cos_a297d4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_a297d4() { + float res = 1.0f; +} + +void fragment_main() { + cos_a297d4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_a297d4() { + float res = 1.0f; +} + +void compute_main() { + cos_a297d4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.msl new file mode 100644 index 0000000000..648c3c38ff --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_a297d4() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_a297d4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_a297d4(); + return; +} + +kernel void compute_main() { + cos_a297d4(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..985a350e75 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_a297d4 "cos_a297d4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float + %cos_a297d4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %cos_a297d4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_a297d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cos_a297d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c4a12fd2b --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/a297d4.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cos_a297d4() { + var res = cos(0.0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_a297d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_a297d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_a297d4(); +} diff --git a/test/tint/builtins/gen/literal/cos/af7447.wgsl b/test/tint/builtins/gen/literal/cos/af7447.wgsl new file mode 100644 index 0000000000..c8213a051d --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/af7447.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<2, fa>) -> vec<2, fa> +fn cos_af7447() { + var res = cos(vec2(0.)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_af7447(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_af7447(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_af7447(); +} diff --git a/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d4a7fe35b --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_af7447() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_af7447(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_af7447(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_af7447(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d4a7fe35b --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_af7447() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_af7447(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_af7447(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_af7447(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.glsl new file mode 100644 index 0000000000..3f2d50ab1c --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_af7447() { + vec2 res = vec2(1.0f); +} + +vec4 vertex_main() { + cos_af7447(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_af7447() { + vec2 res = vec2(1.0f); +} + +void fragment_main() { + cos_af7447(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_af7447() { + vec2 res = vec2(1.0f); +} + +void compute_main() { + cos_af7447(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.msl new file mode 100644 index 0000000000..fd43f63c03 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_af7447() { + float2 res = float2(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_af7447(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_af7447(); + return; +} + +kernel void compute_main() { + cos_af7447(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.spvasm new file mode 100644 index 0000000000..b9c469c6c0 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_af7447 "cos_af7447" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float + %cos_af7447 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_af7447 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cos_af7447 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_af7447 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.wgsl new file mode 100644 index 0000000000..739b4669f1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cos/af7447.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cos_af7447() { + var res = cos(vec2(0.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_af7447(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_af7447(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_af7447(); +} diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl index b1bf2ab65a..92de1ad14e 100644 --- a/test/tint/builtins/gen/literal/cos/c3b486.wgsl +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl @@ -23,7 +23,7 @@ // fn cos(vec<2, f32>) -> vec<2, f32> fn cos_c3b486() { - var res: vec2 = cos(vec2(1.f)); + var res: vec2 = cos(vec2(0.f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.dxc.hlsl index c6ad101ccc..bb4ac5862e 100644 --- a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_c3b486() { - float2 res = cos((1.0f).xx); + float2 res = (1.0f).xx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.fxc.hlsl index c6ad101ccc..bb4ac5862e 100644 --- a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cos_c3b486() { - float2 res = cos((1.0f).xx); + float2 res = (1.0f).xx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.glsl index c55e085334..c2b8ff32a3 100644 --- a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cos_c3b486() { - vec2 res = cos(vec2(1.0f)); + vec2 res = vec2(1.0f); } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void cos_c3b486() { - vec2 res = cos(vec2(1.0f)); + vec2 res = vec2(1.0f); } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void cos_c3b486() { - vec2 res = cos(vec2(1.0f)); + vec2 res = vec2(1.0f); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.msl index 1bf56af6f1..554b52f802 100644 --- a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_c3b486() { - float2 res = cos(float2(1.0f)); + float2 res = float2(1.0f); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.spvasm index 5ab12d312c..8807cefaa7 100644 --- a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 32 ; Schema: 0 OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -33,36 +32,35 @@ %9 = OpTypeFunction %void %v2float = OpTypeVector %float 2 %float_1 = OpConstant %float 1 - %17 = OpConstantComposite %v2float %float_1 %float_1 + %15 = OpConstantComposite %v2float %float_1 %float_1 %_ptr_Function_v2float = OpTypePointer Function %v2float - %20 = OpConstantNull %v2float - %21 = OpTypeFunction %v4float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float %cos_c3b486 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %20 - %13 = OpExtInst %v2float %15 Cos %17 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %cos_c3b486 +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_c3b486 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cos_c3b486 + %27 = OpLabel + %28 = OpFunctionCall %void %cos_c3b486 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %cos_c3b486 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_c3b486 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.wgsl index 57052ea7ce..6f0ceaef71 100644 --- a/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cos/c3b486.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cos_c3b486() { - var res : vec2 = cos(vec2(1.0f)); + var res : vec2 = cos(vec2(0.0f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl index b13516c23d..01d13a8fe1 100644 --- a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl @@ -23,7 +23,7 @@ // fn cos(f32) -> f32 fn cos_c5c28e() { - var res: f32 = cos(1.f); + var res: f32 = cos(0.f); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.dxc.hlsl index 46c1272145..c4c6dd1881 100644 --- a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_c5c28e() { - float res = cos(1.0f); + float res = 1.0f; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.fxc.hlsl index 46c1272145..c4c6dd1881 100644 --- a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cos_c5c28e() { - float res = cos(1.0f); + float res = 1.0f; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.glsl index 44893f8e8d..ae88f393cc 100644 --- a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cos_c5c28e() { - float res = cos(1.0f); + float res = 1.0f; } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void cos_c5c28e() { - float res = cos(1.0f); + float res = 1.0f; } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void cos_c5c28e() { - float res = cos(1.0f); + float res = 1.0f; } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.msl index 2fc7d06480..f4d033fada 100644 --- a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_c5c28e() { - float res = cos(1.0f); + float res = 1.0f; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.spvasm index 7964abf3f8..6305ec3c58 100644 --- a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 29 ; Schema: 0 OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -33,33 +32,32 @@ %9 = OpTypeFunction %void %float_1 = OpConstant %float 1 %_ptr_Function_float = OpTypePointer Function %float - %18 = OpTypeFunction %v4float + %16 = OpTypeFunction %v4float %cos_c5c28e = OpFunction %void None %9 %12 = OpLabel %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Cos %float_1 - OpStore %res %13 + OpStore %res %float_1 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %cos_c5c28e +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %cos_c5c28e OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %cos_c5c28e + %24 = OpLabel + %25 = OpFunctionCall %void %cos_c5c28e OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cos_c5c28e + %27 = OpLabel + %28 = OpFunctionCall %void %cos_c5c28e OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.wgsl index 5b9b508d85..6b5f9a1b5c 100644 --- a/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cos/c5c28e.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cos_c5c28e() { - var res : f32 = cos(1.0f); + var res : f32 = cos(0.0f); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl index d1adddbf52..2f4cc35125 100644 --- a/test/tint/builtins/gen/literal/cos/fc047d.wgsl +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cos(f16) -> f16 fn cos_fc047d() { - var res: f16 = cos(1.h); + var res: f16 = cos(0.h); } @vertex diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.dxc.hlsl index 7064a16ad1..cd55028088 100644 --- a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_fc047d() { - float16_t res = cos(float16_t(1.0h)); + float16_t res = float16_t(1.0h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.glsl index 83be5ac455..9e9407a3fa 100644 --- a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cos_fc047d() { - float16_t res = cos(1.0hf); + float16_t res = 1.0hf; } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void cos_fc047d() { - float16_t res = cos(1.0hf); + float16_t res = 1.0hf; } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cos_fc047d() { - float16_t res = cos(1.0hf); + float16_t res = 1.0hf; } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.msl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.msl index e2a8560680..eb7ce569d4 100644 --- a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_fc047d() { - half res = cos(1.0h); + half res = 1.0h; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.spvasm index 7ddb4157a1..6df5d099b1 100644 --- a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.spvasm @@ -1,14 +1,13 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 32 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %15 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,35 +37,34 @@ %half = OpTypeFloat 16 %half_0x1p_0 = OpConstant %half 0x1p+0 %_ptr_Function_half = OpTypePointer Function %half - %19 = OpConstantNull %half - %20 = OpTypeFunction %v4float + %17 = OpConstantNull %half + %18 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cos_fc047d = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_half Function %19 - %13 = OpExtInst %half %15 Cos %half_0x1p_0 - OpStore %res %13 + %res = OpVariable %_ptr_Function_half Function %17 + OpStore %res %half_0x1p_0 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %cos_fc047d +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %cos_fc047d OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cos_fc047d + %27 = OpLabel + %28 = OpFunctionCall %void %cos_fc047d OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %cos_fc047d + %30 = OpLabel + %31 = OpFunctionCall %void %cos_fc047d OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.wgsl index 390ba278c8..49035a210f 100644 --- a/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cos/fc047d.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cos_fc047d() { - var res : f16 = cos(1.0h); + var res : f16 = cos(0.0h); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl index 661f836c74..99f24cf153 100644 --- a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cosh(f16) -> f16 fn cosh_2ed778() { - var res: f16 = cosh(1.h); + var res: f16 = cosh(0.h); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.dxc.hlsl index 7ad4887173..aa3e8ab6da 100644 --- a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_2ed778() { - float16_t res = cosh(float16_t(1.0h)); + float16_t res = float16_t(1.0h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.glsl index 976d9521cf..6401b27cf0 100644 --- a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cosh_2ed778() { - float16_t res = cosh(1.0hf); + float16_t res = 1.0hf; } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void cosh_2ed778() { - float16_t res = cosh(1.0hf); + float16_t res = 1.0hf; } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cosh_2ed778() { - float16_t res = cosh(1.0hf); + float16_t res = 1.0hf; } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.msl index 32e7d120bf..7b3f1f8599 100644 --- a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_2ed778() { - half res = cosh(1.0h); + half res = 1.0h; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.spvasm index 1495e9fa80..ed1cf22a1b 100644 --- a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.spvasm @@ -1,14 +1,13 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 32 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %15 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,35 +37,34 @@ %half = OpTypeFloat 16 %half_0x1p_0 = OpConstant %half 0x1p+0 %_ptr_Function_half = OpTypePointer Function %half - %19 = OpConstantNull %half - %20 = OpTypeFunction %v4float + %17 = OpConstantNull %half + %18 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cosh_2ed778 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_half Function %19 - %13 = OpExtInst %half %15 Cosh %half_0x1p_0 - OpStore %res %13 + %res = OpVariable %_ptr_Function_half Function %17 + OpStore %res %half_0x1p_0 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %cosh_2ed778 +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %cosh_2ed778 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cosh_2ed778 + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_2ed778 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %cosh_2ed778 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_2ed778 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.wgsl index c710cf767d..3da45546cf 100644 --- a/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cosh/2ed778.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cosh_2ed778() { - var res : f16 = cosh(1.0h); + var res : f16 = cosh(0.0h); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl b/test/tint/builtins/gen/literal/cosh/377652.wgsl index 03659adab1..e53b8e4fdb 100644 --- a/test/tint/builtins/gen/literal/cosh/377652.wgsl +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl @@ -23,7 +23,7 @@ // fn cosh(vec<3, f32>) -> vec<3, f32> fn cosh_377652() { - var res: vec3 = cosh(vec3(1.f)); + var res: vec3 = cosh(vec3(0.f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.dxc.hlsl index d707c4b5cf..d5ecfdfdef 100644 --- a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_377652() { - float3 res = cosh((1.0f).xxx); + float3 res = (1.0f).xxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.fxc.hlsl index d707c4b5cf..d5ecfdfdef 100644 --- a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cosh_377652() { - float3 res = cosh((1.0f).xxx); + float3 res = (1.0f).xxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.glsl index 838edd05fa..31b889c4af 100644 --- a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cosh_377652() { - vec3 res = cosh(vec3(1.0f)); + vec3 res = vec3(1.0f); } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void cosh_377652() { - vec3 res = cosh(vec3(1.0f)); + vec3 res = vec3(1.0f); } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void cosh_377652() { - vec3 res = cosh(vec3(1.0f)); + vec3 res = vec3(1.0f); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.msl index 22932f1ef7..06053cca12 100644 --- a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_377652() { - float3 res = cosh(float3(1.0f)); + float3 res = float3(1.0f); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.spvasm index 33b3840e7d..b5bd5e780a 100644 --- a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 32 ; Schema: 0 OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -33,36 +32,35 @@ %9 = OpTypeFunction %void %v3float = OpTypeVector %float 3 %float_1 = OpConstant %float 1 - %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 %_ptr_Function_v3float = OpTypePointer Function %v3float - %20 = OpConstantNull %v3float - %21 = OpTypeFunction %v4float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float %cosh_377652 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %20 - %13 = OpExtInst %v3float %15 Cosh %17 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %cosh_377652 +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_377652 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cosh_377652 + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_377652 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %cosh_377652 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_377652 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.wgsl index 250df0b12d..f2b02741a2 100644 --- a/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cosh/377652.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cosh_377652() { - var res : vec3 = cosh(vec3(1.0f)); + var res : vec3 = cosh(vec3(0.0f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl index d42f4b236d..93fe211b41 100644 --- a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cosh(vec<4, f16>) -> vec<4, f16> fn cosh_3b7bbf() { - var res: vec4 = cosh(vec4(1.h)); + var res: vec4 = cosh(vec4(0.h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.dxc.hlsl index 384a1ed0b6..46fb351eb9 100644 --- a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_3b7bbf() { - vector res = cosh((float16_t(1.0h)).xxxx); + vector res = (float16_t(1.0h)).xxxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.glsl index d3f5e3f297..c4d1c07a3c 100644 --- a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cosh_3b7bbf() { - f16vec4 res = cosh(f16vec4(1.0hf)); + f16vec4 res = f16vec4(1.0hf); } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void cosh_3b7bbf() { - f16vec4 res = cosh(f16vec4(1.0hf)); + f16vec4 res = f16vec4(1.0hf); } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cosh_3b7bbf() { - f16vec4 res = cosh(f16vec4(1.0hf)); + f16vec4 res = f16vec4(1.0hf); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.msl index 84b1af2e21..485c537472 100644 --- a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_3b7bbf() { - half4 res = cosh(half4(1.0h)); + half4 res = half4(1.0h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.spvasm index fce9adab4a..41e08ab16e 100644 --- a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.spvasm @@ -1,14 +1,13 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 34 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,37 +37,36 @@ %half = OpTypeFloat 16 %v4half = OpTypeVector %half 4 %half_0x1p_0 = OpConstant %half 0x1p+0 - %18 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %16 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %_ptr_Function_v4half = OpTypePointer Function %v4half - %21 = OpConstantNull %v4half - %22 = OpTypeFunction %v4float + %19 = OpConstantNull %v4half + %20 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cosh_3b7bbf = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v4half Function %21 - %13 = OpExtInst %v4half %16 Cosh %18 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v4half Function %19 + OpStore %res %16 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %cosh_3b7bbf +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_3b7bbf OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cosh_3b7bbf + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_3b7bbf OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cosh_3b7bbf + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_3b7bbf OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.wgsl index 37fbc9172d..acb612d146 100644 --- a/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cosh/3b7bbf.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cosh_3b7bbf() { - var res : vec4 = cosh(vec4(1.0h)); + var res : vec4 = cosh(vec4(0.0h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/432645.wgsl b/test/tint/builtins/gen/literal/cosh/432645.wgsl new file mode 100644 index 0000000000..cff809085f --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/432645.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<2, fa>) -> vec<2, fa> +fn cosh_432645() { + var res = cosh(vec2(0.)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_432645(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_432645(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_432645(); +} diff --git a/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f17e79e9bb --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_432645() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_432645(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_432645(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_432645(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f17e79e9bb --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_432645() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_432645(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_432645(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_432645(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.glsl new file mode 100644 index 0000000000..2cec246557 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_432645() { + vec2 res = vec2(1.0f); +} + +vec4 vertex_main() { + cosh_432645(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_432645() { + vec2 res = vec2(1.0f); +} + +void fragment_main() { + cosh_432645(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_432645() { + vec2 res = vec2(1.0f); +} + +void compute_main() { + cosh_432645(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.msl new file mode 100644 index 0000000000..ef670b71ea --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_432645() { + float2 res = float2(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_432645(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_432645(); + return; +} + +kernel void compute_main() { + cosh_432645(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.spvasm new file mode 100644 index 0000000000..7db73f65b9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_432645 "cosh_432645" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float +%cosh_432645 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_432645 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_432645 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_432645 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.wgsl new file mode 100644 index 0000000000..3c76863689 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/432645.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cosh_432645() { + var res = cosh(vec2(0.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_432645(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_432645(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_432645(); +} diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl index 059f9f16ce..ddbe3b65d0 100644 --- a/test/tint/builtins/gen/literal/cosh/43b672.wgsl +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cosh(vec<2, f16>) -> vec<2, f16> fn cosh_43b672() { - var res: vec2 = cosh(vec2(1.h)); + var res: vec2 = cosh(vec2(0.h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.dxc.hlsl index 6034f72e36..55d0069eef 100644 --- a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_43b672() { - vector res = cosh((float16_t(1.0h)).xx); + vector res = (float16_t(1.0h)).xx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.glsl index ef9046b8c7..2bcb1b424e 100644 --- a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cosh_43b672() { - f16vec2 res = cosh(f16vec2(1.0hf)); + f16vec2 res = f16vec2(1.0hf); } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void cosh_43b672() { - f16vec2 res = cosh(f16vec2(1.0hf)); + f16vec2 res = f16vec2(1.0hf); } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cosh_43b672() { - f16vec2 res = cosh(f16vec2(1.0hf)); + f16vec2 res = f16vec2(1.0hf); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.msl index 9c17ff636e..4ec4a67d4f 100644 --- a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_43b672() { - half2 res = cosh(half2(1.0h)); + half2 res = half2(1.0h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.spvasm index 2fda139e63..3fb47b250c 100644 --- a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.spvasm @@ -1,14 +1,13 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 34 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,37 +37,36 @@ %half = OpTypeFloat 16 %v2half = OpTypeVector %half 2 %half_0x1p_0 = OpConstant %half 0x1p+0 - %18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %16 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 %_ptr_Function_v2half = OpTypePointer Function %v2half - %21 = OpConstantNull %v2half - %22 = OpTypeFunction %v4float + %19 = OpConstantNull %v2half + %20 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cosh_43b672 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v2half Function %21 - %13 = OpExtInst %v2half %16 Cosh %18 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v2half Function %19 + OpStore %res %16 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %cosh_43b672 +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_43b672 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cosh_43b672 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_43b672 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cosh_43b672 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_43b672 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.wgsl index 6b5901940c..866e760074 100644 --- a/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cosh/43b672.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cosh_43b672() { - var res : vec2 = cosh(vec2(1.0h)); + var res : vec2 = cosh(vec2(0.0h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl index 69df244596..3a7967e0fc 100644 --- a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cosh(vec<3, f16>) -> vec<3, f16> fn cosh_b1b8a0() { - var res: vec3 = cosh(vec3(1.h)); + var res: vec3 = cosh(vec3(0.h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.dxc.hlsl index 718e0ea453..1ff6dcbabd 100644 --- a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_b1b8a0() { - vector res = cosh((float16_t(1.0h)).xxx); + vector res = (float16_t(1.0h)).xxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.glsl index 9b5a615b0a..a2bf806c12 100644 --- a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cosh_b1b8a0() { - f16vec3 res = cosh(f16vec3(1.0hf)); + f16vec3 res = f16vec3(1.0hf); } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void cosh_b1b8a0() { - f16vec3 res = cosh(f16vec3(1.0hf)); + f16vec3 res = f16vec3(1.0hf); } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cosh_b1b8a0() { - f16vec3 res = cosh(f16vec3(1.0hf)); + f16vec3 res = f16vec3(1.0hf); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.msl index 0bf61439f0..4b5309443c 100644 --- a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_b1b8a0() { - half3 res = cosh(half3(1.0h)); + half3 res = half3(1.0h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.spvasm index e3491c5bf4..a5ccfc30f8 100644 --- a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.spvasm @@ -1,14 +1,13 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 34 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,37 +37,36 @@ %half = OpTypeFloat 16 %v3half = OpTypeVector %half 3 %half_0x1p_0 = OpConstant %half 0x1p+0 - %18 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %16 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %_ptr_Function_v3half = OpTypePointer Function %v3half - %21 = OpConstantNull %v3half - %22 = OpTypeFunction %v4float + %19 = OpConstantNull %v3half + %20 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cosh_b1b8a0 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v3half Function %21 - %13 = OpExtInst %v3half %16 Cosh %18 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v3half Function %19 + OpStore %res %16 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %cosh_b1b8a0 +%vertex_main_inner = OpFunction %v4float None %20 + %22 = OpLabel + %23 = OpFunctionCall %void %cosh_b1b8a0 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 + %25 = OpLabel + %26 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %26 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cosh_b1b8a0 + %29 = OpLabel + %30 = OpFunctionCall %void %cosh_b1b8a0 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cosh_b1b8a0 + %32 = OpLabel + %33 = OpFunctionCall %void %cosh_b1b8a0 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.wgsl index d81410751e..f9a1b332c0 100644 --- a/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cosh/b1b8a0.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cosh_b1b8a0() { - var res : vec3 = cosh(vec3(1.0h)); + var res : vec3 = cosh(vec3(0.0h)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl index fd951c04e9..afd07b670f 100644 --- a/test/tint/builtins/gen/literal/cosh/c13756.wgsl +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl @@ -23,7 +23,7 @@ // fn cosh(vec<2, f32>) -> vec<2, f32> fn cosh_c13756() { - var res: vec2 = cosh(vec2(1.f)); + var res: vec2 = cosh(vec2(0.f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.dxc.hlsl index 61f7c95da9..e2887bf823 100644 --- a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_c13756() { - float2 res = cosh((1.0f).xx); + float2 res = (1.0f).xx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.fxc.hlsl index 61f7c95da9..e2887bf823 100644 --- a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cosh_c13756() { - float2 res = cosh((1.0f).xx); + float2 res = (1.0f).xx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.glsl index 76e33c1d16..531ab81034 100644 --- a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cosh_c13756() { - vec2 res = cosh(vec2(1.0f)); + vec2 res = vec2(1.0f); } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void cosh_c13756() { - vec2 res = cosh(vec2(1.0f)); + vec2 res = vec2(1.0f); } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void cosh_c13756() { - vec2 res = cosh(vec2(1.0f)); + vec2 res = vec2(1.0f); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.msl index 95449a54b2..1e131e886c 100644 --- a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_c13756() { - float2 res = cosh(float2(1.0f)); + float2 res = float2(1.0f); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.spvasm index a250a0f184..6a1214ce93 100644 --- a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 32 ; Schema: 0 OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -33,36 +32,35 @@ %9 = OpTypeFunction %void %v2float = OpTypeVector %float 2 %float_1 = OpConstant %float 1 - %17 = OpConstantComposite %v2float %float_1 %float_1 + %15 = OpConstantComposite %v2float %float_1 %float_1 %_ptr_Function_v2float = OpTypePointer Function %v2float - %20 = OpConstantNull %v2float - %21 = OpTypeFunction %v4float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float %cosh_c13756 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %20 - %13 = OpExtInst %v2float %15 Cosh %17 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %cosh_c13756 +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_c13756 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cosh_c13756 + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_c13756 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %cosh_c13756 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_c13756 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.wgsl index 497dbbd4ef..3c1e237497 100644 --- a/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cosh/c13756.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cosh_c13756() { - var res : vec2 = cosh(vec2(1.0f)); + var res : vec2 = cosh(vec2(0.0f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/c892bb.wgsl b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl new file mode 100644 index 0000000000..ddd6cac36e --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(fa) -> fa +fn cosh_c892bb() { + var res = cosh(0.); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_c892bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_c892bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_c892bb(); +} diff --git a/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b014629d2b --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_c892bb() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_c892bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_c892bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_c892bb(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b014629d2b --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_c892bb() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_c892bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_c892bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_c892bb(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.glsl new file mode 100644 index 0000000000..d6ae3cdc9c --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_c892bb() { + float res = 1.0f; +} + +vec4 vertex_main() { + cosh_c892bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_c892bb() { + float res = 1.0f; +} + +void fragment_main() { + cosh_c892bb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_c892bb() { + float res = 1.0f; +} + +void compute_main() { + cosh_c892bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.msl new file mode 100644 index 0000000000..ef578081cf --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_c892bb() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_c892bb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_c892bb(); + return; +} + +kernel void compute_main() { + cosh_c892bb(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9fadf71bf --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_c892bb "cosh_c892bb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float +%cosh_c892bb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %cosh_c892bb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_c892bb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_c892bb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..955bd27de3 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/c892bb.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cosh_c892bb() { + var res = cosh(0.0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_c892bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_c892bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_c892bb(); +} diff --git a/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl new file mode 100644 index 0000000000..a4482f72fe --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<4, fa>) -> vec<4, fa> +fn cosh_d8dee7() { + var res = cosh(vec4(0.)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_d8dee7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_d8dee7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_d8dee7(); +} diff --git a/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6cf84f95ff --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_d8dee7() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_d8dee7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_d8dee7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_d8dee7(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6cf84f95ff --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_d8dee7() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_d8dee7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_d8dee7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_d8dee7(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.glsl new file mode 100644 index 0000000000..4f4b630be9 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_d8dee7() { + vec4 res = vec4(1.0f); +} + +vec4 vertex_main() { + cosh_d8dee7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_d8dee7() { + vec4 res = vec4(1.0f); +} + +void fragment_main() { + cosh_d8dee7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_d8dee7() { + vec4 res = vec4(1.0f); +} + +void compute_main() { + cosh_d8dee7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.msl new file mode 100644 index 0000000000..23ce015636 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_d8dee7() { + float4 res = float4(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_d8dee7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_d8dee7(); + return; +} + +kernel void compute_main() { + cosh_d8dee7(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba25f1a534 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_d8dee7 "cosh_d8dee7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float +%cosh_d8dee7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %cosh_d8dee7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %void %cosh_d8dee7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cosh_d8dee7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.wgsl new file mode 100644 index 0000000000..88ae016d10 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/d8dee7.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cosh_d8dee7() { + var res = cosh(vec4(0.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_d8dee7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_d8dee7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_d8dee7(); +} diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl index 6a495f236f..cc06b03753 100644 --- a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl @@ -23,7 +23,7 @@ // fn cosh(f32) -> f32 fn cosh_da92dd() { - var res: f32 = cosh(1.f); + var res: f32 = cosh(0.f); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.dxc.hlsl index 1b4f6c8d25..ed16a6fffa 100644 --- a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_da92dd() { - float res = cosh(1.0f); + float res = 1.0f; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.fxc.hlsl index 1b4f6c8d25..ed16a6fffa 100644 --- a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cosh_da92dd() { - float res = cosh(1.0f); + float res = 1.0f; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.glsl index 0d980ed6bb..ff31fba5a1 100644 --- a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cosh_da92dd() { - float res = cosh(1.0f); + float res = 1.0f; } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void cosh_da92dd() { - float res = cosh(1.0f); + float res = 1.0f; } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void cosh_da92dd() { - float res = cosh(1.0f); + float res = 1.0f; } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.msl index 9cc36ccc46..3f34091bb6 100644 --- a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_da92dd() { - float res = cosh(1.0f); + float res = 1.0f; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.spvasm index 23f91ec485..8892600f9b 100644 --- a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 29 ; Schema: 0 OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -33,33 +32,32 @@ %9 = OpTypeFunction %void %float_1 = OpConstant %float 1 %_ptr_Function_float = OpTypePointer Function %float - %18 = OpTypeFunction %v4float + %16 = OpTypeFunction %v4float %cosh_da92dd = OpFunction %void None %9 %12 = OpLabel %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Cosh %float_1 - OpStore %res %13 + OpStore %res %float_1 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %cosh_da92dd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %cosh_da92dd OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %cosh_da92dd + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_da92dd OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cosh_da92dd + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_da92dd OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.wgsl index fb310c1aee..becb8c78eb 100644 --- a/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cosh/da92dd.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cosh_da92dd() { - var res : f32 = cosh(1.0f); + var res : f32 = cosh(0.0f); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl index 8c398d92b0..5baed127b3 100644 --- a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl @@ -23,7 +23,7 @@ // fn cosh(vec<4, f32>) -> vec<4, f32> fn cosh_e0c1de() { - var res: vec4 = cosh(vec4(1.f)); + var res: vec4 = cosh(vec4(0.f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.dxc.hlsl index 713b746cc1..1cdac12ccc 100644 --- a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_e0c1de() { - float4 res = cosh((1.0f).xxxx); + float4 res = (1.0f).xxxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.fxc.hlsl index 713b746cc1..1cdac12ccc 100644 --- a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cosh_e0c1de() { - float4 res = cosh((1.0f).xxxx); + float4 res = (1.0f).xxxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.glsl index a7038c289d..27c6525f57 100644 --- a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cosh_e0c1de() { - vec4 res = cosh(vec4(1.0f)); + vec4 res = vec4(1.0f); } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void cosh_e0c1de() { - vec4 res = cosh(vec4(1.0f)); + vec4 res = vec4(1.0f); } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void cosh_e0c1de() { - vec4 res = cosh(vec4(1.0f)); + vec4 res = vec4(1.0f); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.msl index 8879f54425..a17b7ac0c5 100644 --- a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_e0c1de() { - float4 res = cosh(float4(1.0f)); + float4 res = float4(1.0f); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.spvasm index 67b1b4c55e..73f9ecd969 100644 --- a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 30 ; Schema: 0 OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -32,35 +31,34 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %float_1 = OpConstant %float 1 - %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %_ptr_Function_v4float = OpTypePointer Function %v4float - %19 = OpTypeFunction %v4float + %17 = OpTypeFunction %v4float %cosh_e0c1de = OpFunction %void None %9 %12 = OpLabel %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Cosh %16 - OpStore %res %13 + OpStore %res %14 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %cosh_e0c1de +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %cosh_e0c1de OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %void %cosh_e0c1de + %25 = OpLabel + %26 = OpFunctionCall %void %cosh_e0c1de OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %cosh_e0c1de + %28 = OpLabel + %29 = OpFunctionCall %void %cosh_e0c1de OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.wgsl index f2a273b4fd..630bb03457 100644 --- a/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/cosh/e0c1de.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cosh_e0c1de() { - var res : vec4 = cosh(vec4(1.0f)); + var res : vec4 = cosh(vec4(0.0f)); } @vertex diff --git a/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl new file mode 100644 index 0000000000..890700eaec --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<3, fa>) -> vec<3, fa> +fn cosh_f67ff1() { + var res = cosh(vec3(0.)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_f67ff1(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_f67ff1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_f67ff1(); +} diff --git a/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9b84eeba8e --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_f67ff1() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_f67ff1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_f67ff1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_f67ff1(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9b84eeba8e --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_f67ff1() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_f67ff1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_f67ff1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_f67ff1(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.glsl new file mode 100644 index 0000000000..673ca0d1fd --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_f67ff1() { + vec3 res = vec3(1.0f); +} + +vec4 vertex_main() { + cosh_f67ff1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_f67ff1() { + vec3 res = vec3(1.0f); +} + +void fragment_main() { + cosh_f67ff1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_f67ff1() { + vec3 res = vec3(1.0f); +} + +void compute_main() { + cosh_f67ff1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.msl b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.msl new file mode 100644 index 0000000000..ea0fcde8e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_f67ff1() { + float3 res = float3(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_f67ff1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_f67ff1(); + return; +} + +kernel void compute_main() { + cosh_f67ff1(); + return; +} + diff --git a/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.spvasm new file mode 100644 index 0000000000..82f8f126dd --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_f67ff1 "cosh_f67ff1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float +%cosh_f67ff1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_f67ff1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_f67ff1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_f67ff1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.wgsl new file mode 100644 index 0000000000..2040dce943 --- /dev/null +++ b/test/tint/builtins/gen/literal/cosh/f67ff1.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn cosh_f67ff1() { + var res = cosh(vec3(0.0)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_f67ff1(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_f67ff1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_f67ff1(); +} diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl index c356198ecf..3dde8829f5 100644 --- a/test/tint/builtins/gen/var/cos/0835a8.wgsl +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cos(vec<3, f16>) -> vec<3, f16> fn cos_0835a8() { - var arg_0 = vec3(1.h); + var arg_0 = vec3(0.h); var res: vec3 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.dxc.hlsl index 919fcc19ea..cced281af6 100644 --- a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_0835a8() { - vector arg_0 = (float16_t(1.0h)).xxx; + vector arg_0 = (float16_t(0.0h)).xxx; vector res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.glsl index a923fd634e..bafe1a5463 100644 --- a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cos_0835a8() { - f16vec3 arg_0 = f16vec3(1.0hf); + f16vec3 arg_0 = f16vec3(0.0hf); f16vec3 res = cos(arg_0); } @@ -24,7 +24,7 @@ void main() { precision mediump float; void cos_0835a8() { - f16vec3 arg_0 = f16vec3(1.0hf); + f16vec3 arg_0 = f16vec3(0.0hf); f16vec3 res = cos(arg_0); } @@ -40,7 +40,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cos_0835a8() { - f16vec3 arg_0 = f16vec3(1.0hf); + f16vec3 arg_0 = f16vec3(0.0hf); f16vec3 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.msl index b554124abc..9420e0baf2 100644 --- a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_0835a8() { - half3 arg_0 = half3(1.0h); + half3 arg_0 = half3(0.0h); half3 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.spvasm index 87cd164e41..9ae25ea410 100644 --- a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.spvasm @@ -1,14 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 38 +; Bound: 36 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %21 = OpExtInstImport "GLSL.std.450" + %19 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,41 +38,39 @@ %9 = OpTypeFunction %void %half = OpTypeFloat 16 %v3half = OpTypeVector %half 3 -%half_0x1p_0 = OpConstant %half 0x1p+0 - %16 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %15 = OpConstantNull %v3half %_ptr_Function_v3half = OpTypePointer Function %v3half - %19 = OpConstantNull %v3half - %24 = OpTypeFunction %v4float + %22 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cos_0835a8 = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_v3half Function %19 - %res = OpVariable %_ptr_Function_v3half Function %19 - OpStore %arg_0 %16 - %22 = OpLoad %v3half %arg_0 - %20 = OpExtInst %v3half %21 Cos %22 - OpStore %res %20 + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Cos %20 + OpStore %res %18 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %cos_0835a8 +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_0835a8 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %cos_0835a8 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_0835a8 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %36 = OpLabel - %37 = OpFunctionCall %void %cos_0835a8 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_0835a8 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.wgsl index 43b8eed452..e57f0de078 100644 --- a/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cos/0835a8.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cos_0835a8() { - var arg_0 = vec3(1.0h); + var arg_0 = vec3(0.0h); var res : vec3 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl index ce5ef06cc5..c6faae8ac1 100644 --- a/test/tint/builtins/gen/var/cos/0a89f7.wgsl +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cos(vec<4, f16>) -> vec<4, f16> fn cos_0a89f7() { - var arg_0 = vec4(1.h); + var arg_0 = vec4(0.h); var res: vec4 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl index b6dac40d94..3d47a4ab2b 100644 --- a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_0a89f7() { - vector arg_0 = (float16_t(1.0h)).xxxx; + vector arg_0 = (float16_t(0.0h)).xxxx; vector res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.glsl index cfc1cb02fa..ba601e2f1a 100644 --- a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cos_0a89f7() { - f16vec4 arg_0 = f16vec4(1.0hf); + f16vec4 arg_0 = f16vec4(0.0hf); f16vec4 res = cos(arg_0); } @@ -24,7 +24,7 @@ void main() { precision mediump float; void cos_0a89f7() { - f16vec4 arg_0 = f16vec4(1.0hf); + f16vec4 arg_0 = f16vec4(0.0hf); f16vec4 res = cos(arg_0); } @@ -40,7 +40,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cos_0a89f7() { - f16vec4 arg_0 = f16vec4(1.0hf); + f16vec4 arg_0 = f16vec4(0.0hf); f16vec4 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.msl index f89f5aad2f..82d913de47 100644 --- a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_0a89f7() { - half4 arg_0 = half4(1.0h); + half4 arg_0 = half4(0.0h); half4 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.spvasm index c8aabaa125..c2987df17f 100644 --- a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.spvasm @@ -1,14 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 38 +; Bound: 36 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %21 = OpExtInstImport "GLSL.std.450" + %19 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,41 +38,39 @@ %9 = OpTypeFunction %void %half = OpTypeFloat 16 %v4half = OpTypeVector %half 4 -%half_0x1p_0 = OpConstant %half 0x1p+0 - %16 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %15 = OpConstantNull %v4half %_ptr_Function_v4half = OpTypePointer Function %v4half - %19 = OpConstantNull %v4half - %24 = OpTypeFunction %v4float + %22 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cos_0a89f7 = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_v4half Function %19 - %res = OpVariable %_ptr_Function_v4half Function %19 - OpStore %arg_0 %16 - %22 = OpLoad %v4half %arg_0 - %20 = OpExtInst %v4half %21 Cos %22 - OpStore %res %20 + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Cos %20 + OpStore %res %18 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %cos_0a89f7 +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_0a89f7 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %cos_0a89f7 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_0a89f7 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %36 = OpLabel - %37 = OpFunctionCall %void %cos_0a89f7 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_0a89f7 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.wgsl index 8e6922bd7a..9038fc2604 100644 --- a/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cos/0a89f7.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cos_0a89f7() { - var arg_0 = vec4(1.0h); + var arg_0 = vec4(0.0h); var res : vec4 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl index 05fb496903..9ff5f3fb3d 100644 --- a/test/tint/builtins/gen/var/cos/16dc15.wgsl +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl @@ -23,7 +23,7 @@ // fn cos(vec<3, f32>) -> vec<3, f32> fn cos_16dc15() { - var arg_0 = vec3(1.f); + var arg_0 = vec3(0.f); var res: vec3 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.dxc.hlsl index aeb63a709b..73f5a2f83e 100644 --- a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_16dc15() { - float3 arg_0 = (1.0f).xxx; + float3 arg_0 = (0.0f).xxx; float3 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.fxc.hlsl index aeb63a709b..73f5a2f83e 100644 --- a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cos_16dc15() { - float3 arg_0 = (1.0f).xxx; + float3 arg_0 = (0.0f).xxx; float3 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl index 84d1b0f61a..21b1448297 100644 --- a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cos_16dc15() { - vec3 arg_0 = vec3(1.0f); + vec3 arg_0 = vec3(0.0f); vec3 res = cos(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void cos_16dc15() { - vec3 arg_0 = vec3(1.0f); + vec3 arg_0 = vec3(0.0f); vec3 res = cos(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void cos_16dc15() { - vec3 arg_0 = vec3(1.0f); + vec3 arg_0 = vec3(0.0f); vec3 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl index 69d0bd099b..a93875edd9 100644 --- a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_16dc15() { - float3 arg_0 = float3(1.0f); + float3 arg_0 = float3(0.0f); float3 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm index 2f74c5bf49..d2308306e0 100644 --- a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 35 ; Schema: 0 OpCapability Shader - %20 = OpExtInstImport "GLSL.std.450" + %18 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -33,40 +33,39 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %v3float = OpTypeVector %float 3 - %float_1 = OpConstant %float 1 - %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %14 = OpConstantNull %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float - %18 = OpConstantNull %v3float - %23 = OpTypeFunction %v4float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %cos_16dc15 = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_v3float Function %18 - %res = OpVariable %_ptr_Function_v3float Function %18 - OpStore %arg_0 %15 - %21 = OpLoad %v3float %arg_0 - %19 = OpExtInst %v3float %20 Cos %21 - OpStore %res %19 + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Cos %19 + OpStore %res %17 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %23 - %25 = OpLabel - %26 = OpFunctionCall %void %cos_16dc15 +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cos_16dc15 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %29 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cos_16dc15 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_16dc15 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cos_16dc15 + %33 = OpLabel + %34 = OpFunctionCall %void %cos_16dc15 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl index 7e3aef05c1..a4cb55fddb 100644 --- a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cos_16dc15() { - var arg_0 = vec3(1.0f); + var arg_0 = vec3(0.0f); var res : vec3 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl index 3708fa9530..5a3ba13489 100644 --- a/test/tint/builtins/gen/var/cos/29d66d.wgsl +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl @@ -23,7 +23,7 @@ // fn cos(vec<4, f32>) -> vec<4, f32> fn cos_29d66d() { - var arg_0 = vec4(1.f); + var arg_0 = vec4(0.f); var res: vec4 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.dxc.hlsl index 127e2fbb3c..9a9e05eb3b 100644 --- a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_29d66d() { - float4 arg_0 = (1.0f).xxxx; + float4 arg_0 = (0.0f).xxxx; float4 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.fxc.hlsl index 127e2fbb3c..9a9e05eb3b 100644 --- a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cos_29d66d() { - float4 arg_0 = (1.0f).xxxx; + float4 arg_0 = (0.0f).xxxx; float4 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl index 263c8d3211..65c80351d2 100644 --- a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cos_29d66d() { - vec4 arg_0 = vec4(1.0f); + vec4 arg_0 = vec4(0.0f); vec4 res = cos(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void cos_29d66d() { - vec4 arg_0 = vec4(1.0f); + vec4 arg_0 = vec4(0.0f); vec4 res = cos(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void cos_29d66d() { - vec4 arg_0 = vec4(1.0f); + vec4 arg_0 = vec4(0.0f); vec4 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl index b30c90be6f..6f3ca2bb1b 100644 --- a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_29d66d() { - float4 arg_0 = float4(1.0f); + float4 arg_0 = float4(0.0f); float4 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm index 1b4d38f60b..8c921e770a 100644 --- a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 33 ; Schema: 0 OpCapability Shader - %18 = OpExtInstImport "GLSL.std.450" + %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -32,39 +32,38 @@ %vertex_point_size = OpVariable %_ptr_Output_float Output %8 %void = OpTypeVoid %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 - %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %_ptr_Function_v4float = OpTypePointer Function %v4float - %21 = OpTypeFunction %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %cos_29d66d = OpFunction %void None %9 %12 = OpLabel %arg_0 = OpVariable %_ptr_Function_v4float Function %5 %res = OpVariable %_ptr_Function_v4float Function %5 - OpStore %arg_0 %14 - %19 = OpLoad %v4float %arg_0 - %17 = OpExtInst %v4float %18 Cos %19 - OpStore %res %17 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Cos %17 + OpStore %res %15 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %cos_29d66d +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_29d66d OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cos_29d66d + %28 = OpLabel + %29 = OpFunctionCall %void %cos_29d66d OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %cos_29d66d + %31 = OpLabel + %32 = OpFunctionCall %void %cos_29d66d OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl index 090cbe1361..c77a5ec024 100644 --- a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cos_29d66d() { - var arg_0 = vec4(1.0f); + var arg_0 = vec4(0.0f); var res : vec4 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/47d768.wgsl b/test/tint/builtins/gen/var/cos/47d768.wgsl new file mode 100644 index 0000000000..cfffa6053d --- /dev/null +++ b/test/tint/builtins/gen/var/cos/47d768.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<4, fa>) -> vec<4, fa> +fn cos_47d768() { + const arg_0 = vec4(0.); + var res = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_47d768(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_47d768(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_47d768(); +} diff --git a/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e60270e372 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_47d768() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_47d768(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_47d768(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_47d768(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e60270e372 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_47d768() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_47d768(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_47d768(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_47d768(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.glsl new file mode 100644 index 0000000000..7df432a234 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_47d768() { + vec4 res = vec4(1.0f); +} + +vec4 vertex_main() { + cos_47d768(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_47d768() { + vec4 res = vec4(1.0f); +} + +void fragment_main() { + cos_47d768(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_47d768() { + vec4 res = vec4(1.0f); +} + +void compute_main() { + cos_47d768(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.msl new file mode 100644 index 0000000000..664fd805b8 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_47d768() { + float4 res = float4(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_47d768(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_47d768(); + return; +} + +kernel void compute_main() { + cos_47d768(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.spvasm new file mode 100644 index 0000000000..0dfefb2fce --- /dev/null +++ b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_47d768 "cos_47d768" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float + %cos_47d768 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %cos_47d768 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %void %cos_47d768 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cos_47d768 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.wgsl new file mode 100644 index 0000000000..c693776cf0 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/47d768.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_47d768() { + const arg_0 = vec4(0.0); + var res = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_47d768(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_47d768(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_47d768(); +} diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl index 0bb9c532e7..7f050fd602 100644 --- a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cos(vec<2, f16>) -> vec<2, f16> fn cos_5bc2c6() { - var arg_0 = vec2(1.h); + var arg_0 = vec2(0.h); var res: vec2 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl index 37f2acc3f0..09dad0a3da 100644 --- a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_5bc2c6() { - vector arg_0 = (float16_t(1.0h)).xx; + vector arg_0 = (float16_t(0.0h)).xx; vector res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.glsl index 68cc14ee97..511a5070e1 100644 --- a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cos_5bc2c6() { - f16vec2 arg_0 = f16vec2(1.0hf); + f16vec2 arg_0 = f16vec2(0.0hf); f16vec2 res = cos(arg_0); } @@ -24,7 +24,7 @@ void main() { precision mediump float; void cos_5bc2c6() { - f16vec2 arg_0 = f16vec2(1.0hf); + f16vec2 arg_0 = f16vec2(0.0hf); f16vec2 res = cos(arg_0); } @@ -40,7 +40,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cos_5bc2c6() { - f16vec2 arg_0 = f16vec2(1.0hf); + f16vec2 arg_0 = f16vec2(0.0hf); f16vec2 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.msl index adc4e860d5..0eb35962e6 100644 --- a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_5bc2c6() { - half2 arg_0 = half2(1.0h); + half2 arg_0 = half2(0.0h); half2 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.spvasm index b51aa37543..e3000bb0d1 100644 --- a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.spvasm @@ -1,14 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 38 +; Bound: 36 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %21 = OpExtInstImport "GLSL.std.450" + %19 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,41 +38,39 @@ %9 = OpTypeFunction %void %half = OpTypeFloat 16 %v2half = OpTypeVector %half 2 -%half_0x1p_0 = OpConstant %half 0x1p+0 - %16 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %15 = OpConstantNull %v2half %_ptr_Function_v2half = OpTypePointer Function %v2half - %19 = OpConstantNull %v2half - %24 = OpTypeFunction %v4float + %22 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cos_5bc2c6 = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_v2half Function %19 - %res = OpVariable %_ptr_Function_v2half Function %19 - OpStore %arg_0 %16 - %22 = OpLoad %v2half %arg_0 - %20 = OpExtInst %v2half %21 Cos %22 - OpStore %res %20 + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Cos %20 + OpStore %res %18 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %cos_5bc2c6 +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_5bc2c6 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %cos_5bc2c6 + %31 = OpLabel + %32 = OpFunctionCall %void %cos_5bc2c6 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %36 = OpLabel - %37 = OpFunctionCall %void %cos_5bc2c6 + %34 = OpLabel + %35 = OpFunctionCall %void %cos_5bc2c6 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.wgsl index 5921e36dd4..8d64d6d559 100644 --- a/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cos/5bc2c6.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cos_5bc2c6() { - var arg_0 = vec2(1.0h); + var arg_0 = vec2(0.0h); var res : vec2 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/6b1fdf.wgsl b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl new file mode 100644 index 0000000000..35ec2485f0 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<3, fa>) -> vec<3, fa> +fn cos_6b1fdf() { + const arg_0 = vec3(0.); + var res = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_6b1fdf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_6b1fdf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_6b1fdf(); +} diff --git a/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..889d228074 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_6b1fdf() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_6b1fdf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_6b1fdf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_6b1fdf(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..889d228074 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_6b1fdf() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_6b1fdf(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_6b1fdf(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_6b1fdf(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.glsl new file mode 100644 index 0000000000..0d745deb66 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_6b1fdf() { + vec3 res = vec3(1.0f); +} + +vec4 vertex_main() { + cos_6b1fdf(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_6b1fdf() { + vec3 res = vec3(1.0f); +} + +void fragment_main() { + cos_6b1fdf(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_6b1fdf() { + vec3 res = vec3(1.0f); +} + +void compute_main() { + cos_6b1fdf(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.msl new file mode 100644 index 0000000000..e4855df6f0 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_6b1fdf() { + float3 res = float3(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_6b1fdf(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_6b1fdf(); + return; +} + +kernel void compute_main() { + cos_6b1fdf(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5ebbe189c --- /dev/null +++ b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_6b1fdf "cos_6b1fdf" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float + %cos_6b1fdf = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_6b1fdf + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cos_6b1fdf + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_6b1fdf + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.wgsl new file mode 100644 index 0000000000..592dfe9588 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/6b1fdf.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_6b1fdf() { + const arg_0 = vec3(0.0); + var res = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_6b1fdf(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_6b1fdf(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_6b1fdf(); +} diff --git a/test/tint/builtins/gen/var/cos/a297d4.wgsl b/test/tint/builtins/gen/var/cos/a297d4.wgsl new file mode 100644 index 0000000000..d7d13ff089 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/a297d4.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(fa) -> fa +fn cos_a297d4() { + const arg_0 = 0.; + var res = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_a297d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_a297d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_a297d4(); +} diff --git a/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..94ef8f55e2 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_a297d4() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_a297d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_a297d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_a297d4(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..94ef8f55e2 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_a297d4() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_a297d4(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_a297d4(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_a297d4(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.glsl new file mode 100644 index 0000000000..77e46e1e05 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_a297d4() { + float res = 1.0f; +} + +vec4 vertex_main() { + cos_a297d4(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_a297d4() { + float res = 1.0f; +} + +void fragment_main() { + cos_a297d4(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_a297d4() { + float res = 1.0f; +} + +void compute_main() { + cos_a297d4(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.msl new file mode 100644 index 0000000000..648c3c38ff --- /dev/null +++ b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_a297d4() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_a297d4(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_a297d4(); + return; +} + +kernel void compute_main() { + cos_a297d4(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.spvasm new file mode 100644 index 0000000000..985a350e75 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_a297d4 "cos_a297d4" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float + %cos_a297d4 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %cos_a297d4 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %void %cos_a297d4 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cos_a297d4 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.wgsl new file mode 100644 index 0000000000..4a3721e4c3 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/a297d4.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_a297d4() { + const arg_0 = 0.0; + var res = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_a297d4(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_a297d4(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_a297d4(); +} diff --git a/test/tint/builtins/gen/var/cos/af7447.wgsl b/test/tint/builtins/gen/var/cos/af7447.wgsl new file mode 100644 index 0000000000..57e6a220ff --- /dev/null +++ b/test/tint/builtins/gen/var/cos/af7447.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cos(vec<2, fa>) -> vec<2, fa> +fn cos_af7447() { + const arg_0 = vec2(0.); + var res = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_af7447(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_af7447(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_af7447(); +} diff --git a/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4d4a7fe35b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cos_af7447() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_af7447(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_af7447(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_af7447(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d4a7fe35b --- /dev/null +++ b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cos_af7447() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cos_af7447(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cos_af7447(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cos_af7447(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.glsl new file mode 100644 index 0000000000..3f2d50ab1c --- /dev/null +++ b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cos_af7447() { + vec2 res = vec2(1.0f); +} + +vec4 vertex_main() { + cos_af7447(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cos_af7447() { + vec2 res = vec2(1.0f); +} + +void fragment_main() { + cos_af7447(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cos_af7447() { + vec2 res = vec2(1.0f); +} + +void compute_main() { + cos_af7447(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.msl new file mode 100644 index 0000000000..fd43f63c03 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cos_af7447() { + float2 res = float2(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cos_af7447(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cos_af7447(); + return; +} + +kernel void compute_main() { + cos_af7447(); + return; +} + diff --git a/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.spvasm new file mode 100644 index 0000000000..b9c469c6c0 --- /dev/null +++ b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cos_af7447 "cos_af7447" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float + %cos_af7447 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_af7447 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cos_af7447 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_af7447 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d7d61cb9a --- /dev/null +++ b/test/tint/builtins/gen/var/cos/af7447.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cos_af7447() { + const arg_0 = vec2(0.0); + var res = cos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cos_af7447(); + return vec4(); +} + +@fragment +fn fragment_main() { + cos_af7447(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cos_af7447(); +} diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl index 28bff9ad86..4b1b1353f7 100644 --- a/test/tint/builtins/gen/var/cos/c3b486.wgsl +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl @@ -23,7 +23,7 @@ // fn cos(vec<2, f32>) -> vec<2, f32> fn cos_c3b486() { - var arg_0 = vec2(1.f); + var arg_0 = vec2(0.f); var res: vec2 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.dxc.hlsl index 1e1389c63b..cd82afc767 100644 --- a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_c3b486() { - float2 arg_0 = (1.0f).xx; + float2 arg_0 = (0.0f).xx; float2 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.fxc.hlsl index 1e1389c63b..cd82afc767 100644 --- a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cos_c3b486() { - float2 arg_0 = (1.0f).xx; + float2 arg_0 = (0.0f).xx; float2 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl index c4851f5c62..03fb395b16 100644 --- a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cos_c3b486() { - vec2 arg_0 = vec2(1.0f); + vec2 arg_0 = vec2(0.0f); vec2 res = cos(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void cos_c3b486() { - vec2 arg_0 = vec2(1.0f); + vec2 arg_0 = vec2(0.0f); vec2 res = cos(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void cos_c3b486() { - vec2 arg_0 = vec2(1.0f); + vec2 arg_0 = vec2(0.0f); vec2 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl index cade059182..4e0e3b4a08 100644 --- a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_c3b486() { - float2 arg_0 = float2(1.0f); + float2 arg_0 = float2(0.0f); float2 res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm index b8a58de530..a4bb57fde2 100644 --- a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 35 ; Schema: 0 OpCapability Shader - %20 = OpExtInstImport "GLSL.std.450" + %18 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -33,40 +33,39 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %v2float = OpTypeVector %float 2 - %float_1 = OpConstant %float 1 - %15 = OpConstantComposite %v2float %float_1 %float_1 + %14 = OpConstantNull %v2float %_ptr_Function_v2float = OpTypePointer Function %v2float - %18 = OpConstantNull %v2float - %23 = OpTypeFunction %v4float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %cos_c3b486 = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_v2float Function %18 - %res = OpVariable %_ptr_Function_v2float Function %18 - OpStore %arg_0 %15 - %21 = OpLoad %v2float %arg_0 - %19 = OpExtInst %v2float %20 Cos %21 - OpStore %res %19 + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Cos %19 + OpStore %res %17 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %23 - %25 = OpLabel - %26 = OpFunctionCall %void %cos_c3b486 +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cos_c3b486 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %29 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cos_c3b486 + %30 = OpLabel + %31 = OpFunctionCall %void %cos_c3b486 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cos_c3b486 + %33 = OpLabel + %34 = OpFunctionCall %void %cos_c3b486 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl index c4f69019f1..76e6fc3276 100644 --- a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cos_c3b486() { - var arg_0 = vec2(1.0f); + var arg_0 = vec2(0.0f); var res : vec2 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl index fd7bd2cdbf..f75c75e69d 100644 --- a/test/tint/builtins/gen/var/cos/c5c28e.wgsl +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl @@ -23,7 +23,7 @@ // fn cos(f32) -> f32 fn cos_c5c28e() { - var arg_0 = 1.f; + var arg_0 = 0.f; var res: f32 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.dxc.hlsl index d5e81f65c6..54557747cb 100644 --- a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_c5c28e() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.fxc.hlsl index d5e81f65c6..54557747cb 100644 --- a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cos_c5c28e() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl index cb5df10552..2509839a26 100644 --- a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cos_c5c28e() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cos(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void cos_c5c28e() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cos(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void cos_c5c28e() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl index 2eeca23185..1dc80527a1 100644 --- a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_c5c28e() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm index e1091134ca..68ff80dd66 100644 --- a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm @@ -4,7 +4,7 @@ ; Bound: 33 ; Schema: 0 OpCapability Shader - %17 = OpExtInstImport "GLSL.std.450" + %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -32,28 +32,28 @@ %vertex_point_size = OpVariable %_ptr_Output_float Output %8 %void = OpTypeVoid %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 %_ptr_Function_float = OpTypePointer Function %float - %20 = OpTypeFunction %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %cos_c5c28e = OpFunction %void None %9 %12 = OpLabel %arg_0 = OpVariable %_ptr_Function_float Function %8 %res = OpVariable %_ptr_Function_float Function %8 - OpStore %arg_0 %float_1 - %18 = OpLoad %float %arg_0 - %16 = OpExtInst %float %17 Cos %18 - OpStore %res %16 + OpStore %arg_0 %8 + %17 = OpLoad %float %arg_0 + %15 = OpExtInst %float %16 Cos %17 + OpStore %res %15 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %cos_c5c28e +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cos_c5c28e OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl index 0356754222..0f3a9f2022 100644 --- a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cos_c5c28e() { - var arg_0 = 1.0f; + var arg_0 = 0.0f; var res : f32 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl index c98a8e6dac..9c01a14fec 100644 --- a/test/tint/builtins/gen/var/cos/fc047d.wgsl +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cos(f16) -> f16 fn cos_fc047d() { - var arg_0 = 1.h; + var arg_0 = 0.h; var res: f16 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.dxc.hlsl index da5643ca9d..54b9f70a02 100644 --- a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cos_fc047d() { - float16_t arg_0 = float16_t(1.0h); + float16_t arg_0 = float16_t(0.0h); float16_t res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.glsl index 2d154c5545..093b9d2e4c 100644 --- a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cos_fc047d() { - float16_t arg_0 = 1.0hf; + float16_t arg_0 = 0.0hf; float16_t res = cos(arg_0); } @@ -24,7 +24,7 @@ void main() { precision mediump float; void cos_fc047d() { - float16_t arg_0 = 1.0hf; + float16_t arg_0 = 0.0hf; float16_t res = cos(arg_0); } @@ -40,7 +40,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cos_fc047d() { - float16_t arg_0 = 1.0hf; + float16_t arg_0 = 0.0hf; float16_t res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.msl index 676a0e7d86..2c230eb3df 100644 --- a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cos_fc047d() { - half arg_0 = 1.0h; + half arg_0 = 0.0h; half res = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.spvasm index ad3b3e14ec..4adfb5efe3 100644 --- a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.spvasm @@ -1,14 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 35 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %19 = OpExtInstImport "GLSL.std.450" + %18 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -37,40 +37,39 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %half = OpTypeFloat 16 -%half_0x1p_0 = OpConstant %half 0x1p+0 + %14 = OpConstantNull %half %_ptr_Function_half = OpTypePointer Function %half - %17 = OpConstantNull %half - %22 = OpTypeFunction %v4float + %21 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cos_fc047d = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_half Function %17 - %res = OpVariable %_ptr_Function_half Function %17 - OpStore %arg_0 %half_0x1p_0 - %20 = OpLoad %half %arg_0 - %18 = OpExtInst %half %19 Cos %20 - OpStore %res %18 + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Cos %19 + OpStore %res %17 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %cos_fc047d +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cos_fc047d OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cos_fc047d + %30 = OpLabel + %31 = OpFunctionCall %void %cos_fc047d OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cos_fc047d + %33 = OpLabel + %34 = OpFunctionCall %void %cos_fc047d OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.wgsl index da53171b33..51216150ca 100644 --- a/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cos/fc047d.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cos_fc047d() { - var arg_0 = 1.0h; + var arg_0 = 0.0h; var res : f16 = cos(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl index 6fa64e4a62..8a0353d455 100644 --- a/test/tint/builtins/gen/var/cosh/2ed778.wgsl +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cosh(f16) -> f16 fn cosh_2ed778() { - var arg_0 = 1.h; + var arg_0 = 0.h; var res: f16 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.dxc.hlsl index ebaf4cd5da..6689a7fa3f 100644 --- a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_2ed778() { - float16_t arg_0 = float16_t(1.0h); + float16_t arg_0 = float16_t(0.0h); float16_t res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.glsl index fdf36dfe68..52057b9508 100644 --- a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cosh_2ed778() { - float16_t arg_0 = 1.0hf; + float16_t arg_0 = 0.0hf; float16_t res = cosh(arg_0); } @@ -24,7 +24,7 @@ void main() { precision mediump float; void cosh_2ed778() { - float16_t arg_0 = 1.0hf; + float16_t arg_0 = 0.0hf; float16_t res = cosh(arg_0); } @@ -40,7 +40,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cosh_2ed778() { - float16_t arg_0 = 1.0hf; + float16_t arg_0 = 0.0hf; float16_t res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.msl index d79ff184bc..6f72358aae 100644 --- a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_2ed778() { - half arg_0 = 1.0h; + half arg_0 = 0.0h; half res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.spvasm index 00f1d05408..2079d7e03b 100644 --- a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.spvasm @@ -1,14 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 35 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %19 = OpExtInstImport "GLSL.std.450" + %18 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -37,40 +37,39 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %half = OpTypeFloat 16 -%half_0x1p_0 = OpConstant %half 0x1p+0 + %14 = OpConstantNull %half %_ptr_Function_half = OpTypePointer Function %half - %17 = OpConstantNull %half - %22 = OpTypeFunction %v4float + %21 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cosh_2ed778 = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_half Function %17 - %res = OpVariable %_ptr_Function_half Function %17 - OpStore %arg_0 %half_0x1p_0 - %20 = OpLoad %half %arg_0 - %18 = OpExtInst %half %19 Cosh %20 - OpStore %res %18 + %arg_0 = OpVariable %_ptr_Function_half Function %14 + %res = OpVariable %_ptr_Function_half Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %half %arg_0 + %17 = OpExtInst %half %18 Cosh %19 + OpStore %res %17 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %22 - %24 = OpLabel - %25 = OpFunctionCall %void %cosh_2ed778 +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cosh_2ed778 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %28 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cosh_2ed778 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_2ed778 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cosh_2ed778 + %33 = OpLabel + %34 = OpFunctionCall %void %cosh_2ed778 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.wgsl index c86f551056..5eec4351d5 100644 --- a/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cosh/2ed778.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cosh_2ed778() { - var arg_0 = 1.0h; + var arg_0 = 0.0h; var res : f16 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl b/test/tint/builtins/gen/var/cosh/377652.wgsl index 4ddda6e8f8..2dccc3723a 100644 --- a/test/tint/builtins/gen/var/cosh/377652.wgsl +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl @@ -23,7 +23,7 @@ // fn cosh(vec<3, f32>) -> vec<3, f32> fn cosh_377652() { - var arg_0 = vec3(1.f); + var arg_0 = vec3(0.f); var res: vec3 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.dxc.hlsl index 1a8733f161..4b6ec3e6ab 100644 --- a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_377652() { - float3 arg_0 = (1.0f).xxx; + float3 arg_0 = (0.0f).xxx; float3 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.fxc.hlsl index 1a8733f161..4b6ec3e6ab 100644 --- a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cosh_377652() { - float3 arg_0 = (1.0f).xxx; + float3 arg_0 = (0.0f).xxx; float3 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl index e6afbd866d..bd306d800b 100644 --- a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cosh_377652() { - vec3 arg_0 = vec3(1.0f); + vec3 arg_0 = vec3(0.0f); vec3 res = cosh(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void cosh_377652() { - vec3 arg_0 = vec3(1.0f); + vec3 arg_0 = vec3(0.0f); vec3 res = cosh(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void cosh_377652() { - vec3 arg_0 = vec3(1.0f); + vec3 arg_0 = vec3(0.0f); vec3 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl index baa735beb6..e177d54dbc 100644 --- a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_377652() { - float3 arg_0 = float3(1.0f); + float3 arg_0 = float3(0.0f); float3 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm index 8f33d505b9..4007fb3c59 100644 --- a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 35 ; Schema: 0 OpCapability Shader - %20 = OpExtInstImport "GLSL.std.450" + %18 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -33,40 +33,39 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %v3float = OpTypeVector %float 3 - %float_1 = OpConstant %float 1 - %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %14 = OpConstantNull %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float - %18 = OpConstantNull %v3float - %23 = OpTypeFunction %v4float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %cosh_377652 = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_v3float Function %18 - %res = OpVariable %_ptr_Function_v3float Function %18 - OpStore %arg_0 %15 - %21 = OpLoad %v3float %arg_0 - %19 = OpExtInst %v3float %20 Cosh %21 - OpStore %res %19 + %arg_0 = OpVariable %_ptr_Function_v3float Function %14 + %res = OpVariable %_ptr_Function_v3float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v3float %arg_0 + %17 = OpExtInst %v3float %18 Cosh %19 + OpStore %res %17 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %23 - %25 = OpLabel - %26 = OpFunctionCall %void %cosh_377652 +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cosh_377652 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %29 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cosh_377652 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_377652 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cosh_377652 + %33 = OpLabel + %34 = OpFunctionCall %void %cosh_377652 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl index 6196cadb85..b208ffc182 100644 --- a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cosh_377652() { - var arg_0 = vec3(1.0f); + var arg_0 = vec3(0.0f); var res : vec3 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl index 8ef43e726f..b4fddcf4ad 100644 --- a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cosh(vec<4, f16>) -> vec<4, f16> fn cosh_3b7bbf() { - var arg_0 = vec4(1.h); + var arg_0 = vec4(0.h); var res: vec4 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.dxc.hlsl index 8872b6ec61..5a96478604 100644 --- a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_3b7bbf() { - vector arg_0 = (float16_t(1.0h)).xxxx; + vector arg_0 = (float16_t(0.0h)).xxxx; vector res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.glsl index 987508a476..8ea08d9328 100644 --- a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cosh_3b7bbf() { - f16vec4 arg_0 = f16vec4(1.0hf); + f16vec4 arg_0 = f16vec4(0.0hf); f16vec4 res = cosh(arg_0); } @@ -24,7 +24,7 @@ void main() { precision mediump float; void cosh_3b7bbf() { - f16vec4 arg_0 = f16vec4(1.0hf); + f16vec4 arg_0 = f16vec4(0.0hf); f16vec4 res = cosh(arg_0); } @@ -40,7 +40,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cosh_3b7bbf() { - f16vec4 arg_0 = f16vec4(1.0hf); + f16vec4 arg_0 = f16vec4(0.0hf); f16vec4 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.msl index b359421b8b..12acf5fd52 100644 --- a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_3b7bbf() { - half4 arg_0 = half4(1.0h); + half4 arg_0 = half4(0.0h); half4 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.spvasm index f526da5d3f..3b9f8d4ba1 100644 --- a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.spvasm @@ -1,14 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 38 +; Bound: 36 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %21 = OpExtInstImport "GLSL.std.450" + %19 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,41 +38,39 @@ %9 = OpTypeFunction %void %half = OpTypeFloat 16 %v4half = OpTypeVector %half 4 -%half_0x1p_0 = OpConstant %half 0x1p+0 - %16 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %15 = OpConstantNull %v4half %_ptr_Function_v4half = OpTypePointer Function %v4half - %19 = OpConstantNull %v4half - %24 = OpTypeFunction %v4float + %22 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cosh_3b7bbf = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_v4half Function %19 - %res = OpVariable %_ptr_Function_v4half Function %19 - OpStore %arg_0 %16 - %22 = OpLoad %v4half %arg_0 - %20 = OpExtInst %v4half %21 Cosh %22 - OpStore %res %20 + %arg_0 = OpVariable %_ptr_Function_v4half Function %15 + %res = OpVariable %_ptr_Function_v4half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v4half %arg_0 + %18 = OpExtInst %v4half %19 Cosh %20 + OpStore %res %18 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %cosh_3b7bbf +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_3b7bbf OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %cosh_3b7bbf + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_3b7bbf OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %36 = OpLabel - %37 = OpFunctionCall %void %cosh_3b7bbf + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_3b7bbf OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.wgsl index 185b5f3f96..2f43c2af6b 100644 --- a/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cosh/3b7bbf.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cosh_3b7bbf() { - var arg_0 = vec4(1.0h); + var arg_0 = vec4(0.0h); var res : vec4 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/432645.wgsl b/test/tint/builtins/gen/var/cosh/432645.wgsl new file mode 100644 index 0000000000..53be992258 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/432645.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<2, fa>) -> vec<2, fa> +fn cosh_432645() { + const arg_0 = vec2(0.); + var res = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_432645(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_432645(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_432645(); +} diff --git a/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f17e79e9bb --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_432645() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_432645(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_432645(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_432645(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f17e79e9bb --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_432645() { + float2 res = (1.0f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_432645(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_432645(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_432645(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.glsl new file mode 100644 index 0000000000..2cec246557 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_432645() { + vec2 res = vec2(1.0f); +} + +vec4 vertex_main() { + cosh_432645(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_432645() { + vec2 res = vec2(1.0f); +} + +void fragment_main() { + cosh_432645(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_432645() { + vec2 res = vec2(1.0f); +} + +void compute_main() { + cosh_432645(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.msl new file mode 100644 index 0000000000..ef670b71ea --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_432645() { + float2 res = float2(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_432645(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_432645(); + return; +} + +kernel void compute_main() { + cosh_432645(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.spvasm new file mode 100644 index 0000000000..7db73f65b9 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_432645 "cosh_432645" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float +%cosh_432645 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_432645 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_432645 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_432645 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.wgsl new file mode 100644 index 0000000000..577af1686e --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/432645.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_432645() { + const arg_0 = vec2(0.0); + var res = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_432645(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_432645(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_432645(); +} diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl index 4da21032ca..854d6a9465 100644 --- a/test/tint/builtins/gen/var/cosh/43b672.wgsl +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cosh(vec<2, f16>) -> vec<2, f16> fn cosh_43b672() { - var arg_0 = vec2(1.h); + var arg_0 = vec2(0.h); var res: vec2 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.dxc.hlsl index 6e196c72b9..db19b27193 100644 --- a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_43b672() { - vector arg_0 = (float16_t(1.0h)).xx; + vector arg_0 = (float16_t(0.0h)).xx; vector res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.glsl index 79a299c576..8c60a2cd95 100644 --- a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cosh_43b672() { - f16vec2 arg_0 = f16vec2(1.0hf); + f16vec2 arg_0 = f16vec2(0.0hf); f16vec2 res = cosh(arg_0); } @@ -24,7 +24,7 @@ void main() { precision mediump float; void cosh_43b672() { - f16vec2 arg_0 = f16vec2(1.0hf); + f16vec2 arg_0 = f16vec2(0.0hf); f16vec2 res = cosh(arg_0); } @@ -40,7 +40,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cosh_43b672() { - f16vec2 arg_0 = f16vec2(1.0hf); + f16vec2 arg_0 = f16vec2(0.0hf); f16vec2 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.msl index 528da9f371..1a50e7e669 100644 --- a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_43b672() { - half2 arg_0 = half2(1.0h); + half2 arg_0 = half2(0.0h); half2 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.spvasm index bc597ceac9..5658285aea 100644 --- a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.spvasm @@ -1,14 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 38 +; Bound: 36 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %21 = OpExtInstImport "GLSL.std.450" + %19 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,41 +38,39 @@ %9 = OpTypeFunction %void %half = OpTypeFloat 16 %v2half = OpTypeVector %half 2 -%half_0x1p_0 = OpConstant %half 0x1p+0 - %16 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 + %15 = OpConstantNull %v2half %_ptr_Function_v2half = OpTypePointer Function %v2half - %19 = OpConstantNull %v2half - %24 = OpTypeFunction %v4float + %22 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cosh_43b672 = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_v2half Function %19 - %res = OpVariable %_ptr_Function_v2half Function %19 - OpStore %arg_0 %16 - %22 = OpLoad %v2half %arg_0 - %20 = OpExtInst %v2half %21 Cosh %22 - OpStore %res %20 + %arg_0 = OpVariable %_ptr_Function_v2half Function %15 + %res = OpVariable %_ptr_Function_v2half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v2half %arg_0 + %18 = OpExtInst %v2half %19 Cosh %20 + OpStore %res %18 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %cosh_43b672 +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_43b672 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %cosh_43b672 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_43b672 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %36 = OpLabel - %37 = OpFunctionCall %void %cosh_43b672 + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_43b672 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.wgsl index c73fb44ae8..3a225b1a92 100644 --- a/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cosh/43b672.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cosh_43b672() { - var arg_0 = vec2(1.0h); + var arg_0 = vec2(0.0h); var res : vec2 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl index 895a1671c1..02b20f2df8 100644 --- a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl @@ -25,7 +25,7 @@ enable f16; // fn cosh(vec<3, f16>) -> vec<3, f16> fn cosh_b1b8a0() { - var arg_0 = vec3(1.h); + var arg_0 = vec3(0.h); var res: vec3 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.dxc.hlsl index f7e411c1c0..a058cd26b0 100644 --- a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_b1b8a0() { - vector arg_0 = (float16_t(1.0h)).xxx; + vector arg_0 = (float16_t(0.0h)).xxx; vector res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.glsl index d9e62036fe..6566e922c4 100644 --- a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void cosh_b1b8a0() { - f16vec3 arg_0 = f16vec3(1.0hf); + f16vec3 arg_0 = f16vec3(0.0hf); f16vec3 res = cosh(arg_0); } @@ -24,7 +24,7 @@ void main() { precision mediump float; void cosh_b1b8a0() { - f16vec3 arg_0 = f16vec3(1.0hf); + f16vec3 arg_0 = f16vec3(0.0hf); f16vec3 res = cosh(arg_0); } @@ -40,7 +40,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void cosh_b1b8a0() { - f16vec3 arg_0 = f16vec3(1.0hf); + f16vec3 arg_0 = f16vec3(0.0hf); f16vec3 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.msl index f350cd56bd..2cf0802e2c 100644 --- a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_b1b8a0() { - half3 arg_0 = half3(1.0h); + half3 arg_0 = half3(0.0h); half3 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.spvasm index c096e6f85c..29505ec4ba 100644 --- a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.spvasm @@ -1,14 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 38 +; Bound: 36 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %21 = OpExtInstImport "GLSL.std.450" + %19 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -38,41 +38,39 @@ %9 = OpTypeFunction %void %half = OpTypeFloat 16 %v3half = OpTypeVector %half 3 -%half_0x1p_0 = OpConstant %half 0x1p+0 - %16 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 + %15 = OpConstantNull %v3half %_ptr_Function_v3half = OpTypePointer Function %v3half - %19 = OpConstantNull %v3half - %24 = OpTypeFunction %v4float + %22 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %cosh_b1b8a0 = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_v3half Function %19 - %res = OpVariable %_ptr_Function_v3half Function %19 - OpStore %arg_0 %16 - %22 = OpLoad %v3half %arg_0 - %20 = OpExtInst %v3half %21 Cosh %22 - OpStore %res %20 + %arg_0 = OpVariable %_ptr_Function_v3half Function %15 + %res = OpVariable %_ptr_Function_v3half Function %15 + OpStore %arg_0 %15 + %20 = OpLoad %v3half %arg_0 + %18 = OpExtInst %v3half %19 Cosh %20 + OpStore %res %18 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %24 - %26 = OpLabel - %27 = OpFunctionCall %void %cosh_b1b8a0 +%vertex_main_inner = OpFunction %v4float None %22 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_b1b8a0 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %30 + %27 = OpLabel + %28 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %28 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %33 = OpLabel - %34 = OpFunctionCall %void %cosh_b1b8a0 + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_b1b8a0 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %36 = OpLabel - %37 = OpFunctionCall %void %cosh_b1b8a0 + %34 = OpLabel + %35 = OpFunctionCall %void %cosh_b1b8a0 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.wgsl index f0d9b86ec6..38d7ea9ef4 100644 --- a/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cosh/b1b8a0.wgsl.expected.wgsl @@ -1,7 +1,7 @@ enable f16; fn cosh_b1b8a0() { - var arg_0 = vec3(1.0h); + var arg_0 = vec3(0.0h); var res : vec3 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl index 5ac6b09993..00e626a8d0 100644 --- a/test/tint/builtins/gen/var/cosh/c13756.wgsl +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl @@ -23,7 +23,7 @@ // fn cosh(vec<2, f32>) -> vec<2, f32> fn cosh_c13756() { - var arg_0 = vec2(1.f); + var arg_0 = vec2(0.f); var res: vec2 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.dxc.hlsl index 7136500a20..1c53a74ef4 100644 --- a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_c13756() { - float2 arg_0 = (1.0f).xx; + float2 arg_0 = (0.0f).xx; float2 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.fxc.hlsl index 7136500a20..1c53a74ef4 100644 --- a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cosh_c13756() { - float2 arg_0 = (1.0f).xx; + float2 arg_0 = (0.0f).xx; float2 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl index b484ca753d..4d9ef69341 100644 --- a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cosh_c13756() { - vec2 arg_0 = vec2(1.0f); + vec2 arg_0 = vec2(0.0f); vec2 res = cosh(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void cosh_c13756() { - vec2 arg_0 = vec2(1.0f); + vec2 arg_0 = vec2(0.0f); vec2 res = cosh(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void cosh_c13756() { - vec2 arg_0 = vec2(1.0f); + vec2 arg_0 = vec2(0.0f); vec2 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl index 93ce84c77e..4ce9fd6e1a 100644 --- a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_c13756() { - float2 arg_0 = float2(1.0f); + float2 arg_0 = float2(0.0f); float2 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm index 246ed00bcc..faad53484f 100644 --- a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 35 ; Schema: 0 OpCapability Shader - %20 = OpExtInstImport "GLSL.std.450" + %18 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -33,40 +33,39 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %v2float = OpTypeVector %float 2 - %float_1 = OpConstant %float 1 - %15 = OpConstantComposite %v2float %float_1 %float_1 + %14 = OpConstantNull %v2float %_ptr_Function_v2float = OpTypePointer Function %v2float - %18 = OpConstantNull %v2float - %23 = OpTypeFunction %v4float + %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %cosh_c13756 = OpFunction %void None %9 %12 = OpLabel - %arg_0 = OpVariable %_ptr_Function_v2float Function %18 - %res = OpVariable %_ptr_Function_v2float Function %18 - OpStore %arg_0 %15 - %21 = OpLoad %v2float %arg_0 - %19 = OpExtInst %v2float %20 Cosh %21 - OpStore %res %19 + %arg_0 = OpVariable %_ptr_Function_v2float Function %14 + %res = OpVariable %_ptr_Function_v2float Function %14 + OpStore %arg_0 %14 + %19 = OpLoad %v2float %arg_0 + %17 = OpExtInst %v2float %18 Cosh %19 + OpStore %res %17 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %23 - %25 = OpLabel - %26 = OpFunctionCall %void %cosh_c13756 +%vertex_main_inner = OpFunction %v4float None %21 + %23 = OpLabel + %24 = OpFunctionCall %void %cosh_c13756 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %29 + %26 = OpLabel + %27 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %27 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %cosh_c13756 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_c13756 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %cosh_c13756 + %33 = OpLabel + %34 = OpFunctionCall %void %cosh_c13756 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl index 2b9a859ab8..5c023f5785 100644 --- a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cosh_c13756() { - var arg_0 = vec2(1.0f); + var arg_0 = vec2(0.0f); var res : vec2 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/c892bb.wgsl b/test/tint/builtins/gen/var/cosh/c892bb.wgsl new file mode 100644 index 0000000000..0de1367360 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c892bb.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(fa) -> fa +fn cosh_c892bb() { + const arg_0 = 0.; + var res = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_c892bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_c892bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_c892bb(); +} diff --git a/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b014629d2b --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_c892bb() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_c892bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_c892bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_c892bb(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b014629d2b --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_c892bb() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_c892bb(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_c892bb(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_c892bb(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.glsl new file mode 100644 index 0000000000..d6ae3cdc9c --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_c892bb() { + float res = 1.0f; +} + +vec4 vertex_main() { + cosh_c892bb(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_c892bb() { + float res = 1.0f; +} + +void fragment_main() { + cosh_c892bb(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_c892bb() { + float res = 1.0f; +} + +void compute_main() { + cosh_c892bb(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.msl new file mode 100644 index 0000000000..ef578081cf --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_c892bb() { + float res = 1.0f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_c892bb(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_c892bb(); + return; +} + +kernel void compute_main() { + cosh_c892bb(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9fadf71bf --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_c892bb "cosh_c892bb" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float +%cosh_c892bb = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_1 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %cosh_c892bb + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %void %cosh_c892bb + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_c892bb + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.wgsl new file mode 100644 index 0000000000..a84ebd3ce5 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/c892bb.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_c892bb() { + const arg_0 = 0.0; + var res = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_c892bb(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_c892bb(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_c892bb(); +} diff --git a/test/tint/builtins/gen/var/cosh/d8dee7.wgsl b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl new file mode 100644 index 0000000000..5bc4653240 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<4, fa>) -> vec<4, fa> +fn cosh_d8dee7() { + const arg_0 = vec4(0.); + var res = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_d8dee7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_d8dee7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_d8dee7(); +} diff --git a/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6cf84f95ff --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_d8dee7() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_d8dee7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_d8dee7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_d8dee7(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6cf84f95ff --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_d8dee7() { + float4 res = (1.0f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_d8dee7(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_d8dee7(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_d8dee7(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.glsl new file mode 100644 index 0000000000..4f4b630be9 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_d8dee7() { + vec4 res = vec4(1.0f); +} + +vec4 vertex_main() { + cosh_d8dee7(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_d8dee7() { + vec4 res = vec4(1.0f); +} + +void fragment_main() { + cosh_d8dee7(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_d8dee7() { + vec4 res = vec4(1.0f); +} + +void compute_main() { + cosh_d8dee7(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.msl new file mode 100644 index 0000000000..23ce015636 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_d8dee7() { + float4 res = float4(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_d8dee7(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_d8dee7(); + return; +} + +kernel void compute_main() { + cosh_d8dee7(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba25f1a534 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_d8dee7 "cosh_d8dee7" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float +%cosh_d8dee7 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + OpStore %res %14 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %cosh_d8dee7 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpFunctionCall %void %cosh_d8dee7 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %cosh_d8dee7 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ed2b967a7 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/d8dee7.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_d8dee7() { + const arg_0 = vec4(0.0); + var res = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_d8dee7(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_d8dee7(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_d8dee7(); +} diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl index bebbde2eb4..2611357c6b 100644 --- a/test/tint/builtins/gen/var/cosh/da92dd.wgsl +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl @@ -23,7 +23,7 @@ // fn cosh(f32) -> f32 fn cosh_da92dd() { - var arg_0 = 1.f; + var arg_0 = 0.f; var res: f32 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.dxc.hlsl index 657c3dd842..c1bf67ef4c 100644 --- a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_da92dd() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.fxc.hlsl index 657c3dd842..c1bf67ef4c 100644 --- a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cosh_da92dd() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl index f87144f079..9927b0ad6b 100644 --- a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cosh_da92dd() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cosh(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void cosh_da92dd() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cosh(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void cosh_da92dd() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl index ed4cc477f5..ca678bea0c 100644 --- a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_da92dd() { - float arg_0 = 1.0f; + float arg_0 = 0.0f; float res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm index c82b34fb4c..36cb08f18c 100644 --- a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm @@ -4,7 +4,7 @@ ; Bound: 33 ; Schema: 0 OpCapability Shader - %17 = OpExtInstImport "GLSL.std.450" + %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -32,28 +32,28 @@ %vertex_point_size = OpVariable %_ptr_Output_float Output %8 %void = OpTypeVoid %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 %_ptr_Function_float = OpTypePointer Function %float - %20 = OpTypeFunction %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %cosh_da92dd = OpFunction %void None %9 %12 = OpLabel %arg_0 = OpVariable %_ptr_Function_float Function %8 %res = OpVariable %_ptr_Function_float Function %8 - OpStore %arg_0 %float_1 - %18 = OpLoad %float %arg_0 - %16 = OpExtInst %float %17 Cosh %18 - OpStore %res %16 + OpStore %arg_0 %8 + %17 = OpLoad %float %arg_0 + %15 = OpExtInst %float %16 Cosh %17 + OpStore %res %15 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %20 - %22 = OpLabel - %23 = OpFunctionCall %void %cosh_da92dd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_da92dd OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %25 = OpLabel - %26 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %26 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl index 92c780e9f7..fd7d07efe2 100644 --- a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cosh_da92dd() { - var arg_0 = 1.0f; + var arg_0 = 0.0f; var res : f32 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl index 826f151046..181fdd4895 100644 --- a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl @@ -23,7 +23,7 @@ // fn cosh(vec<4, f32>) -> vec<4, f32> fn cosh_e0c1de() { - var arg_0 = vec4(1.f); + var arg_0 = vec4(0.f); var res: vec4 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.dxc.hlsl index 37d3c569eb..57edfcd129 100644 --- a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void cosh_e0c1de() { - float4 arg_0 = (1.0f).xxxx; + float4 arg_0 = (0.0f).xxxx; float4 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.fxc.hlsl index 37d3c569eb..57edfcd129 100644 --- a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void cosh_e0c1de() { - float4 arg_0 = (1.0f).xxxx; + float4 arg_0 = (0.0f).xxxx; float4 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl index 48eb02fe6e..713d23de4f 100644 --- a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void cosh_e0c1de() { - vec4 arg_0 = vec4(1.0f); + vec4 arg_0 = vec4(0.0f); vec4 res = cosh(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void cosh_e0c1de() { - vec4 arg_0 = vec4(1.0f); + vec4 arg_0 = vec4(0.0f); vec4 res = cosh(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void cosh_e0c1de() { - vec4 arg_0 = vec4(1.0f); + vec4 arg_0 = vec4(0.0f); vec4 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl index c96ffa68c5..dba84b5ff0 100644 --- a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void cosh_e0c1de() { - float4 arg_0 = float4(1.0f); + float4 arg_0 = float4(0.0f); float4 res = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm index fba4a835b2..b788bac726 100644 --- a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 33 ; Schema: 0 OpCapability Shader - %18 = OpExtInstImport "GLSL.std.450" + %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -32,39 +32,38 @@ %vertex_point_size = OpVariable %_ptr_Output_float Output %8 %void = OpTypeVoid %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 - %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %_ptr_Function_v4float = OpTypePointer Function %v4float - %21 = OpTypeFunction %v4float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %cosh_e0c1de = OpFunction %void None %9 %12 = OpLabel %arg_0 = OpVariable %_ptr_Function_v4float Function %5 %res = OpVariable %_ptr_Function_v4float Function %5 - OpStore %arg_0 %14 - %19 = OpLoad %v4float %arg_0 - %17 = OpExtInst %v4float %18 Cosh %19 - OpStore %res %17 + OpStore %arg_0 %5 + %17 = OpLoad %v4float %arg_0 + %15 = OpExtInst %v4float %16 Cosh %17 + OpStore %res %15 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %cosh_e0c1de +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_e0c1de OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %cosh_e0c1de + %28 = OpLabel + %29 = OpFunctionCall %void %cosh_e0c1de OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %cosh_e0c1de + %31 = OpLabel + %32 = OpFunctionCall %void %cosh_e0c1de OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl index 46f14b868a..b48ff3c850 100644 --- a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn cosh_e0c1de() { - var arg_0 = vec4(1.0f); + var arg_0 = vec4(0.0f); var res : vec4 = cosh(arg_0); } diff --git a/test/tint/builtins/gen/var/cosh/f67ff1.wgsl b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl new file mode 100644 index 0000000000..db22528aa3 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn cosh(vec<3, fa>) -> vec<3, fa> +fn cosh_f67ff1() { + const arg_0 = vec3(0.); + var res = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_f67ff1(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_f67ff1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_f67ff1(); +} diff --git a/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9b84eeba8e --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void cosh_f67ff1() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_f67ff1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_f67ff1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_f67ff1(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9b84eeba8e --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void cosh_f67ff1() { + float3 res = (1.0f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + cosh_f67ff1(); + return (0.0f).xxxx; +} + +tint_symbol vertex_main() { + const float4 inner_result = vertex_main_inner(); + tint_symbol wrapper_result = (tint_symbol)0; + wrapper_result.value = inner_result; + return wrapper_result; +} + +void fragment_main() { + cosh_f67ff1(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + cosh_f67ff1(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.glsl new file mode 100644 index 0000000000..673ca0d1fd --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void cosh_f67ff1() { + vec3 res = vec3(1.0f); +} + +vec4 vertex_main() { + cosh_f67ff1(); + return vec4(0.0f); +} + +void main() { + gl_PointSize = 1.0; + vec4 inner_result = vertex_main(); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w); + return; +} +#version 310 es +precision mediump float; + +void cosh_f67ff1() { + vec3 res = vec3(1.0f); +} + +void fragment_main() { + cosh_f67ff1(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void cosh_f67ff1() { + vec3 res = vec3(1.0f); +} + +void compute_main() { + cosh_f67ff1(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.msl new file mode 100644 index 0000000000..ea0fcde8e1 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void cosh_f67ff1() { + float3 res = float3(1.0f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + cosh_f67ff1(); + return float4(0.0f); +} + +vertex tint_symbol vertex_main() { + float4 const inner_result = vertex_main_inner(); + tint_symbol wrapper_result = {}; + wrapper_result.value = inner_result; + return wrapper_result; +} + +fragment void fragment_main() { + cosh_f67ff1(); + return; +} + +kernel void compute_main() { + cosh_f67ff1(); + return; +} + diff --git a/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.spvasm new file mode 100644 index 0000000000..82f8f126dd --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.spvasm @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %cosh_f67ff1 "cosh_f67ff1" + OpName %res "res" + OpName %vertex_main_inner "vertex_main_inner" + OpName %vertex_main "vertex_main" + OpName %fragment_main "fragment_main" + OpName %compute_main "compute_main" + OpDecorate %value BuiltIn Position + OpDecorate %vertex_point_size BuiltIn PointSize + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %value = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float + %8 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float +%cosh_f67ff1 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %cosh_f67ff1 + OpReturnValue %5 + OpFunctionEnd +%vertex_main = OpFunction %void None %9 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 + OpStore %vertex_point_size %float_1 + OpReturn + OpFunctionEnd +%fragment_main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %cosh_f67ff1 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %void %cosh_f67ff1 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.wgsl new file mode 100644 index 0000000000..40373b8121 --- /dev/null +++ b/test/tint/builtins/gen/var/cosh/f67ff1.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn cosh_f67ff1() { + const arg_0 = vec3(0.0); + var res = cosh(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + cosh_f67ff1(); + return vec4(); +} + +@fragment +fn fragment_main() { + cosh_f67ff1(); +} + +@compute @workgroup_size(1) +fn compute_main() { + cosh_f67ff1(); +}