summaryrefslogtreecommitdiff
path: root/backend/src/ir/instruction.cpp
diff options
context:
space:
mode:
authorGuo Yejun <yejun.guo@intel.com>2015-04-16 10:50:49 +0800
committerYang Rong <rong.r.yang@intel.com>2015-04-24 10:31:00 +0800
commite2019e40f0fe73acaa057689592accff9553e0be (patch)
treec7899046ce02eb10b2b2ed4bcb00c89e6386ed51 /backend/src/ir/instruction.cpp
parent7749e0d7e2f9316f26740a48df19e3103c893749 (diff)
add simd level function __gen_ocl_get_simd_size
uint __gen_ocl_get_simd_size(); returns 8 if SIMD8, returns 16 if SIMD16 V2: add missing files remove some unnecessary functions V3: correct the dst register setting, it is possible not uniform V4: remove unnecessary function Signed-off-by: Guo Yejun <yejun.guo@intel.com> Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'backend/src/ir/instruction.cpp')
-rw-r--r--backend/src/ir/instruction.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/backend/src/ir/instruction.cpp b/backend/src/ir/instruction.cpp
index 698e33ee..86148bca 100644
--- a/backend/src/ir/instruction.cpp
+++ b/backend/src/ir/instruction.cpp
@@ -131,6 +131,17 @@ namespace ir {
Register src[srcNum]; //!< Indices of the sources
};
+ /*! All 0-source arithmetic instructions */
+ class ALIGNED_INSTRUCTION NullaryInstruction : public NaryInstruction<0>
+ {
+ public:
+ NullaryInstruction(Opcode opcode, Type type, Register dst) {
+ this->opcode = opcode;
+ this->type = type;
+ this->dst[0] = dst;
+ }
+ };
+
/*! All 1-source arithmetic instructions */
class ALIGNED_INSTRUCTION UnaryInstruction : public NaryInstruction<1>
{
@@ -1306,6 +1317,10 @@ namespace ir {
}; \
}
+START_INTROSPECTION(NullaryInstruction)
+#include "ir/instruction.hxx"
+END_INTROSPECTION(NullaryInstruction)
+
START_INTROSPECTION(UnaryInstruction)
#include "ir/instruction.hxx"
END_INTROSPECTION(UnaryInstruction)
@@ -1533,6 +1548,7 @@ END_FUNCTION(Instruction, Register)
return reinterpret_cast<const internal::CLASS*>(this)->CALL; \
}
+DECL_MEM_FN(NullaryInstruction, Type, getType(void), getType())
DECL_MEM_FN(UnaryInstruction, Type, getType(void), getType())
DECL_MEM_FN(BinaryInstruction, Type, getType(void), getType())
DECL_MEM_FN(BinaryInstruction, bool, commutes(void), commutes())
@@ -1586,6 +1602,20 @@ DECL_MEM_FN(GetImageInfoInstruction, uint8_t, getImageIndex(void), getImageIndex
///////////////////////////////////////////////////////////////////////////
// Implements the emission functions
///////////////////////////////////////////////////////////////////////////
+ // For all nullary functions with given opcode
+ Instruction ALU0(Opcode opcode, Type type, Register dst) {
+ return internal::NullaryInstruction(opcode, type, dst).convert();
+ }
+
+ // All nullary functions
+#define DECL_EMIT_FUNCTION(NAME) \
+ Instruction NAME(Type type, Register dst) { \
+ return ALU0(OP_##NAME, type, dst);\
+ }
+
+ DECL_EMIT_FUNCTION(SIMD_SIZE)
+
+#undef DECL_EMIT_FUNCTION
// For all unary functions with given opcode
Instruction ALU1(Opcode opcode, Type type, Register dst, Register src) {