• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
6define i1 @func1(i32 zeroext %v1, i32 zeroext %v2) nounwind {
7entry:
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
12normal:     ; preds = %entry
13    ret i1 true
14
15carry:      ; preds = %entry
16    ret i1 false
17}
18
19define i1 @func2(i32 signext %v1, i32 signext %v2) nounwind {
20entry:
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
25normal:     ; preds = %entry
26    ret i1 true
27
28carry:      ; preds = %entry
29    ret i1 false
30}
31
32declare %0 @llvm.sadd.with.overflow.i32(i32, i32) nounwind
33
34declare %0 @llvm.uadd.with.overflow.i32(i32, i32) nounwind
35
36