Home | History | Annotate | Download | only in CBackend
      1 ; RUN: llc < %s -march=c
      2 ; Check that uadd and sadd with overflow are handled by C Backend.
      3 
      4 %0 = type { i32, i1 }        ; type %0
      5 
      6 define i1 @func1(i32 zeroext %v1, i32 zeroext %v2) nounwind {
      7 entry:
      8     %t = call %0 @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2)     ; <%0> [#uses=1]
      9     %obit = extractvalue %0 %t, 1       ; <i1> [#uses=1]
     10     br i1 %obit, label %carry, label %normal
     11 
     12 normal:     ; preds = %entry
     13     ret i1 true
     14 
     15 carry:      ; preds = %entry
     16     ret i1 false
     17 }
     18 
     19 define i1 @func2(i32 signext %v1, i32 signext %v2) nounwind {
     20 entry:
     21     %t = call %0 @llvm.sadd.with.overflow.i32(i32 %v1, i32 %v2)     ; <%0> [#uses=1]
     22     %obit = extractvalue %0 %t, 1       ; <i1> [#uses=1]
     23     br i1 %obit, label %carry, label %normal
     24 
     25 normal:     ; preds = %entry
     26     ret i1 true
     27 
     28 carry:      ; preds = %entry
     29     ret i1 false
     30 }
     31 
     32 declare %0 @llvm.sadd.with.overflow.i32(i32, i32) nounwind
     33 
     34 declare %0 @llvm.uadd.with.overflow.i32(i32, i32) nounwind
     35 
     36