mesa/src
Matt Turner 76289fbfa8 nir: Recognize open-coded extract_u8.
Two shaders that appear in Unigine benchmarks (Heaven and Valley) unpack
three bytes from an integer and convert each into a float:

   float((val >> 16u) & 0xffu)
   float((val >>  8u) & 0xffu)
   float((val >>  0u) & 0xffu)

Instead of shifting, masking, and type converting like this:

   shr(8)          g15<1>UD        g25<8,8,1>UD    0x00000010UD
   and(8)          g16<1>UD        g15<8,8,1>UD    0x000000ffUD
   mov(8)          g17<1>F         g16<8,8,1>UD

   shr(8)          g18<1>UD        g25<8,8,1>UD    0x00000008UD
   and(8)          g19<1>UD        g18<8,8,1>UD    0x000000ffUD
   mov(8)          g20<1>F         g19<8,8,1>UD

   and(8)          g21<1>UD        g25<8,8,1>UD    0x000000ffUD
   mov(8)          g22<1>F         g21<8,8,1>UD

i965 can simply extract a byte and convert to float in a single
instruction:

   mov(8)          g17<1>F         g25.2<32,8,4>UB
   mov(8)          g20<1>F         g25.1<32,8,4>UB
   mov(8)          g22<1>F         g25.0<32,8,4>UB

This patch implements the first step: recognizing byte extraction. A
later patch will optimize out the conversion to float.

   instructions in affected programs: 28568 -> 27450 (-3.91%)
   helped: 7

   cycles in affected programs: 210076 -> 203144 (-3.30%)
   helped: 7

This patch decreases the number of instructions in the two Unigine
programs by:

 #1721: 4520 -> 4374 instructions (-3.23%)
 #1706: 3752 -> 3582 instructions (-4.53%)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
2016-03-04 11:52:34 -08:00
..
compiler nir: Recognize open-coded extract_u8. 2016-03-04 11:52:34 -08:00
egl Android: clean-up and fix DRI module path handling 2016-02-29 10:51:44 +00:00
gallium st/xlib: Hang off screen destructor off main XCloseDisplay() callback. 2016-03-04 10:57:24 -07:00
gbm gbm.h: Add a missing stddef.h include for size_t. 2015-10-30 19:12:14 +00:00
getopt
glx glx: update to updated version of EXT_create_context_es2_profile 2016-02-03 15:44:51 -05:00
gtest
hgl
loader virtio_gpu: Add PCI ID to driver map 2016-01-23 12:35:24 +10:00
mapi mesa: Add dispatch and extension XML for GL_ARB_internalformat_query2 2016-03-03 15:14:06 +01:00
mesa i965: Set MaxFramebufferWidth/Height to 16384, not viewport. 2016-03-03 21:31:22 -08:00
util util: fix new gcc6 warnings 2016-02-18 17:10:55 -05:00
Makefile.am glsl: move to compiler/ 2016-01-26 16:08:33 +00:00
SConscript glsl: move to compiler/ 2016-01-26 16:08:33 +00:00