tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] [PATCH 10/11] riscv64-asm: Optimize gen_le32


From: Danny Milosavljevic
Subject: [Tinycc-devel] [PATCH 10/11] riscv64-asm: Optimize gen_le32
Date: Wed, 7 Apr 2021 13:53:13 +0200

---
 riscv64-asm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/riscv64-asm.c b/riscv64-asm.c
index 9b45ee1..9b41bee 100644
--- a/riscv64-asm.c
+++ b/riscv64-asm.c
@@ -40,8 +40,16 @@ ST_FUNC void gen_le16 (int i)
 
 ST_FUNC void gen_le32 (int i)
 {
-    gen_le16(i);
-    gen_le16(i>>16);
+    int ind1;
+    if (nocode_wanted)
+        return;
+    ind1 = ind + 4;
+    if (ind1 > cur_text_section->data_allocated)
+        section_realloc(cur_text_section, ind1);
+    cur_text_section->data[ind++] = i & 0xFF;
+    cur_text_section->data[ind++] = (i >> 8) & 0xFF;
+    cur_text_section->data[ind++] = (i >> 16) & 0xFF;
+    cur_text_section->data[ind++] = (i >> 24) & 0xFF;
 }
 
 ST_FUNC void gen_expr32(ExprValue *pe)
-- 
2.29.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]