https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109259
Bug ID: 109259 Summary: rs6000:pass_analyze_swaps should preserve some rtx notes Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: linkw at gcc dot gnu.org Target Milestone: --- When I was constructing test case for PR109069, I found that rs6000 specific pass pass_analyze_swaps doesn't try to preserve REG_EQUAL notes for vector constant. One typical case is: #include <altivec.h> vector signed int test2(vector signed int v1){ vector signed int v = {-128, -1280, 1280, 128}; return v+v1; } On LE, with -O2 -mcpu=power8, in 261r.swaps dump: (insn 6 3 17 2 (set (reg/f:DI 121) (unspec:DI [ (symbol_ref/u:DI ("*.LC0") [flags 0x82]) (reg:DI 2 2) ] UNSPEC_TOCREL)) "tt.c":7:12 764 {*tocrefdi} (expr_list:REG_EQUAL (symbol_ref/u:DI ("*.LC0") [flags 0x82]) (nil))) (insn 17 6 18 2 (set (reg:V4SI 122) (mem/u/c:V4SI (and:DI (reg/f:DI 121) (const_int -16 [0xfffffffffffffff0])) [0 S16 A128])) "tt.c":7:12 -1 (nil)) while in 260r.dfinit dump, it has: (note 3 2 6 2 NOTE_INSN_FUNCTION_BEG) (insn 6 3 7 2 (set (reg/f:DI 121) (unspec:DI [ (symbol_ref/u:DI ("*.LC0") [flags 0x82]) (reg:DI 2 2) ] UNSPEC_TOCREL)) "tt.c":7:12 764 {*tocrefdi} (expr_list:REG_EQUAL (symbol_ref/u:DI ("*.LC0") [flags 0x82]) (nil))) (insn 7 6 8 2 (set (reg:V4SI 122) (vec_select:V4SI (mem/u/c:V4SI (reg/f:DI 121) [0 S16 A128]) (parallel [ (const_int 2 [0x2]) (const_int 3 [0x3]) (const_int 0 [0]) (const_int 1 [0x1]) ]))) "tt.c":7:12 1369 {*vsx_lxvd2x4_le_v4si} (nil)) (insn 8 7 9 2 (set (reg:V4SI 120) (vec_select:V4SI (reg:V4SI 122) (parallel [ (const_int 2 [0x2]) (const_int 3 [0x3]) (const_int 0 [0]) (const_int 1 [0x1]) ]))) "tt.c":7:12 1358 {xxswapd_v4si} (expr_list:REG_EQUAL (const_vector:V4SI [ (const_int -128 [0xffffffffffffff80]) (const_int -1280 [0xfffffffffffffb00]) (const_int 1280 [0x500]) (const_int 128 [0x80]) ]) (nil))) ==== with -O2 -mcpu=power9, in 262r.cse1 rtl dump: (insn 6 3 7 2 (set (reg/f:DI 121) (unspec:DI [ (symbol_ref/u:DI ("*.LC0") [flags 0x82]) (reg:DI 2 2) ] UNSPEC_TOCREL)) "tt.c":7:12 764 {*tocrefdi} (expr_list:REG_EQUAL (symbol_ref/u:DI ("*.LC0") [flags 0x82]) (nil))) (insn 7 6 8 2 (set (reg:V4SI 120) (mem/u/c:V4SI (reg/f:DI 121) [0 S16 A128])) "tt.c":7:12 1182 {vsx_movv4si_64bit} (expr_list:REG_DEAD (reg/f:DI 121) (expr_list:REG_EQUAL (const_vector:V4SI [ (const_int -128 [0xffffffffffffff80]) (const_int -1280 [0xfffffffffffffb00]) (const_int 1280 [0x500]) (const_int 128 [0x80]) ]) (nil))))