[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 09/30] tcg/loongarch64: Implement tcg_out_mov and tcg_out_
From: |
Richard Henderson |
Subject: |
Re: [PATCH v3 09/30] tcg/loongarch64: Implement tcg_out_mov and tcg_out_movi |
Date: |
Wed, 22 Sep 2021 11:51:47 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
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: constants with 52 low zero bits can be loaded with cu52i(rd, zero,
val >> 52).
Which means there's a set of interesting constants:
abc0_0000_0000_0def
ori rd, zero, 0xdef
cu52i rd, rd, 0xabc
abcf_ffff_ffff_fdef
cu52i rd, zero, 0xabc - 1
addi.d rd, rd, 0xdef
Also,
+ tcg_out_opc_lu12i_w(s, rd, upper);
+ if (low != 0) {
+ tcg_out_opc_ori(s, rd, rd, low & 0xfff);
+ }
when upper == 0 and low != 0, we can omit the lu12i.
r~
[PATCH v3 07/30] tcg/loongarch64: Implement necessary relocation operations, WANG Xuerui, 2021/09/22
[PATCH v3 05/30] tcg/loongarch64: Add register names, allocation order and input/output sets, WANG Xuerui, 2021/09/22
[PATCH v3 10/30] tcg/loongarch64: Implement goto_ptr, WANG Xuerui, 2021/09/22