Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <optional>

#include <xa_nnlib_api.h>
#include <xtensa/tie/xt_datacache.h>

#include <executorch/backends/cadence/generic/operators/op_quantized_linear.h>
#include <executorch/backends/cadence/hifi/kernels/kernels.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@
#include "xa_nnlib_common_fpu.h"
#include "xa_nnlib_err_chk.h"

// HiFi1 compatibility: int32_rtor_xtbool2 is not available on HiFi1
#ifndef int32_rtor_xtbool2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not needed. Can remove this line
xtbool2 con = int32_rtor_xtbool2(0x00000003);
the vaiable not used

static inline xtbool2 int32_rtor_xtbool2(int val) {
// Convert an int to xtbool2 - the 2 LSBs represent the 2 bools
// Use comparison operations available on HiFi1 to generate xtbool2
// Create vectors where the values are -1 (true bit) or 0 (false bit)
ae_int32x2 bits = AE_MOVDA32X2((val >> 1) & 1, val & 1);
ae_int32x2 zero = AE_ZERO32();
// Compare bits > 0 to get xtbool2 (true where bit is set)
return AE_LT32(zero, bits);
}
#endif

#if !HAVE_VFPU
DISCARD_FUN_FOR_NONVOID_RETURN(
WORD32, xa_nn_elm_maximum_f32xf32_f32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
#include "xa_nnlib_err_chk.h"
#include "xa_nnlib_kernels_api.h"

// HiFi1 compatibility: AE_MOVAB is not available on HiFi1
#ifndef AE_MOVAB
static inline unsigned char AE_MOVAB(xtbool b) {
Copy link
Contributor

@dijopaul dijopaul Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use the below code

#ifndef AE_MOVAB
#ifdef AE_MOVAB1
#define AE_MOVAB AE_MOVAB1
#else
#define AE_MOVAB(x) (x)
#endif
#endif

#ifndef AE_MOVAB2
#define AE_MOVAB2(x) (x)
#endif

return b ? 1 : 0;
}
#endif

#ifndef AE_MOVAB2
static inline unsigned char AE_MOVAB2(xtbool2 b2) {
ae_int32x2 d0 = 0;
ae_int32x2 d1 = 1;
AE_MOVT32X2(d0, d1, b2);
unsigned int low, high;
low = AE_MOVAD32_L(d0);
high = AE_MOVAD32_H(d0);
return (unsigned char)((high << 1) | low);
}
#endif


#if !HAVE_VFPU
DISCARD_FUN_FOR_NONVOID_RETURN(
Expand Down
Loading