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";