|
From: Yao Qi <qiy...@cn...> - 2005-12-01 08:04:54
|
jm-insns.c would be more readable if we add Cerion's explanation in the
comment, so I coded a patch.
Index: none/tests/ppc32/jm-insns.c
===================================================================
--- none/tests/ppc32/jm-insns.c (revision 5254)
+++ none/tests/ppc32/jm-insns.c (working copy)
@@ -42,7 +42,50 @@
* I always get the result in r17 and also save XER and CCR for
* fixed-point
* operations. I also check FPSCR for floating points operations.
*
- * Improvments:
+ *
+ * Details of immediate operands patch:
+ *
+ * All the immediate test functions are of the form { imm_insn, blr }, so
+ * func_buf[1] = p[1] first copies the 'blr' over.
+ * Next, patch_op_imm16() 'patches' the imm_insn with an immediate (ii16[j])
+ * to imm_insn's operand, writing it out to func_buf, which is subsequently
+ * executed.
+ *
+ * So, for example, the function test_addi():
+ *
+ * extern void test_addi (void);
+ * asm(".text\n"
+ * "test_addi:\n"
+ * "\taddi 17, 14, 0\n"
+ * "\tblr\n"
+ * ".previous\n"
+ * );
+ *
+ * if ii16[j] is currently 9, and p[0] is,
+ *
+ * addi 17, 14, 0
+ *
+ * after patch_op_imm16, func_buf[0] becomes:
+ *
+ * addi 17, 14, 9
+ *
+ * In the immediate tests, e.g. test_int_one_reg_imm16(), if you use
+ * printf("original %s: %08x %08x\n", name, p[0], p[1]) before the patching,
+ * and printf("patched %s: %08x %08x\n", name, func_buf[0], func_buf[1])
+ * after, you can compare the imm_insn before and after patching.
+ *
+ * If you undefine USAGE_SIMPLE, you can specify a single op to test on the
+ * command-line.
+ *
+ * For reference,
+ * $./jm-insns -n addi
+ * ...
+ * original addi: 3a2e0000 4e800020
+ * patched addi: 3a2e03e7 4e800020
+ * addi 00000000, 000003e7 => 000003e7 (00000000 00000000)
+ * ...
+ *
+ * Improvements:
* a more clever FPSCR management is needed: for now, I always test
* the round-to-zero case. Other rounding modes also need to be
* tested.
*/
--
Regards, Yao
------------
Yao Qi
|
|
From: Cerion Armour-B. <ce...@op...> - 2005-12-02 19:34:37
|
On Thursday 01 December 2005 09:03, Yao Qi wrote: > jm-insns.c would be more readable if we add Cerion's explanation in the > comment, so I coded a patch. done - r5272. Clarified it some more, hope it makes sense still. C |