implement unary float operations for simd

This commit is contained in:
Ilya Rezvov
2023-09-10 14:27:28 -06:00
parent 0d8159e553
commit a4a96af6aa
4 changed files with 33 additions and 10 deletions
+4 -5
View File
@@ -164,13 +164,12 @@ runScript onAssertFail script = do
isValueMatch val v@(Parser.ExactValue _) = isValueEqual val $ asArg v
isValueMatch (Interpreter.VF32 v) Parser.CanonicalNan = identicalIEEE v nan || identicalIEEE v (abs nan)
isValueMatch (Interpreter.VF32 v) Parser.ArithmeticNan =
-- floatToWord v .&. floatToWord (abs nan) == floatToWord (abs nan)
isNaN v
let posNan = 0x7F800000 in
floatToWord v .&. posNan == posNan
isValueMatch (Interpreter.VF64 v) Parser.CanonicalNan = identicalIEEE v nan || identicalIEEE v (abs nan)
isValueMatch (Interpreter.VF64 v) Parser.ArithmeticNan =
-- let posNan = doubleToWord (abs nan) in
-- doubleToWord v .&. posNan == posNan
isNaN v
let posNan = 0x7FF0000000000000 in
doubleToWord v .&. posNan == posNan
isValueMatch (Interpreter.VV128 v) (Parser.VectorPat Struct.F32x4 pat) =
let vals = Interpreter.VF32 . wordToFloat . ByteArray.indexByteArray v <$> [0..3] in
and $ zipWith isValueMatch vals pat