On Tue, Jul 12, 2016 at 6:29 PM, Zhao Yakui <[email protected]> wrote: > On 07/12/2016 03:45 AM, Matt Turner wrote: >> >> On Thu, Jul 7, 2016 at 2:18 AM, Pengfei Qu<[email protected]> wrote: >>> >>> +/* Compare three word data to get the min value */ >>> +word_imin: >>> + cmp.le.f0.0 (1) null:w INPUT_ARG0.0<0,1,0>:w >>> INPUT_ARG0.4<0,1,0>:w {align1}; >>> + (f0.0) mov (1) TEMP_VAR0.0<1>:w INPUT_ARG0.0<0,1,0>:w >>> {align1}; >>> + (-f0.0) mov (1) TEMP_VAR0.0<1>:w INPUT_ARG0.4<0,1,0>:w >>> {align1}; >>> + cmp.le.f0.0 (1) null:w TEMP_VAR0.0<0,1,0>:w >>> INPUT_ARG0.8<0,1,0>:w {align1}; >>> + (f0.0) mov (1) RET_ARG<1>:w TEMP_VAR0.0<0,1,0>:w >>> {align1}; >>> + (-f0.0) mov (1) RET_ARG<1>:w INPUT_ARG0.8<0,1,0>:w >>> {align1}; >> >> >> I think each of these groups of cmp/mov/mov can be replaced with a single >> sel. > > > Hi, Matt > > Thanks for your suggestion. > > The above cmp/mov/mov can't be replaced with one single sel. Only the > two mov/mov can be replaced with one single sel as the condition of select > instruction is based on cmp instruction.
In fact, since Sandybridge sel with conditional mod is supported and used to implement min/max in a single instruction without writing the flag register. See the relevant code in the i965 driver: https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_fs_builder.h#n377 _______________________________________________ Libva mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libva
