[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v11 11/26] target/loongarch: Add floating point comparison in
From: |
gaosong |
Subject: |
Re: [PATCH v11 11/26] target/loongarch: Add floating point comparison instruction translation |
Date: |
Tue, 30 Nov 2021 16:22:34 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
Hi Richard,
On 2021/11/20 下午5:02, Richard Henderson
wrote:
+#define FCMP_LT
0x0001 /* fp0 < fp1 */
+#define FCMP_EQ 0x0010 /* fp0 = fp1 */
+#define FCMP_UN 0x0100 /* unordered */
+#define FCMP_GT 0x1000 /* fp0 > fp1 */
Any reason why these bits are not sequential?
I think this is consistent with the description in Table 9, and the
FCMP_GT is need 0x7.
In get_fcmp_flags(int cond) the param 'cond' is table 9 COND
>> 1,
table 9
COND True Condition
0x2 LT
0x4 EQ
0x6 EQ LT
0x8 UN
0x10 GT LT
...
COND >> 1 Flags
0x1 FCMP_LT FCMP_LT 0x1
0x2 FCMP_EQ FCMP_EQ 0x2
0x3 FCMP_EQ | FCMP_LT
0x4 FCMP_UN FCMP_UN 0x4
0x8 FCMP_GT | FCMP_LT FCMP_GT 0x7
...
so our definitions :
#define FCMP_LT 0x1 /* fp0 < fp1 */
#define FCMP_EQ 0x2 /* fp0 = fp1 */
#define FCMP_UN 0x4 /* unordered */
#define FCMP_GT 0x7 /* fp0 > fp1 */
get_fcmp_flags:
/* bit0(signaling/quiet) bit1(lt) bit2(eq) bit3(un) bit4(neq) */
static uint32_t get_fcmp_flags(int cond)
{
uint32_t flags = 0;
if (cond & 0x1) {
flags |= FCMP_LT;
}
if (cond & 0x2) {
flags |= FCMP_EQ;
}
if (cond & 0x4) {
flags |= FCMP_UN;
}
if (cond & 0x8) {
flags |= FCMP_GT | FCMP_LT;
}
return flags;
}
If not .
We should like:
#define FCMP_LT 0x1 /* fp0 < fp1 */
#define FCMP_EQ 0x2 /* fp0 = fp1 */
#define FCMP_UN 0x3 /* unordered */
#define FCMP_GT 0x4 /* fp0 > fp1 */
static uint32_t get_fcmp_flags(int cond)
{
uint32_t flags = 0;
if (cond & 0x1) {
flags |= FCMP_LT;
}
if (cond & 0x2) {
flags |= FCMP_EQ;
}
if (cond & 0x3) {
flags |= FCMP_UN;
}
if (cond & 0x4) {
flags |= FCMP_GT;
}
return flags;
}
Is this right?
Thanks
Song Gao
- [PATCH v11 01/26] target/loongarch: Add README, (continued)
- [PATCH v11 01/26] target/loongarch: Add README, Song Gao, 2021/11/19
- [PATCH v11 06/26] target/loongarch: Add fixed point bit instruction translation, Song Gao, 2021/11/19
- [PATCH v11 07/26] target/loongarch: Add fixed point load/store instruction translation, Song Gao, 2021/11/19
- [PATCH v11 02/26] target/loongarch: Add core definition, Song Gao, 2021/11/19
- [PATCH v11 03/26] target/loongarch: Add main translation routines, Song Gao, 2021/11/19
- [PATCH v11 11/26] target/loongarch: Add floating point comparison instruction translation, Song Gao, 2021/11/19
[PATCH v11 10/26] target/loongarch: Add floating point arithmetic instruction translation, Song Gao, 2021/11/19
[PATCH v11 13/26] target/loongarch: Add floating point move instruction translation, Song Gao, 2021/11/19
[PATCH v11 14/26] target/loongarch: Add floating point load/store instruction translation, Song Gao, 2021/11/19
[PATCH v11 15/26] target/loongarch: Add branch instruction translation, Song Gao, 2021/11/19
[PATCH v11 20/26] linux-user: Add LoongArch elf support, Song Gao, 2021/11/19