diff options
author | Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp> | 2023-05-26 00:07:49 +0900 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2023-05-26 03:22:54 -0700 |
commit | 9b867c8281ee313cf6ec737d8f4a9ba7ef78408e (patch) | |
tree | 17456ea8026f625e264fc33dbd0e3cc3f8651956 /gcc/fortran/parse.cc | |
parent | bf78e24a90d4d064b0372a03c0327b6f90475949 (diff) | |
download | gcc-9b867c8281ee313cf6ec737d8f4a9ba7ef78408e.zip gcc-9b867c8281ee313cf6ec737d8f4a9ba7ef78408e.tar.gz gcc-9b867c8281ee313cf6ec737d8f4a9ba7ef78408e.tar.bz2 |
xtensa: Add 'subtraction from constant' insn pattern
This patch makes try to eliminate using temporary pseudo for
'(minus:SI (const_int) (reg:SI))' if the addition of negative constant
value can be emitted in a single machine instruction.
/* example */
int test0(int x) {
return 1 - x;
}
int test1(int x) {
return 100 - x;
}
int test2(int x) {
return 25600 - x;
}
;; before
test0:
movi.n a9, 1
sub a2, a9, a2
ret.n
test1:
movi a9, 0x64
sub a2, a9, a2
ret.n
test2:
movi.n a9, 0x19
slli a9, a9, 10
sub a2, a9, a2
ret.n
;; after
test0:
addi.n a2, a2, -1
neg a2, a2
ret.n
test1:
addi a2, a2, -100
neg a2, a2
ret.n
test2:
addmi a2, a2, -0x6400
neg a2, a2
ret.n
gcc/ChangeLog:
* config/xtensa/xtensa-protos.h (xtensa_m1_or_1_thru_15):
New prototype.
* config/xtensa/xtensa.cc (xtensa_m1_or_1_thru_15):
New function.
* config/xtensa/constraints.md (O):
Change to use the above function.
* config/xtensa/xtensa.md (*subsi3_from_const):
New insn_and_split pattern.
Diffstat (limited to 'gcc/fortran/parse.cc')
0 files changed, 0 insertions, 0 deletions