Indeed, gcc 8.2 generates perfectly optimized code using cmov instruction for 
"GOTO label", as [https://www.godbolt.org](https://www.godbolt.org)/ proves 
with compiler option -O3:
    
    
    int w1(int64_t a, int64_t b) {
        int r=0;
        if (a == b)
          r = 10;
        else
          r = 17;
        return r;
    }
    
    int w2(int64_t a, int64_t b) {
        int r=10;
        if (a == b)
          goto LW2;
        r = 17;
        LW2:
        return r;
    }
    
    w1(long, long):
      cmp rdi, rsi
      mov edx, 17
      mov eax, 10
      cmovne eax, edx
      ret
    w2(long, long):
      cmp rdi, rsi
      mov edx, 10
      mov eax, 17
      cmove eax, edx
      ret
    
    
    Run

Reply via email to