Skip to content

Commit 9851810

Browse files
authored
Add fuzzing support for more FP16 instructions (#8678)
This adds fuzzing support for several FP16 half-precision vector instructions: SplatVecF16x8, MaddVecF16x8, NmaddVecF16x8, DemoteZeroVecF32x4ToVecF16x8, and DemoteZeroVecF64x2ToVecF16x8.
1 parent f6f01de commit 9851810

1 file changed

Lines changed: 21 additions & 14 deletions

File tree

src/tools/fuzzing/fuzzing.cpp

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4458,7 +4458,10 @@ Expression* TranslateToFuzzReader::makeUnary(Type type) {
44584458
case 1:
44594459
return buildUnary({SplatVecI64x2, make(Type::i64)});
44604460
case 2:
4461-
return buildUnary({SplatVecF32x4, make(Type::f32)});
4461+
return buildUnary({pick(FeatureOptions<UnaryOp>()
4462+
.add(FeatureSet::SIMD, SplatVecF32x4)
4463+
.add(FeatureSet::FP16, SplatVecF16x8)),
4464+
make(Type::f32)});
44624465
case 3:
44634466
return buildUnary({SplatVecF64x2, make(Type::f64)});
44644467
case 4:
@@ -4531,7 +4534,9 @@ Expression* TranslateToFuzzReader::makeUnary(Type type) {
45314534
TruncSatUVecF16x8ToVecI16x8,
45324535
ConvertSVecI16x8ToVecF16x8,
45334536
ConvertUVecI16x8ToVecF16x8,
4534-
PromoteLowVecF16x8ToVecF32x4)),
4537+
PromoteLowVecF16x8ToVecF32x4,
4538+
DemoteZeroVecF32x4ToVecF16x8,
4539+
DemoteZeroVecF64x2ToVecF16x8)),
45354540
make(Type::v128)});
45364541
}
45374542
WASM_UNREACHABLE("invalid value");
@@ -5121,18 +5126,20 @@ Expression* TranslateToFuzzReader::makeSIMDShuffle() {
51215126
}
51225127

51235128
Expression* TranslateToFuzzReader::makeSIMDTernary() {
5124-
SIMDTernaryOp op = pick(FeatureOptions<SIMDTernaryOp>()
5125-
.add(FeatureSet::SIMD, Bitselect)
5126-
.add(FeatureSet::RelaxedSIMD,
5127-
RelaxedMaddVecF32x4,
5128-
RelaxedNmaddVecF32x4,
5129-
RelaxedMaddVecF64x2,
5130-
RelaxedNmaddVecF64x2,
5131-
RelaxedLaneselectI8x16,
5132-
RelaxedLaneselectI16x8,
5133-
RelaxedLaneselectI32x4,
5134-
RelaxedLaneselectI64x2,
5135-
RelaxedDotI8x16I7x16AddSToVecI32x4));
5129+
SIMDTernaryOp op =
5130+
pick(FeatureOptions<SIMDTernaryOp>()
5131+
.add(FeatureSet::SIMD, Bitselect)
5132+
.add(FeatureSet::RelaxedSIMD,
5133+
RelaxedMaddVecF32x4,
5134+
RelaxedNmaddVecF32x4,
5135+
RelaxedMaddVecF64x2,
5136+
RelaxedNmaddVecF64x2,
5137+
RelaxedLaneselectI8x16,
5138+
RelaxedLaneselectI16x8,
5139+
RelaxedLaneselectI32x4,
5140+
RelaxedLaneselectI64x2,
5141+
RelaxedDotI8x16I7x16AddSToVecI32x4)
5142+
.add(FeatureSet::FP16, MaddVecF16x8, NmaddVecF16x8));
51365143
Expression* a = make(Type::v128);
51375144
Expression* b = make(Type::v128);
51385145
Expression* c = make(Type::v128);

0 commit comments

Comments
 (0)