On 2/11/19 8:11 AM, Segher Boessenkool wrote: > On Mon, Feb 11, 2019 at 07:17:16AM -0600, Bill Schmidt wrote: >> At -O0 (if I hand-inline everything myself to avoid errors), we scalarize >> the modulo/masking operation into a rldicl for each doubleword. I really >> don't see any reason to change the code. > So what does this look like at expand (at -O0)? Is it something that > is done at gimple level, is it expand itself, is it some target thing?
It's already a mask at expand, even at -O0. vregs dump excerpt: (insn 13 12 14 2 (set (reg:DI 129 [ _16 ]) (vec_select:DI (reg:V2DI 126 [ _9 ]) (parallel [ (const_int 0 [0]) ]))) "vec-srad-modulo.c":40:10 1223 {vsx_extract_v2di} (nil)) (insn 14 13 15 2 (set (reg:DI 130 [ _17 ]) (and:DI (reg:DI 129 [ _16 ]) (const_int 63 [0x3f]))) "vec-srad-modulo.c":40:10 195 {anddi3_mask} (nil)) (insn 15 14 16 2 (set (reg:DI 131 [ _18 ]) (vec_select:DI (reg:V2DI 126 [ _9 ]) (parallel [ (const_int 1 [0x1]) ]))) "vec-srad-modulo.c":40:10 1223 {vsx_extract_v2di} (nil)) (insn 16 15 17 2 (set (reg:DI 132 [ _19 ]) (and:DI (reg:DI 131 [ _18 ]) (const_int 63 [0x3f]))) "vec-srad-modulo.c":40:10 195 {anddi3_mask} (nil)) > >>>> For -mcpu=power9, we get close, but have some bad register allocation and >>>> an unnecessary extend: >>>> >>>> xxspltib 0,4 <- why not just xxspltib 32,4? >>>> xxlor 32,0,0 <- wasted copy >>> Yeah, huh. Where does that come from... I blame splitters after reload. >> This only happens at -O2 and up, FWIW. At -O1 we allocate the registers >> reasonably. > Heh. > >>>> Weird. I just tried adding -mvsx >>> Does it _need_ VSX anyway? Are these builtins defined without it, too? >> Yes (vector long long / V2DImode requires VSX). > So something like > > /* { dg-do run } */ > /* { dg-require-effective-target vsx_hw } */ > /* { dg-options "-mvsx -O2" } */ > > then? What I have now: /* { dg-do run { target { vsx_hw } } } */ /* { dg-options "-O2 -mvsx" } */ > >> I pointed to the bugzilla in another reply -- which was "resolved" with a >> hack. >> I consider it still broken this way... > Reopen that PR? Already done. ;-) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88920 Bill > >> I tested a revised version of the patch overnight and will submit shortly. > Thanks. > > > Segher >