]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
xtensa: Make relaxed MOVI instructions treated as "load" type
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Wed, 16 Jul 2025 08:03:26 +0000 (17:03 +0900)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 22 Jul 2025 16:53:51 +0000 (09:53 -0700)
The relaxed MOVI instructions in the Xtensa ISA are assignment ones that
contain large integer, floating-point or symbolic constants that would not
normally be allowed as immediate values by instructions in assembly code,
and will instead be translated by the assembler later rather the compiler,
into the L32R instructions referencing to literal pool entries containing
that values (see '-mauto-litpools' Xtensa-specific option).

This means that even though such instructions look like nothing more than
constant value assignments in their RTL representation, these may perform
better by treating them as loads from memory (i.e. the actual behavior)
and also trying to avoid using the value immediately after the load,
especially from an instruction scheduling perspective.

gcc/ChangeLog:

* config/xtensa/xtensa.md
(movsi_internal, movhi_internal, movsf_internal):
Change the value of the "type" attribute from "move" to "load"
when the source operand constraint is "Y".

gcc/config/xtensa/xtensa.md

index 029be99e3b4efae4c0fec82dcd669bf67bae9c21..5d3bc3baaac6646a6ec1810c87508c603adc9acb 100644 (file)
    %v0s32i\t%1, %0
    rsr\t%0, ACCLO
    wsr\t%1, ACCLO"
-  [(set_attr "type"    "move,move,move,load,store,store,move,move,move,move,move,load,load,store,rsr,wsr")
+  [(set_attr "type"    "move,move,move,load,store,store,move,move,move,load,move,load,load,store,rsr,wsr")
    (set_attr "mode"    "SI")
    (set_attr "length"  "2,2,2,2,2,2,3,3,3,3,6,3,3,3,3,3")])
 
    %v0s16i\t%1, %0
    rsr\t%0, ACCLO
    wsr\t%1, ACCLO"
-  [(set_attr "type"    "move,move,move,move,move,load,load,store,rsr,wsr")
+  [(set_attr "type"    "move,move,move,move,load,load,load,store,rsr,wsr")
    (set_attr "mode"    "HI")
    (set_attr "length"  "2,2,3,3,3,3,3,3,3,3")])
 
    const16\t%0, %t1\;const16\t%0, %b1
    %v1l32i\t%0, %1
    %v0s32i\t%1, %0"
-  [(set_attr "type"    "farith,fload,fstore,move,load,load,store,move,farith,farith,move,move,load,store")
+  [(set_attr "type"    "farith,fload,fstore,move,load,load,store,move,farith,farith,load,move,load,store")
    (set_attr "mode"    "SF")
    (set_attr "length"  "3,3,3,2,3,2,2,3,3,3,3,6,3,3")])