Thread (16 messages) 16 messages, 3 authors, 2013-10-17

RE: [PATCH 02/10][v6] powerpc/Power7: detect load/store instructions

From: David Laight <hidden>
Date: 2013-10-16 08:28:05
Also in: lkml

Implement instr_is_load_store_2_06() to detect whether a given =
instruction
is one of the fixed-point or floating-point load/store instructions in =
the
POWER Instruction Set Architecture v2.06.
...
+int instr_is_load_store_2_06(const unsigned int *instr)
+{
+	unsigned int op, upper, lower;
+
+	op =3D instr_opcode(*instr);
+
+	if ((op >=3D 32 && op <=3D 58) || (op =3D=3D 61 || op =3D=3D 62))
+		return true;
+
+	if (op !=3D 31)
+		return false;
+
+	upper =3D op >> 5;
+	lower =3D op & 0x1f;
+
+	/* Short circuit as many misses as we can */
+	if (lower < 3 || lower > 23)
+		return false;
+
+	if (lower =3D=3D 3) {
+		if (upper >=3D 16)
+			return true;
+
+		return false;
+	}
+
+	if (lower =3D=3D 7 || lower =3D=3D 12)
+		return true;
+
+	if (lower >=3D 20) /* && lower <=3D 23 (implicit) */
+		return true;
+
+	return false;
+}
I can't help feeling the code could do with some comments about
which actual instructions are selected where.

	David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help