summaryrefslogtreecommitdiffstats
path: root/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp
diff options
context:
space:
mode:
authorPaul Lind <plind@mips.com>2012-02-01 10:54:19 -0800
committerPaul Lind <plind@mips.com>2012-08-13 11:41:15 -0700
commit2bc2b792782b304b15d8c48b54916a9b3fa3a7ac (patch)
tree12bdbda74e161ec1a3874fb873912641315ddb14 /libpixelflinger/codeflinger/ARMAssemblerInterface.cpp
parentae8927aa05adf9e5a00760b45e4634eecf6340e3 (diff)
downloadsystem_core-2bc2b792782b304b15d8c48b54916a9b3fa3a7ac.tar.gz
system_core-2bc2b792782b304b15d8c48b54916a9b3fa3a7ac.tar.bz2
system_core-2bc2b792782b304b15d8c48b54916a9b3fa3a7ac.zip
Add MIPS support to pixelflinger.
See the comment-block at the top of MIPSAssembler.cpp for implementation overview. Change-Id: Id492c10610574af8c89c38d19e12fafc3652c28a
Diffstat (limited to 'libpixelflinger/codeflinger/ARMAssemblerInterface.cpp')
-rw-r--r--libpixelflinger/codeflinger/ARMAssemblerInterface.cpp123
1 files changed, 8 insertions, 115 deletions
diff --git a/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp b/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp
index 7fa0de0a8..82180eef0 100644
--- a/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp
+++ b/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp
@@ -32,77 +32,15 @@ ARMAssemblerInterface::~ARMAssemblerInterface()
{
}
-int ARMAssemblerInterface::buildImmediate(
- uint32_t immediate, uint32_t& rot, uint32_t& imm)
-{
- rot = 0;
- imm = immediate;
- if (imm > 0x7F) { // skip the easy cases
- while (!(imm&3) || (imm&0xFC000000)) {
- uint32_t newval;
- newval = imm >> 2;
- newval |= (imm&3) << 30;
- imm = newval;
- rot += 2;
- if (rot == 32) {
- rot = 0;
- break;
- }
- }
- }
- rot = (16 - (rot>>1)) & 0xF;
-
- if (imm>=0x100)
- return -EINVAL;
-
- if (((imm>>(rot<<1)) | (imm<<(32-(rot<<1)))) != immediate)
- return -1;
-
- return 0;
-}
-
-// shifters...
-
-bool ARMAssemblerInterface::isValidImmediate(uint32_t immediate)
-{
- uint32_t rot, imm;
- return buildImmediate(immediate, rot, imm) == 0;
-}
-
-uint32_t ARMAssemblerInterface::imm(uint32_t immediate)
-{
- uint32_t rot, imm;
- int err = buildImmediate(immediate, rot, imm);
-
- LOG_ALWAYS_FATAL_IF(err==-EINVAL,
- "immediate %08x cannot be encoded",
- immediate);
-
- LOG_ALWAYS_FATAL_IF(err,
- "immediate (%08x) encoding bogus!",
- immediate);
+// --------------------------------------------------------------------
- return (1<<25) | (rot<<8) | imm;
-}
-
-uint32_t ARMAssemblerInterface::reg_imm(int Rm, int type, uint32_t shift)
-{
- return ((shift&0x1F)<<7) | ((type&0x3)<<5) | (Rm&0xF);
-}
-
-uint32_t ARMAssemblerInterface::reg_rrx(int Rm)
-{
- return (ROR<<5) | (Rm&0xF);
-}
+// The following two functions are static and used for initializers
+// in the original ARM code. The above versions (without __), are now
+// virtual, and can be overridden in the MIPS code. But since these are
+// needed at initialization time, they must be static. Not thrilled with
+// this implementation, but it works...
-uint32_t ARMAssemblerInterface::reg_reg(int Rm, int type, int Rs)
-{
- return ((Rs&0xF)<<8) | ((type&0x3)<<5) | (1<<4) | (Rm&0xF);
-}
-
-// addressing modes...
-// LDR(B)/STR(B)/PLD (immediate and Rm can be negative, which indicate U=0)
-uint32_t ARMAssemblerInterface::immed12_pre(int32_t immed12, int W)
+uint32_t ARMAssemblerInterface::__immed12_pre(int32_t immed12, int W)
{
LOG_ALWAYS_FATAL_IF(abs(immed12) >= 0x800,
"LDR(B)/STR(B)/PLD immediate too big (%08x)",
@@ -111,30 +49,7 @@ uint32_t ARMAssemblerInterface::immed12_pre(int32_t immed12, int W)
((W&1)<<21) | (abs(immed12)&0x7FF);
}
-uint32_t ARMAssemblerInterface::immed12_post(int32_t immed12)
-{
- LOG_ALWAYS_FATAL_IF(abs(immed12) >= 0x800,
- "LDR(B)/STR(B)/PLD immediate too big (%08x)",
- immed12);
-
- return (((uint32_t(immed12)>>31)^1)<<23) | (abs(immed12)&0x7FF);
-}
-
-uint32_t ARMAssemblerInterface::reg_scale_pre(int Rm, int type,
- uint32_t shift, int W)
-{
- return (1<<25) | (1<<24) |
- (((uint32_t(Rm)>>31)^1)<<23) | ((W&1)<<21) |
- reg_imm(abs(Rm), type, shift);
-}
-
-uint32_t ARMAssemblerInterface::reg_scale_post(int Rm, int type, uint32_t shift)
-{
- return (1<<25) | (((uint32_t(Rm)>>31)^1)<<23) | reg_imm(abs(Rm), type, shift);
-}
-
-// LDRH/LDRSB/LDRSH/STRH (immediate and Rm can be negative, which indicate U=0)
-uint32_t ARMAssemblerInterface::immed8_pre(int32_t immed8, int W)
+uint32_t ARMAssemblerInterface::__immed8_pre(int32_t immed8, int W)
{
uint32_t offset = abs(immed8);
@@ -146,28 +61,6 @@ uint32_t ARMAssemblerInterface::immed8_pre(int32_t immed8, int W)
((W&1)<<21) | (((offset&0xF0)<<4)|(offset&0xF));
}
-uint32_t ARMAssemblerInterface::immed8_post(int32_t immed8)
-{
- uint32_t offset = abs(immed8);
-
- LOG_ALWAYS_FATAL_IF(abs(immed8) >= 0x100,
- "LDRH/LDRSB/LDRSH/STRH immediate too big (%08x)",
- immed8);
-
- return (1<<22) | (((uint32_t(immed8)>>31)^1)<<23) |
- (((offset&0xF0)<<4) | (offset&0xF));
-}
-
-uint32_t ARMAssemblerInterface::reg_pre(int Rm, int W)
-{
- return (1<<24) | (((uint32_t(Rm)>>31)^1)<<23) | ((W&1)<<21) | (abs(Rm)&0xF);
-}
-
-uint32_t ARMAssemblerInterface::reg_post(int Rm)
-{
- return (((uint32_t(Rm)>>31)^1)<<23) | (abs(Rm)&0xF);
-}
-
}; // namespace android