On Tue, Apr 19, 2022 at 04:05:06PM +0800, HAO CHEN GUI wrote: > I tested the test case on Linux and AIX with both big and little endian. > The test case requires lp64 target, so it won't be tested on 32-bit targets. > > On big endian (both AIX and Linux), it should match > (compare:CC (and:SI (subreg:SI (reg:DI 207) 4) > > On little endian (both AIX and Linux), it should match > (compare:CC (and:SI (subreg:SI (reg:DI 207) 0) > > So, the pattern in my patch should work fine. > > /* { dg-final { scan-rtl-dump-times {\(compare:CC \(and:SI \(subreg:SI > \(reg:DI} 1 "combine" } } */
On powerpc64-linux: FAIL: gcc.target/powerpc/pr56605.c scan-rtl-dump-times combine "\\(compare:CC \\((?:and|zero_extend):(?:[SD]I) \\((?:sub)?reg:[SD]I" 1 It matches twice instead of once, namely: (insn 19 18 20 2 (parallel [ (set (reg:CC 208) (compare:CC (and:SI (subreg:SI (reg:DI 207) 4) (const_int 3 [0x3])) (const_int 0 [0]))) (set (reg:SI 129 [ prolog_loop_niters.5 ]) (and:SI (subreg:SI (reg:DI 207) 4) (const_int 3 [0x3]))) ]) 208 {*andsi3_imm_mask_dot2} (nil)) (insn 81 80 82 11 (parallel [ (set (reg:CC 232) (compare:CC (and:DI (subreg:DI (reg:SI 136 [ niters.6 ]) 0) (const_int 7 [0x7])) (const_int 0 [0]))) (clobber (scratch:DI)) ]) 207 {*anddi3_imm_mask_dot} (expr_list:REG_DEAD (reg:SI 136 [ niters.6 ]) (nil))) The paradoxical subreg in the latter wasn't expected :-) Segher