1  /* Check that eliminable compare-instructions are eliminated. */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O2" } */
       4  /* { dg-final { scan-assembler-not "\tcmp|\ttest" { xfail *-*-* } } } */
       5  /* { dg-final { scan-assembler-not "\tnot" { xfail cc0 } } } */
       6  /* { dg-final { scan-assembler-not "\tlsr" { xfail cc0 } } } */
       7  
       8  int f(int a, int b, int *d)
       9  {
      10    int c = a - b;
      11  
      12    /* Whoops!  We get a cmp.d with the original operands here. */
      13    *d = (c == 0);
      14  
      15    /* Whoops!  While we don't get a test.d for the result here for cc0,
      16       we get a sequence of insns: a move, a "not" and a shift of the
      17       subtraction-result, where a simple "spl" would have done. */
      18    return c >= 0;
      19  }