Hi Richard,
On 9/24/21 23:53, Richard Henderson wrote:
On 9/24/21 11:08 AM, WANG Xuerui wrote:
Oops, for some reason I only received this at about 8 pm...
That was my fault. I wrote a bunch of stuff off-line yesterday while
traveling, and the mail queue only flushed this morning.
I'll not
On 9/24/21 11:08 AM, WANG Xuerui wrote:
Oops, for some reason I only received this at about 8 pm...
That was my fault. I wrote a bunch of stuff off-line yesterday while traveling, and the
mail queue only flushed this morning.
I'll note there's a bug in my example code wrt initializing rd wi
Hi Richard,
On 9/24/21 00:50, Richard Henderson wrote:
On 9/22/21 11:09 AM, WANG Xuerui wrote:
Following up on previous, I suggest:
+static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd,
+ tcg_target_long val)
+{
+ if (type == TCG_TYPE_I32) {
+ val
On 9/22/21 11:09 AM, WANG Xuerui wrote:
Following up on previous, I suggest:
+static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd,
+ tcg_target_long val)
+{
+if (type == TCG_TYPE_I32) {
+val = (int32_t)val;
+}
+
+/* Single-instruction case
Hi Richard,
On 9/23/21 02:51, Richard Henderson wrote:
On 9/22/21 11:09 AM, WANG Xuerui wrote:
+ if (sextreg(val, 0, 52) == val) {
+ /*
+ * Fits in 52-bits, upper bits are already properly
sign-extended by
+ * cu32i.d.
+ */
+ return;
+ }
+ tcg_ou
Hi Richard,
On 9/23/21 02:39, Richard Henderson wrote:
On 9/22/21 11:09 AM, WANG Xuerui wrote:
+ if (pc_offset == (int32_t)pc_offset) {
+ tcg_target_long lo = sextreg(pc_offset, 0, 12);
+ tcg_target_long hi = pc_offset - lo;
+ tcg_out_opc_pcaddu12i(s, rd, hi >> 12);
+
On 9/22/21 11:09 AM, WANG Xuerui wrote:
+if (sextreg(val, 0, 52) == val) {
+/*
+ * Fits in 52-bits, upper bits are already properly sign-extended by
+ * cu32i.d.
+ */
+return;
+}
+tcg_out_opc_cu52i_d(s, rd, rd, top);
+}
Oh, future improvement:
On 9/22/21 11:09 AM, WANG Xuerui wrote:
+if (pc_offset == (int32_t)pc_offset) {
+tcg_target_long lo = sextreg(pc_offset, 0, 12);
+tcg_target_long hi = pc_offset - lo;
+tcg_out_opc_pcaddu12i(s, rd, hi >> 12);
+tcg_out_opc_addi_d(s, rd, rd, lo);
pc_offset = 0x7
Signed-off-by: WANG Xuerui
---
tcg/loongarch64/tcg-target.c.inc | 89
1 file changed, 89 insertions(+)
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
index 338b772732..6d28a29070 100644
--- a/tcg/loongarch64/tcg-target.c.inc
+++