intrinsics: Fix signature of ldexp()

The second parameter must not be a u32.

Fixed: tint:1078
Bug: tint:1079
Change-Id: Id7a9cd881c4fec0f262931c2e4c263310e59c25d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60204
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton 2021-07-28 21:19:26 +00:00 committed by Tint LUCI CQ
parent c0f1ed4fe7
commit d35f8d99e7
24 changed files with 25 additions and 853 deletions

View File

@ -3812,7 +3812,7 @@ constexpr ParameterInfo kParameters[] = {
{
/* [388] */
/* usage */ ParameterUsage::kNone,
/* matcher indices */ &kMatcherIndices[5],
/* matcher indices */ &kMatcherIndices[6],
},
{
/* [389] */
@ -3912,7 +3912,7 @@ constexpr ParameterInfo kParameters[] = {
{
/* [408] */
/* usage */ ParameterUsage::kNone,
/* matcher indices */ &kMatcherIndices[44],
/* matcher indices */ &kMatcherIndices[4],
},
{
/* [409] */
@ -7361,9 +7361,9 @@ constexpr OverloadInfo kOverloads[] = {
{
/* [195] */
/* num parameters */ 2,
/* num open types */ 1,
/* num open types */ 0,
/* num open numbers */ 0,
/* open types */ &kOpenTypes[2],
/* open types */ &kOpenTypes[4],
/* open numbers */ &kOpenNumbers[7],
/* parameters */ &kParameters[387],
/* return matcher indices */ &kMatcherIndices[7],
@ -7373,9 +7373,9 @@ constexpr OverloadInfo kOverloads[] = {
{
/* [196] */
/* num parameters */ 2,
/* num open types */ 1,
/* num open types */ 0,
/* num open numbers */ 1,
/* open types */ &kOpenTypes[2],
/* open types */ &kOpenTypes[4],
/* open numbers */ &kOpenNumbers[1],
/* parameters */ &kParameters[407],
/* return matcher indices */ &kMatcherIndices[10],
@ -8638,8 +8638,8 @@ constexpr IntrinsicInfo kIntrinsics[] = {
},
{
/* [39] */
/* fn ldexp<T : iu32>(f32, T) -> f32 */
/* fn ldexp<N : num, T : iu32>(vec<N, f32>, vec<N, T>) -> vec<N, f32> */
/* fn ldexp(f32, i32) -> f32 */
/* fn ldexp<N : num>(vec<N, f32>, vec<N, i32>) -> vec<N, f32> */
/* num overloads */ 2,
/* overloads */ &kOverloads[195],
},

View File

@ -335,8 +335,8 @@ fn isNan(f32) -> bool
fn isNan<N: num>(vec<N, f32>) -> vec<N, bool>
fn isNormal(f32) -> bool
fn isNormal<N: num>(vec<N, f32>) -> vec<N, bool>
fn ldexp<T: iu32>(f32, T) -> f32
fn ldexp<N: num, T: iu32>(vec<N, f32>, vec<N, T>) -> vec<N, f32>
fn ldexp(f32, i32) -> f32
fn ldexp<N: num>(vec<N, f32>, vec<N, i32>) -> vec<N, f32>
fn length(f32) -> f32
fn length<N: num>(vec<N, f32>) -> f32
fn log(f32) -> f32

View File

@ -102,7 +102,7 @@ ast::CallExpression* GenerateCall(IntrinsicType intrinsic,
case IntrinsicType::kSign:
return builder->Call(str.str(), "f2");
case IntrinsicType::kLdexp:
return builder->Call(str.str(), "f2", "u2");
return builder->Call(str.str(), "f2", "i2");
case IntrinsicType::kAtan2:
case IntrinsicType::kDot:
case IntrinsicType::kDistance:
@ -157,12 +157,13 @@ using HlslIntrinsicTest = TestParamHelper<IntrinsicData>;
TEST_P(HlslIntrinsicTest, Emit) {
auto param = GetParam();
Global("f2", ty.vec2<float>(), ast::StorageClass::kPrivate);
Global("f3", ty.vec3<float>(), ast::StorageClass::kPrivate);
Global("u2", ty.vec2<unsigned int>(), ast::StorageClass::kPrivate);
Global("f2", ty.vec2<f32>(), ast::StorageClass::kPrivate);
Global("f3", ty.vec3<f32>(), ast::StorageClass::kPrivate);
Global("u2", ty.vec2<u32>(), ast::StorageClass::kPrivate);
Global("i2", ty.vec2<i32>(), ast::StorageClass::kPrivate);
Global("b2", ty.vec2<bool>(), ast::StorageClass::kPrivate);
Global("m2x2", ty.mat2x2<float>(), ast::StorageClass::kPrivate);
Global("m3x2", ty.mat3x2<float>(), ast::StorageClass::kPrivate);
Global("m2x2", ty.mat2x2<f32>(), ast::StorageClass::kPrivate);
Global("m3x2", ty.mat3x2<f32>(), ast::StorageClass::kPrivate);
auto* call = GenerateCall(param.intrinsic, param.type, this);
ASSERT_NE(nullptr, call) << "Unhandled intrinsic";

View File

@ -98,7 +98,7 @@ ast::CallExpression* GenerateCall(IntrinsicType intrinsic,
case IntrinsicType::kSign:
return builder->Call(str.str(), "f2");
case IntrinsicType::kLdexp:
return builder->Call(str.str(), "f2", "u2");
return builder->Call(str.str(), "f2", "i2");
case IntrinsicType::kAtan2:
case IntrinsicType::kDot:
case IntrinsicType::kDistance:
@ -169,14 +169,15 @@ using MslIntrinsicTest = TestParamHelper<IntrinsicData>;
TEST_P(MslIntrinsicTest, Emit) {
auto param = GetParam();
Global("f2", ty.vec2<float>(), ast::StorageClass::kPrivate);
Global("f3", ty.vec3<float>(), ast::StorageClass::kPrivate);
Global("f4", ty.vec4<float>(), ast::StorageClass::kPrivate);
Global("f2", ty.vec2<f32>(), ast::StorageClass::kPrivate);
Global("f3", ty.vec3<f32>(), ast::StorageClass::kPrivate);
Global("f4", ty.vec4<f32>(), ast::StorageClass::kPrivate);
Global("u1", ty.u32(), ast::StorageClass::kPrivate);
Global("u2", ty.vec2<unsigned int>(), ast::StorageClass::kPrivate);
Global("u2", ty.vec2<u32>(), ast::StorageClass::kPrivate);
Global("i2", ty.vec2<i32>(), ast::StorageClass::kPrivate);
Global("b2", ty.vec2<bool>(), ast::StorageClass::kPrivate);
Global("m2x2", ty.mat2x2<float>(), ast::StorageClass::kPrivate);
Global("m3x2", ty.mat3x2<float>(), ast::StorageClass::kPrivate);
Global("m2x2", ty.mat2x2<f32>(), ast::StorageClass::kPrivate);
Global("m3x2", ty.mat3x2<f32>(), ast::StorageClass::kPrivate);
auto* call = GenerateCall(param.intrinsic, param.type, this);
ASSERT_NE(nullptr, call) << "Unhandled intrinsic";

View File

@ -1,45 +0,0 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/intrinsic-gen
// using the template:
// test/intrinsics/intrinsics.wgsl.tmpl
// and the intrinsic defintion file:
// src/intrinsics.def
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn ldexp(vec<3, f32>, vec<3, u32>) -> vec<3, f32>
fn ldexp_2cb32a() {
var res: vec3<f32> = ldexp(vec3<f32>(), vec3<u32>());
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
ldexp_2cb32a();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
ldexp_2cb32a();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
ldexp_2cb32a();
}

View File

@ -1,24 +0,0 @@
void ldexp_2cb32a() {
float3 res = ldexp(float3(0.0f, 0.0f, 0.0f), uint3(0u, 0u, 0u));
}
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() {
ldexp_2cb32a();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() {
ldexp_2cb32a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
ldexp_2cb32a();
return;
}

View File

@ -1,56 +0,0 @@
SKIP: FAILED
Validation Failure:
#include <metal_stdlib>
using namespace metal;
void ldexp_2cb32a() {
float3 res = ldexp(float3(), uint3());
}
vertex void vertex_main() {
ldexp_2cb32a();
return;
}
fragment void fragment_main() {
ldexp_2cb32a();
return;
}
kernel void compute_main() {
ldexp_2cb32a();
return;
}
tint_UUwNAv.metal:5:18: error: no matching function for call to 'ldexp'
float3 res = ldexp(float3(), uint3());
^~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3580:19: note: candidate function not viable: no known conversion from 'uint3' (vector of 3 'unsigned int' values) to 'metal::int3' (aka 'int3') for 2nd argument
METAL_FUNC float3 ldexp(float3 x, int3 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2116:17: note: candidate function not viable: no known conversion from 'float3' (vector of 3 'float' values) to 'half' for 1st argument
METAL_FUNC half ldexp(half x, int k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2360:18: note: candidate function not viable: no known conversion from 'float3' (vector of 3 'float' values) to 'metal::half2' (aka 'half2') for 1st argument
METAL_FUNC half2 ldexp(half2 x, int2 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2604:18: note: candidate function not viable: no known conversion from 'float3' (vector of 3 'float' values) to 'metal::half3' (aka 'half3') for 1st argument
METAL_FUNC half3 ldexp(half3 x, int3 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2848:18: note: candidate function not viable: no known conversion from 'float3' (vector of 3 'float' values) to 'metal::half4' (aka 'half4') for 1st argument
METAL_FUNC half4 ldexp(half4 x, int4 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3092:18: note: candidate function not viable: no known conversion from 'float3' (vector of 3 'float' values) to 'float' for 1st argument
METAL_FUNC float ldexp(float x, int k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3336:19: note: candidate function not viable: no known conversion from 'float3' (vector of 3 'float' values) to 'metal::float2' (aka 'float2') for 1st argument
METAL_FUNC float2 ldexp(float2 x, int2 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3824:19: note: candidate function not viable: no known conversion from 'float3' (vector of 3 'float' values) to 'metal::float4' (aka 'float4') for 1st argument
METAL_FUNC float4 ldexp(float4 x, int4 k)
^
1 error generated.

View File

@ -1,72 +0,0 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 37
; Schema: 0
OpCapability Shader
%15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %ldexp_2cb32a "ldexp_2cb32a"
OpName %res "res"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%8 = OpConstantNull %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%16 = OpConstantNull %v3float
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%19 = OpConstantNull %v3uint
%_ptr_Function_v3float = OpTypePointer Function %v3float
%22 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
%ldexp_2cb32a = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3float Function %16
%13 = OpExtInst %v3float %15 Ldexp %16 %19
OpStore %res %13
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %22
%tint_symbol = OpFunctionParameter %v4float
%25 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%27 = OpLabel
OpStore %tint_pointsize %float_1
%29 = OpFunctionCall %void %ldexp_2cb32a
%30 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %ldexp_2cb32a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%35 = OpLabel
%36 = OpFunctionCall %void %ldexp_2cb32a
OpReturn
OpFunctionEnd

View File

@ -1,19 +0,0 @@
fn ldexp_2cb32a() {
var res : vec3<f32> = ldexp(vec3<f32>(), vec3<u32>());
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
ldexp_2cb32a();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
ldexp_2cb32a();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
ldexp_2cb32a();
}

View File

@ -1,45 +0,0 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/intrinsic-gen
// using the template:
// test/intrinsics/intrinsics.wgsl.tmpl
// and the intrinsic defintion file:
// src/intrinsics.def
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn ldexp(vec<4, f32>, vec<4, u32>) -> vec<4, f32>
fn ldexp_4d6f6d() {
var res: vec4<f32> = ldexp(vec4<f32>(), vec4<u32>());
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
ldexp_4d6f6d();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
ldexp_4d6f6d();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
ldexp_4d6f6d();
}

View File

@ -1,24 +0,0 @@
void ldexp_4d6f6d() {
float4 res = ldexp(float4(0.0f, 0.0f, 0.0f, 0.0f), uint4(0u, 0u, 0u, 0u));
}
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() {
ldexp_4d6f6d();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() {
ldexp_4d6f6d();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
ldexp_4d6f6d();
return;
}

View File

@ -1,56 +0,0 @@
SKIP: FAILED
Validation Failure:
#include <metal_stdlib>
using namespace metal;
void ldexp_4d6f6d() {
float4 res = ldexp(float4(), uint4());
}
vertex void vertex_main() {
ldexp_4d6f6d();
return;
}
fragment void fragment_main() {
ldexp_4d6f6d();
return;
}
kernel void compute_main() {
ldexp_4d6f6d();
return;
}
tint_51Pgfs.metal:5:18: error: no matching function for call to 'ldexp'
float4 res = ldexp(float4(), uint4());
^~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3824:19: note: candidate function not viable: no known conversion from 'uint4' (vector of 4 'unsigned int' values) to 'metal::int4' (aka 'int4') for 2nd argument
METAL_FUNC float4 ldexp(float4 x, int4 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2116:17: note: candidate function not viable: no known conversion from 'float4' (vector of 4 'float' values) to 'half' for 1st argument
METAL_FUNC half ldexp(half x, int k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2360:18: note: candidate function not viable: no known conversion from 'float4' (vector of 4 'float' values) to 'metal::half2' (aka 'half2') for 1st argument
METAL_FUNC half2 ldexp(half2 x, int2 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2604:18: note: candidate function not viable: no known conversion from 'float4' (vector of 4 'float' values) to 'metal::half3' (aka 'half3') for 1st argument
METAL_FUNC half3 ldexp(half3 x, int3 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2848:18: note: candidate function not viable: no known conversion from 'float4' (vector of 4 'float' values) to 'metal::half4' (aka 'half4') for 1st argument
METAL_FUNC half4 ldexp(half4 x, int4 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3092:18: note: candidate function not viable: no known conversion from 'float4' (vector of 4 'float' values) to 'float' for 1st argument
METAL_FUNC float ldexp(float x, int k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3336:19: note: candidate function not viable: no known conversion from 'float4' (vector of 4 'float' values) to 'metal::float2' (aka 'float2') for 1st argument
METAL_FUNC float2 ldexp(float2 x, int2 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3580:19: note: candidate function not viable: no known conversion from 'float4' (vector of 4 'float' values) to 'metal::float3' (aka 'float3') for 1st argument
METAL_FUNC float3 ldexp(float3 x, int3 k)
^
1 error generated.

View File

@ -1,70 +0,0 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 35
; Schema: 0
OpCapability Shader
%14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %ldexp_4d6f6d "ldexp_4d6f6d"
OpName %res "res"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%8 = OpConstantNull %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4
%17 = OpConstantNull %v4uint
%_ptr_Function_v4float = OpTypePointer Function %v4float
%20 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
%ldexp_4d6f6d = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %8
%13 = OpExtInst %v4float %14 Ldexp %8 %17
OpStore %res %13
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %20
%tint_symbol = OpFunctionParameter %v4float
%23 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%25 = OpLabel
OpStore %tint_pointsize %float_1
%27 = OpFunctionCall %void %ldexp_4d6f6d
%28 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %ldexp_4d6f6d
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %ldexp_4d6f6d
OpReturn
OpFunctionEnd

View File

@ -1,19 +0,0 @@
fn ldexp_4d6f6d() {
var res : vec4<f32> = ldexp(vec4<f32>(), vec4<u32>());
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
ldexp_4d6f6d();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
ldexp_4d6f6d();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
ldexp_4d6f6d();
}

View File

@ -1,45 +0,0 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/intrinsic-gen
// using the template:
// test/intrinsics/intrinsics.wgsl.tmpl
// and the intrinsic defintion file:
// src/intrinsics.def
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn ldexp(vec<2, f32>, vec<2, u32>) -> vec<2, f32>
fn ldexp_7bc2fd() {
var res: vec2<f32> = ldexp(vec2<f32>(), vec2<u32>());
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
ldexp_7bc2fd();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
ldexp_7bc2fd();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
ldexp_7bc2fd();
}

View File

@ -1,24 +0,0 @@
void ldexp_7bc2fd() {
float2 res = ldexp(float2(0.0f, 0.0f), uint2(0u, 0u));
}
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() {
ldexp_7bc2fd();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() {
ldexp_7bc2fd();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
ldexp_7bc2fd();
return;
}

View File

@ -1,56 +0,0 @@
SKIP: FAILED
Validation Failure:
#include <metal_stdlib>
using namespace metal;
void ldexp_7bc2fd() {
float2 res = ldexp(float2(), uint2());
}
vertex void vertex_main() {
ldexp_7bc2fd();
return;
}
fragment void fragment_main() {
ldexp_7bc2fd();
return;
}
kernel void compute_main() {
ldexp_7bc2fd();
return;
}
tint_aJWI1V.metal:5:18: error: no matching function for call to 'ldexp'
float2 res = ldexp(float2(), uint2());
^~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3336:19: note: candidate function not viable: no known conversion from 'uint2' (vector of 2 'unsigned int' values) to 'metal::int2' (aka 'int2') for 2nd argument
METAL_FUNC float2 ldexp(float2 x, int2 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2116:17: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'half' for 1st argument
METAL_FUNC half ldexp(half x, int k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2360:18: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'metal::half2' (aka 'half2') for 1st argument
METAL_FUNC half2 ldexp(half2 x, int2 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2604:18: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'metal::half3' (aka 'half3') for 1st argument
METAL_FUNC half3 ldexp(half3 x, int3 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:2848:18: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'metal::half4' (aka 'half4') for 1st argument
METAL_FUNC half4 ldexp(half4 x, int4 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3092:18: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'float' for 1st argument
METAL_FUNC float ldexp(float x, int k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3580:19: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'metal::float3' (aka 'float3') for 1st argument
METAL_FUNC float3 ldexp(float3 x, int3 k)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.14/include/metal/metal_math:3824:19: note: candidate function not viable: no known conversion from 'float2' (vector of 2 'float' values) to 'metal::float4' (aka 'float4') for 1st argument
METAL_FUNC float4 ldexp(float4 x, int4 k)
^
1 error generated.

View File

@ -1,72 +0,0 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 37
; Schema: 0
OpCapability Shader
%15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %ldexp_7bc2fd "ldexp_7bc2fd"
OpName %res "res"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%8 = OpConstantNull %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
%16 = OpConstantNull %v2float
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
%19 = OpConstantNull %v2uint
%_ptr_Function_v2float = OpTypePointer Function %v2float
%22 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
%ldexp_7bc2fd = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2float Function %16
%13 = OpExtInst %v2float %15 Ldexp %16 %19
OpStore %res %13
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %22
%tint_symbol = OpFunctionParameter %v4float
%25 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%27 = OpLabel
OpStore %tint_pointsize %float_1
%29 = OpFunctionCall %void %ldexp_7bc2fd
%30 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %ldexp_7bc2fd
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%35 = OpLabel
%36 = OpFunctionCall %void %ldexp_7bc2fd
OpReturn
OpFunctionEnd

View File

@ -1,19 +0,0 @@
fn ldexp_7bc2fd() {
var res : vec2<f32> = ldexp(vec2<f32>(), vec2<u32>());
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
ldexp_7bc2fd();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
ldexp_7bc2fd();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
ldexp_7bc2fd();
}

View File

@ -1,45 +0,0 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/intrinsic-gen
// using the template:
// test/intrinsics/intrinsics.wgsl.tmpl
// and the intrinsic defintion file:
// src/intrinsics.def
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn ldexp(f32, u32) -> f32
fn ldexp_f54ff2() {
var res: f32 = ldexp(1.0, 1u);
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
ldexp_f54ff2();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
ldexp_f54ff2();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
ldexp_f54ff2();
}

View File

@ -1,24 +0,0 @@
void ldexp_f54ff2() {
float res = ldexp(1.0f, 1u);
}
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() {
ldexp_f54ff2();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() {
ldexp_f54ff2();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
ldexp_f54ff2();
return;
}

View File

@ -1,27 +0,0 @@
#include <metal_stdlib>
using namespace metal;
struct tint_symbol {
float4 value [[position]];
};
void ldexp_f54ff2() {
float res = ldexp(1.0f, 1u);
}
vertex tint_symbol vertex_main() {
ldexp_f54ff2();
tint_symbol const tint_symbol_1 = {.value=float4()};
return tint_symbol_1;
}
fragment void fragment_main() {
ldexp_f54ff2();
return;
}
kernel void compute_main() {
ldexp_f54ff2();
return;
}

View File

@ -1,69 +0,0 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Schema: 0
OpCapability Shader
%14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %tint_pointsize "tint_pointsize"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %ldexp_f54ff2 "ldexp_f54ff2"
OpName %res "res"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %tint_pointsize BuiltIn PointSize
OpDecorate %tint_symbol_1 BuiltIn Position
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%8 = OpConstantNull %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%20 = OpTypeFunction %void %v4float
%ldexp_f54ff2 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %4
%13 = OpExtInst %float %14 Ldexp %float_1 %uint_1
OpStore %res %13
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %20
%tint_symbol = OpFunctionParameter %v4float
%23 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%25 = OpLabel
OpStore %tint_pointsize %float_1
%26 = OpFunctionCall %void %ldexp_f54ff2
%27 = OpFunctionCall %void %tint_symbol_2 %8
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %ldexp_f54ff2
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %ldexp_f54ff2
OpReturn
OpFunctionEnd

View File

@ -1,19 +0,0 @@
fn ldexp_f54ff2() {
var res : f32 = ldexp(1.0, 1u);
}
[[stage(vertex)]]
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
ldexp_f54ff2();
return vec4<f32>();
}
[[stage(fragment)]]
fn fragment_main() {
ldexp_f54ff2();
}
[[stage(compute), workgroup_size(1)]]
fn compute_main() {
ldexp_f54ff2();
}