Skip to content

Commit 6ce09cd

Browse files
committed
Impletment float eq operation in aot_intrinsics
1 parent 647fc89 commit 6ce09cd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/iwasm/aot/aot_intrinsic.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#include "aot_intrinsic.h"
77

8+
#include <float.h>
9+
810
typedef struct {
911
const char *llvm_intrinsic;
1012
const char *native_intrinsic;
@@ -425,6 +427,9 @@ int32
425427
aot_intrinsic_f32_cmp(AOTFloatCond cond, float32 lhs, float32 rhs)
426428
{
427429
switch (cond) {
430+
case FLOAT_EQ:
431+
return fabsf(lhs - rhs) <= __FLT_EPSILON__ ? 1 : 0;
432+
428433
case FLOAT_LT:
429434
return lhs < rhs ? 1 : 0;
430435

@@ -453,6 +458,9 @@ int32
453458
aot_intrinsic_f64_cmp(AOTFloatCond cond, float64 lhs, float64 rhs)
454459
{
455460
switch (cond) {
461+
case FLOAT_EQ:
462+
return fabs(lhs - rhs) <= __DBL_EPSILON__ ? 1 : 0;
463+
456464
case FLOAT_LT:
457465
return lhs < rhs ? 1 : 0;
458466

0 commit comments

Comments
 (0)