OSDN Git Service

nir: add helper to return inversion op of a comparison
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 6 Dec 2018 00:17:45 +0000 (11:17 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 12 Mar 2019 00:52:30 +0000 (00:52 +0000)
commitf219f6114ddbd43c239f22151b698bd1b5b7f86e
tree61b4d296c871581f096dda1cfa38b1cece32c1fc
parent090feaacdc83cdfa6a15485eac3a466489968841
nir: add helper to return inversion op of a comparison

This will be used to help find the trip count of loops that look
like the following:

   while (a < x && i < 8) {
      ...
      i++;
   }

Where the NIR will end up looking something like this:

   vec1 32 ssa_1 = load_const (0x00000004 /* 0.000000 */)
   loop {
      ...
      vec1 1 ssa_12 = ilt ssa_225, ssa_11
      vec1 1 ssa_17 = ilt ssa_226, ssa_1
      vec1 1 ssa_18 = iand ssa_12, ssa_17
      vec1 1 ssa_19 = inot ssa_18

      if ssa_19 {
         ...
         break
      } else {
         ...
      }
   }

So in order to find the trip count we need to find the inverse of
ilt.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/compiler/nir/nir_loop_analyze.c