From b1e8f118e962cbd08ab6037c05a1045df90585c5 Mon Sep 17 00:00:00 2001 From: Takayuki 'January June' Suwa Date: Wed, 16 Jul 2025 17:03:26 +0900 Subject: [PATCH] xtensa: Make relaxed MOVI instructions treated as "load" type 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 029be99e3b4..5d3bc3baaac 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1344,7 +1344,7 @@ %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")]) @@ -1410,7 +1410,7 @@ %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")]) @@ -1519,7 +1519,7 @@ 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")]) -- 2.47.2