Skip to contentSkip to conversation

Hexagon (target/hexagon) remove unused functions

PATCH In review Taylor Simpson 2 participants 4 messages Apr 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Hexagon (target/hexagon) remove unused functions

Remove gen_read_reg and gen_set_byte

---
 target/hexagon/genptr.c | 11 -----------
 1 file changed, 11 deletions(-)
target/hexagon/genptr.c +0 -11
index 55c7cd8..f93f895 100644
@@ -28,12 +28,6 @@
 #undef QEMU_GENERATE
 #include "gen_tcg.h"
 
-static inline TCGv gen_read_reg(TCGv result, int num)
-{
-    tcg_gen_mov_tl(result, hex_gpr[num]);
-    return result;
-}
-
 static inline TCGv gen_read_preg(TCGv pred, uint8_t num)
 {
     tcg_gen_mov_tl(pred, hex_pred[num]);
@@ -319,11 +313,6 @@ static inline void gen_set_half_i64(int N, TCGv_i64 result, TCGv src)
     tcg_temp_free_i64(src64);
 }
 
-static inline void gen_set_byte(int N, TCGv result, TCGv src)
-{
-    tcg_gen_deposit_tl(result, result, src, N * 8, 8);
-}
-
 static void gen_set_byte_i64(int N, TCGv_i64 result, TCGv src)
 {
     TCGv_i64 src64 = tcg_temp_new_i64();
Signature · 1 line
2.7.4
#1 lore raw

Hi Taylor,

Quoted 5 lines · Taylor Simpson

Remove gen_read_reg and gen_set_byte

---

To help git-tools (and reviewers), please use the 'Based-on' tag the next time you send a patch depending on another one:
Based-on: <[email protected]>

Quoted 8 lines
 target/hexagon/genptr.c | 11 -----------
 1 file changed, 11 deletions(-)
target/hexagon/genptr.c +0 -0
index 55c7cd8..f93f895 100644

target/hexagon/genptr.c line 35

Quoted 8 lines
target/hexagon/genptr.c +0 -5
@@ -28,12 +28,6 @@
 #undef QEMU_GENERATE
 #include "gen_tcg.h"
 
-static inline TCGv gen_read_reg(TCGv result, int num)
-{
-    tcg_gen_mov_tl(result, hex_gpr[num]);
-    return result;
-}

But what about:

target/hexagon/macros.h:26:#define READ_REG(dest, NUM) gen_read_reg(dest, NUM)
target/hexagon/macros.h:29:#define READ_REG(NUM) (env->gpr[(NUM)])
target/hexagon/macros.h:360:#define fREAD_LR() (READ_REG(HEX_REG_LR)) target/hexagon/macros.h:366:#define fREAD_SP() (READ_REG(HEX_REG_SP)) target/hexagon/macros.h:367:#define fREAD_LC0 (READ_REG(HEX_REG_LC0)) target/hexagon/macros.h:368:#define fREAD_LC1 (READ_REG(HEX_REG_LC1)) target/hexagon/macros.h:369:#define fREAD_SA0 (READ_REG(HEX_REG_SA0)) target/hexagon/macros.h:370:#define fREAD_SA1 (READ_REG(HEX_REG_SA1)) target/hexagon/macros.h:371:#define fREAD_FP() (READ_REG(HEX_REG_FP))
target/hexagon/macros.h:375: (insn->extension_valid ? 0 :
READ_REG(HEX_REG_GP))
target/hexagon/macros.h:377:#define fREAD_GP() READ_REG(HEX_REG_GP) target/hexagon/macros.h:379:#define fREAD_PC() (READ_REG(HEX_REG_PC)) target/hexagon/macros.h:577:#define fGET_FRAMEKEY() READ_REG(HEX_REG_FRAMEKEY)

and:

target/hexagon/genptr.c:37:static inline TCGv gen_read_preg(TCGv pred, uint8_t num)
target/hexagon/macros.h:27:#define READ_PREG(dest, NUM) gen_read_preg(dest, (NUM))

I'd rather send a "!fixup Hexagon (target/hexagon) circular addressing" patch (so Richard squashes it there) with:

-- >8 --

target/hexagon/macros.h +0 -5
index b726c3b7917..bf0e5ae92bb 100644
@@ -22,16 +22,11 @@
 #include "hex_regs.h"
 #include "reg_fields.h"
 
-#ifdef QEMU_GENERATE
-#define READ_REG(dest, NUM)              gen_read_reg(dest, NUM)
-#define READ_PREG(dest, NUM)             gen_read_preg(dest, (NUM))
-#else
 #define READ_REG(NUM)                    (env->gpr[(NUM)])
 #define READ_PREG(NUM)                   (env->pred[NUM])
 
 #define WRITE_RREG(NUM, VAL)             log_reg_write(env, NUM, VAL, slot)
 #define WRITE_PREG(NUM, VAL)             log_pred_write(env, NUM, VAL)
-#endif
 
 #define PCALIGN 4
 #define PCALIGN_MASK (PCALIGN - 1)
target/hexagon/genptr.c +0 -12
index 55c7cd86a4e..42f25f6f462 100644
@@ -28,18 +28,6 @@
 #undef QEMU_GENERATE
 #include "gen_tcg.h"
 
-static inline TCGv gen_read_reg(TCGv result, int num)
-{
-    tcg_gen_mov_tl(result, hex_gpr[num]);
-    return result;
-}
-
-static inline TCGv gen_read_preg(TCGv pred, uint8_t num)
-{
-    tcg_gen_mov_tl(pred, hex_pred[num]);
-    return pred;
-}
-
 static inline void gen_log_predicated_reg_write(int rnum, TCGv val, int

slot)

 {
     TCGv zero = tcg_const_tl(0);
@@ -319,11 +307,6 @@ static inline void gen_set_half_i64(int N, TCGv_i64
result, TCGv src)
     tcg_temp_free_i64(src64);

}

-static inline void gen_set_byte(int N, TCGv result, TCGv src) -{
- tcg_gen_deposit_tl(result, result, src, N * 8, 8);
-}
-
static void gen_set_byte_i64(int N, TCGv_i64 result, TCGv src)

 {
     TCGv_i64 src64 = tcg_temp_new_i64();

---

NB: untested :)

Regards,

Phil.

#2 lore raw
Quoted 6 lines · Philippe Mathieu-Daudé

Hi Taylor,

Quoted 2 lines · Taylor Simpson

Remove gen_read_reg and gen_set_byte

Quoted 7 lines
Quoted 3 lines

---

To help git-tools (and reviewers), please use the 'Based-on' tag the next time you send a patch depending on another one:
Based-on: <[email protected]>

Sorry I forgot to link the explanation:
https://wiki.qemu.org/Contribute/SubmitAPatch#Base_patches_against_current_git_master

Quoted 3 lines
Quoted 3 lines
 target/hexagon/genptr.c | 11 -----------
 1 file changed, 11 deletions(-)
#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 43 lines

-----Original Message-----
From: Philippe Mathieu-Daudé <[email protected]> On Behalf Of Philippe Mathieu-Daudé
Sent: Wednesday, April 28, 2021 11:49 PM
To: Taylor Simpson <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Brian Cain <[email protected]>
Subject: Re: [PATCH] Hexagon (target/hexagon) remove unused functions

Hi Taylor,

Quoted 5 lines · Taylor Simpson

Remove gen_read_reg and gen_set_byte

---

To help git-tools (and reviewers), please use the 'Based-on' tag the next time you send a patch depending on another one:
Based-on: <[email protected]>

Quoted 8 lines
 target/hexagon/genptr.c | 11 -----------
 1 file changed, 11 deletions(-)
target/hexagon/genptr.c +0 -0
index 55c7cd8..f93f895 100644

target/hexagon/genptr.c line 35

Quoted 8 lines
target/hexagon/genptr.c +0 -5
@@ -28,12 +28,6 @@
 #undef QEMU_GENERATE
 #include "gen_tcg.h"
 
-static inline TCGv gen_read_reg(TCGv result, int num)
-{
-    tcg_gen_mov_tl(result, hex_gpr[num]);
-    return result;
-}

But what about:

Quoted 2 lines

target/hexagon/macros.h:26:#define READ_REG(dest, NUM) gen_read_reg(dest, NUM)

I should remove this to avoid confusion.

Quoted 16 lines

target/hexagon/macros.h:29:#define READ_REG(NUM)
(env->gpr[(NUM)])
target/hexagon/macros.h:360:#define fREAD_LR()
(READ_REG(HEX_REG_LR))
target/hexagon/macros.h:366:#define fREAD_SP()
(READ_REG(HEX_REG_SP))
target/hexagon/macros.h:367:#define fREAD_LC0
(READ_REG(HEX_REG_LC0))
target/hexagon/macros.h:368:#define fREAD_LC1
(READ_REG(HEX_REG_LC1))
target/hexagon/macros.h:369:#define fREAD_SA0
(READ_REG(HEX_REG_SA0))
target/hexagon/macros.h:370:#define fREAD_SA1
(READ_REG(HEX_REG_SA1))
target/hexagon/macros.h:371:#define fREAD_FP()
(READ_REG(HEX_REG_FP))

Quoted 8 lines

target/hexagon/macros.h:375: (insn->extension_valid ? 0 :
READ_REG(HEX_REG_GP)) target/hexagon/macros.h:377:#define fREAD_GP() READ_REG(HEX_REG_GP) target/hexagon/macros.h:379:#define fREAD_PC() (READ_REG(HEX_REG_PC)) target/hexagon/macros.h:577:#define fGET_FRAMEKEY() READ_REG(HEX_REG_FRAMEKEY)

These are not guarded by QEMU_GENERATE, so they are needed and reference the other version of READ_REG

Quoted 6 lines

and:

target/hexagon/genptr.c:37:static inline TCGv gen_read_preg(TCGv pred, uint8_t num)
target/hexagon/macros.h:27:#define READ_PREG(dest, NUM) gen_read_preg(dest, (NUM))

This is needed. It reads a predicate register. The gen_read_reg functions reads a general purpose register.

Quoted 2 lines

I'd rather send a "!fixup Hexagon (target/hexagon) circular addressing" patch (so Richard squashes it there) with:

Richard said he could cherry pick a single patch.
https://lists.gnu.org/archive/html/qemu-devel/2021-04/msg05968.html

Quoted 67 lines

-- >8 --

target/hexagon/macros.h +0 -5
index b726c3b7917..bf0e5ae92bb 100644
@@ -22,16 +22,11 @@
 #include "hex_regs.h"
 #include "reg_fields.h"
 
-#ifdef QEMU_GENERATE
-#define READ_REG(dest, NUM)              gen_read_reg(dest, NUM)
-#define READ_PREG(dest, NUM)             gen_read_preg(dest, (NUM))
-#else
 #define READ_REG(NUM)                    (env->gpr[(NUM)])
 #define READ_PREG(NUM)                   (env->pred[NUM])
 
 #define WRITE_RREG(NUM, VAL)             log_reg_write(env, NUM, VAL, slot)
 #define WRITE_PREG(NUM, VAL)             log_pred_write(env, NUM, VAL)
-#endif
 
 #define PCALIGN 4
 #define PCALIGN_MASK (PCALIGN - 1)
target/hexagon/genptr.c +0 -12
index 55c7cd86a4e..42f25f6f462 100644
@@ -28,18 +28,6 @@
 #undef QEMU_GENERATE
 #include "gen_tcg.h"
 
-static inline TCGv gen_read_reg(TCGv result, int num)
-{
-    tcg_gen_mov_tl(result, hex_gpr[num]);
-    return result;
-}
-
-static inline TCGv gen_read_preg(TCGv pred, uint8_t num)
-{
-    tcg_gen_mov_tl(pred, hex_pred[num]);
-    return pred;
-}
-
 static inline void gen_log_predicated_reg_write(int rnum, TCGv val, int
 slot)
 {
     TCGv zero = tcg_const_tl(0);
target/hexagon/genptr.c +0 -5
@@ -319,11 +307,6 @@ static inline void gen_set_half_i64(int N, TCGv_i64
 result, TCGv src)
     tcg_temp_free_i64(src64);
 }
 
-static inline void gen_set_byte(int N, TCGv result, TCGv src)
-{
-    tcg_gen_deposit_tl(result, result, src, N * 8, 8);
-}
-
 static void gen_set_byte_i64(int N, TCGv_i64 result, TCGv src)
 {
     TCGv_i64 src64 = tcg_temp_new_i64();

---

NB: untested :)

Regards,

Phil.