Skip to content

Commit 5cf578c

Browse files
Merge pull request earlephilhower#33 from jjsuwa-sys3175/L32R_is_slow
gcc: xtensa: make trying to replace 'l32r' with 'movi' + 'slli' regardless of optimizing for size or not, because 'l32r' is much slower than the latter on ESP8266
2 parents 101d62c + 985faa6 commit 5cf578c

4 files changed

+116
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From f1568d0597ffd3027eebefc2cf31646ab5d5ca19 Mon Sep 17 00:00:00 2001
2+
From: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
3+
Date: Sun, 19 Dec 2021 22:44:03 +0900
4+
Subject: [PATCH] gcc: xtensa: make trying to replace 'l32r' with 'movi' +
5+
'slli' regardless of optimizing for size or not, because 'l32r' is much
6+
slower than the latter on ESP8266
7+
8+
---
9+
gcc/config/xtensa/xtensa.c | 4 ++--
10+
1 file changed, 2 insertions(+), 2 deletions(-)
11+
12+
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
13+
index 37c6ac1fd..6cd9d5528 100644
14+
--- a/gcc/config/xtensa/xtensa.c
15+
+++ b/gcc/config/xtensa/xtensa.c
16+
@@ -1074,8 +1074,8 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode)
17+
{
18+
/* Try to emit MOVI + SLLI sequence, that is smaller
19+
than L32R + literal. */
20+
- if (optimize_size && mode == SImode && CONST_INT_P (src)
21+
- && register_operand (dst, mode))
22+
+ if (optimize >= 1 && ! optimize_debug && mode == SImode
23+
+ && CONST_INT_P (src) && register_operand (dst, mode))
24+
{
25+
HOST_WIDE_INT srcval = INTVAL (src);
26+
int shift = ctz_hwi (srcval);
27+
--
28+
2.20.1
29+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From f1568d0597ffd3027eebefc2cf31646ab5d5ca19 Mon Sep 17 00:00:00 2001
2+
From: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
3+
Date: Sun, 19 Dec 2021 22:44:03 +0900
4+
Subject: [PATCH] gcc: xtensa: make trying to replace 'l32r' with 'movi' +
5+
'slli' regardless of optimizing for size or not, because 'l32r' is much
6+
slower than the latter on ESP8266
7+
8+
---
9+
gcc/config/xtensa/xtensa.c | 4 ++--
10+
1 file changed, 2 insertions(+), 2 deletions(-)
11+
12+
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
13+
index 37c6ac1fd..6cd9d5528 100644
14+
--- a/gcc/config/xtensa/xtensa.c
15+
+++ b/gcc/config/xtensa/xtensa.c
16+
@@ -1074,8 +1074,8 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode)
17+
{
18+
/* Try to emit MOVI + SLLI sequence, that is smaller
19+
than L32R + literal. */
20+
- if (optimize_size && mode == SImode && CONST_INT_P (src)
21+
- && register_operand (dst, mode))
22+
+ if (optimize >= 1 && ! optimize_debug && mode == SImode
23+
+ && CONST_INT_P (src) && register_operand (dst, mode))
24+
{
25+
HOST_WIDE_INT srcval = INTVAL (src);
26+
int shift = ctz_hwi (srcval);
27+
--
28+
2.20.1
29+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From f1568d0597ffd3027eebefc2cf31646ab5d5ca19 Mon Sep 17 00:00:00 2001
2+
From: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
3+
Date: Sun, 19 Dec 2021 22:44:03 +0900
4+
Subject: [PATCH] gcc: xtensa: make trying to replace 'l32r' with 'movi' +
5+
'slli' regardless of optimizing for size or not, because 'l32r' is much
6+
slower than the latter on ESP8266
7+
8+
---
9+
gcc/config/xtensa/xtensa.c | 4 ++--
10+
1 file changed, 2 insertions(+), 2 deletions(-)
11+
12+
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
13+
index 37c6ac1fd..6cd9d5528 100644
14+
--- a/gcc/config/xtensa/xtensa.c
15+
+++ b/gcc/config/xtensa/xtensa.c
16+
@@ -1074,8 +1074,8 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode)
17+
{
18+
/* Try to emit MOVI + SLLI sequence, that is smaller
19+
than L32R + literal. */
20+
- if (optimize_size && mode == SImode && CONST_INT_P (src)
21+
- && register_operand (dst, mode))
22+
+ if (optimize >= 1 && ! optimize_debug && mode == SImode
23+
+ && CONST_INT_P (src) && register_operand (dst, mode))
24+
{
25+
HOST_WIDE_INT srcval = INTVAL (src);
26+
int shift = ctz_hwi (srcval);
27+
--
28+
2.20.1
29+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From f1568d0597ffd3027eebefc2cf31646ab5d5ca19 Mon Sep 17 00:00:00 2001
2+
From: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
3+
Date: Sun, 19 Dec 2021 22:44:03 +0900
4+
Subject: [PATCH] gcc: xtensa: make trying to replace 'l32r' with 'movi' +
5+
'slli' regardless of optimizing for size or not, because 'l32r' is much
6+
slower than the latter on ESP8266
7+
8+
---
9+
gcc/config/xtensa/xtensa.c | 4 ++--
10+
1 file changed, 2 insertions(+), 2 deletions(-)
11+
12+
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
13+
index 37c6ac1fd..6cd9d5528 100644
14+
--- a/gcc/config/xtensa/xtensa.c
15+
+++ b/gcc/config/xtensa/xtensa.c
16+
@@ -1074,8 +1074,8 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode)
17+
{
18+
/* Try to emit MOVI + SLLI sequence, that is smaller
19+
than L32R + literal. */
20+
- if (optimize_size && mode == SImode && CONST_INT_P (src)
21+
- && register_operand (dst, mode))
22+
+ if (optimize >= 1 && ! optimize_debug && mode == SImode
23+
+ && CONST_INT_P (src) && register_operand (dst, mode))
24+
{
25+
HOST_WIDE_INT srcval = INTVAL (src);
26+
int shift = ctz_hwi (srcval);
27+
--
28+
2.20.1
29+

0 commit comments

Comments
 (0)