[Beignet] [PATCH 1/2] GBE: support load/store of char/short vector.
Yang, Rong R
rong.r.yang at intel.com
Tue May 28 22:23:58 PDT 2013
LGTM.
-----Original Message-----
From: beignet-bounces+rong.r.yang=intel.com at lists.freedesktop.org [mailto:beignet-bounces+rong.r.yang=intel.com at lists.freedesktop.org] On Behalf Of Zhigang Gong
Sent: Friday, May 24, 2013 5:46 PM
To: beignet at lists.freedesktop.org
Cc: Zhigang Gong
Subject: [Beignet] [PATCH 1/2] GBE: support load/store of char/short vector.
We just load/store those vector elements one by one.
Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
backend/src/llvm/llvm_gen_backend.cpp | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 3fe0cbf..0037af2 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -2224,8 +2224,27 @@ namespace gbe
ctx.STORE(type, tuple, addr, addrSpace, 4, true);
}
}
- } else
- GBE_ASSERTM(false, "loads / stores of vectors of short / chars is not supported yet");
+ } else {
+ for (uint32_t elemID = 0; elemID < elemNum; elemID++) {
+ const ir::Register reg = this->getRegister(llvmValues, elemID);
+ ir::Register addr;
+ if (elemID == 0)
+ addr = ptr;
+ else {
+ const ir::Register offset = ctx.reg(pointerFamily);
+ ir::ImmediateIndex immIndex;
+ int elemSize = getTypeByteSize(unit, elemType);
+ immIndex = ctx.newImmediate(int32_t(elemID * elemSize));
+ addr = ctx.reg(pointerFamily);
+ ctx.LOADI(ir::TYPE_S32, offset, immIndex);
+ ctx.ADD(ir::TYPE_S32, addr, ptr, offset);
+ }
+ if (isLoad)
+ ctx.LOAD(type, addr, addrSpace, dwAligned, reg);
+ else
+ ctx.STORE(type, addr, addrSpace, dwAligned, reg);
+ }
+ }
}
}
--
1.7.11.7
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list