summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2008-02-14 18:29:51 -0800
committerIan Romanick <idr@us.ibm.com>2008-02-15 09:40:44 -0800
commit2cc0c3b99703bb10e0b320001183acb728e5488e (patch)
tree2f5bf90e585fccabc3e25b6ce3bba2af608d2cc1
parentc179bc990108a8ea691ceab03fd68a12396ab538 (diff)
Correct the convert to and from float instructions
-rw-r--r--src/mesa/ppc/rtasm/spe_asm.c34
-rw-r--r--src/mesa/ppc/rtasm/spe_asm.h12
2 files changed, 42 insertions, 4 deletions
diff --git a/src/mesa/ppc/rtasm/spe_asm.c b/src/mesa/ppc/rtasm/spe_asm.c
index f8aff9050b..1037637250 100644
--- a/src/mesa/ppc/rtasm/spe_asm.c
+++ b/src/mesa/ppc/rtasm/spe_asm.c
@@ -88,6 +88,20 @@ union spe_inst_RI7 {
/**
+ * Encode one output register with one input reg. and an 8-bit signed immed
+ */
+union spe_inst_RI8 {
+ uint32_t bits;
+ struct {
+ unsigned op:10;
+ unsigned i8:8;
+ unsigned rA:7;
+ unsigned rT:7;
+ } inst;
+};
+
+
+/**
* Encode one output register with one input reg. and a 10-bit signed immed
*/
union spe_inst_RI10 {
@@ -169,6 +183,20 @@ static void emit_RI7(struct spe_function *p, unsigned op, unsigned rT,
+static void emit_RI8(struct spe_function *p, unsigned op, unsigned rT,
+ unsigned rA, int imm)
+{
+ union spe_inst_RI8 inst;
+ inst.inst.op = op;
+ inst.inst.i8 = imm;
+ inst.inst.rA = rA;
+ inst.inst.rT = rT;
+ *p->csr = inst.bits;
+ p->csr++;
+}
+
+
+
static void emit_RI10(struct spe_function *p, unsigned op, unsigned rT,
unsigned rA, int imm)
{
@@ -238,6 +266,12 @@ void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \
emit_RI7(p, _op, rT, rA, imm); \
}
+#define EMIT_RI8(_name, _op) \
+void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \
+{ \
+ emit_RI8(p, _op, rT, rA, 155 - imm); \
+}
+
#define EMIT_RI10(_name, _op) \
void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \
{ \
diff --git a/src/mesa/ppc/rtasm/spe_asm.h b/src/mesa/ppc/rtasm/spe_asm.h
index 9532669b8c..6d69ae655d 100644
--- a/src/mesa/ppc/rtasm/spe_asm.h
+++ b/src/mesa/ppc/rtasm/spe_asm.h
@@ -60,6 +60,9 @@ extern void spe_release_func(struct spe_function *p);
#define EMIT_RI7(_name, _op) \
extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
int imm)
+#define EMIT_RI8(_name, _op) \
+ extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
+ int imm)
#define EMIT_RI10(_name, _op) \
extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \
int imm)
@@ -270,10 +273,10 @@ EMIT_RR (spe_dfnma, 0x35f);
EMIT_R (spe_frest, 0x1b8);
EMIT_R (spe_frsqest, 0x1b9);
EMIT_RR (spe_fi, 0x3d4);
-EMIT_RI7 (spe_csflt, 0x3da);
-EMIT_RI7 (spe_cflts, 0x3d8);
-EMIT_RI7 (spe_cuflt, 0x3db);
-EMIT_RI7 (spe_cfltu, 0x3d9);
+EMIT_RI8 (spe_csflt, 0x1da);
+EMIT_RI8 (spe_cflts, 0x1d8);
+EMIT_RI8 (spe_cuflt, 0x1db);
+EMIT_RI8 (spe_cfltu, 0x1d9);
EMIT_R (spe_frds, 0x3b9);
EMIT_R (spe_fesd, 0x3b8);
EMIT_RR (spe_dfceq, 0x3c3);
@@ -302,6 +305,7 @@ EMIT_R (spe_wrch, 0x10d);
#undef EMIT_RR
#undef EMIT_RRR
#undef EMIT_RI7
+#undef EMIT_RI8
#undef EMIT_RI10
#undef EMIT_RI16
#undef EMIT_RI18