glib-2.0
)
+# Check orc lib and orc compiler
IF(ENABLE_ORC)
FIND_LIBRARY(ORC_LIB orc-0.4)
- IF(ORC_LIB)
+ FIND_PROGRAM(ORC_COMP orcc)
+
+ IF(ORC_LIB AND ORC_COMP)
SET(PKG_MODULES ${PKG_MODULES} orc-0.4)
- ADD_DEFINITIONS(-DHAVE_ORC)
- ELSE(ORC_LIB)
+ SET(HAVE_ORC ON)
+ ADD_DEFINITIONS(-DHAVE_ORC=1)
+ ELSE(ORC_LIB AND ORC_COMP)
MESSAGE("Cannot find orc library")
- ENDIF(ORC_LIB)
+ ADD_DEFINITIONS(-DDISABLE_ORC=1)
+ ENDIF(ORC_LIB AND ORC_COMP)
+ELSE(ENABLE_ORC)
+ ADD_DEFINITIONS(-DDISABLE_ORC=1)
ENDIF(ENABLE_ORC)
pkg_check_modules(pkgs REQUIRED ${PKG_MODULES})
-ADD_LIBRARY(tensor_transformOBJ OBJECT tensor_transform.c)
+SET(TRANSFORM_SRCS
+ tensor_transform.c
+)
+
+IF(DEFINED HAVE_ORC AND HAVE_ORC)
+ SET(ORC_SOURCE transform-orc)
+ SET(ORC_OUT_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/${ORC_SOURCE})
+
+ # Generate orc .h and .c files
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${ORC_OUT_PREFIX}.h ${ORC_OUT_PREFIX}.c
+ COMMAND rm -f ${ORC_OUT_PREFIX}.h
+ COMMAND rm -f ${ORC_OUT_PREFIX}.c
+ COMMAND orcc --implementation --include glib.h -o ${ORC_OUT_PREFIX}.c ${ORC_OUT_PREFIX}.orc
+ COMMAND orcc --header --include glib.h -o ${ORC_OUT_PREFIX}.h ${ORC_OUT_PREFIX}.orc
+ DEPENDS ${ORC_OUT_PREFIX}.orc
+ )
+
+ SET(TRANSFORM_SRCS ${TRANSFORM_SRCS} ${ORC_SOURCE}.c)
+ENDIF(DEFINED HAVE_ORC AND HAVE_ORC)
+
+ADD_LIBRARY(tensor_transformOBJ OBJECT ${TRANSFORM_SRCS})
+
+IF(DEFINED HAVE_ORC AND HAVE_ORC)
+ # Add dependency
+ ADD_CUSTOM_TARGET(
+ generated-orc
+ DEPENDS ${ORC_SOURCE}.h ${ORC_SOURCE}.c
+ )
+
+ ADD_DEPENDENCIES(tensor_transformOBJ generated-orc)
+ENDIF(DEFINED HAVE_ORC AND HAVE_ORC)
--- /dev/null
+.function nns_orc_add_s8
+.dest 1 d1 gint8
+.source 1 s1 gint8
+
+addssb d1, d1, s1
+
+
+.function nns_orc_add_u8
+.dest 1 d1 guint8
+.source 1 s1 guint8
+
+addusb d1, d1, s1
+
+
+.function nns_orc_add_s16
+.dest 2 d1 gint16
+.source 2 s1 gint16
+
+addssw d1, d1, s1
+
+
+.function nns_orc_add_u16
+.dest 2 d1 guint16
+.source 2 s1 guint16
+
+addusw d1, d1, s1
+
+
+.function nns_orc_add_s32
+.dest 4 d1 gint32
+.source 4 s1 gint32
+
+addssl d1, d1, s1
+
+
+.function nns_orc_add_u32
+.dest 4 d1 guint32
+.source 4 s1 guint32
+
+addusl d1, d1, s1
+
+
+.function nns_orc_add_f32
+.dest 4 d1 float
+.source 4 s1 float
+
+addf d1, d1, s1
+
+
+.function nns_orc_add_f64
+.dest 8 d1 double
+.source 8 s1 double
+
+addd d1, d1, s1