1 ; RUN: opt < %s -constprop -S | FileCheck %s
5 ;;-----------------------------
7 ;;-----------------------------
9 define {i8, i1} @uadd_1() nounwind {
11 %t = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 42, i8 100)
15 ; CHECK: ret %i8i1 { i8 -114, i1 false }
18 define {i8, i1} @uadd_2() nounwind {
20 %t = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 142, i8 120)
24 ; CHECK: ret %i8i1 { i8 6, i1 true }
27 ;;-----------------------------
29 ;;-----------------------------
31 define {i8, i1} @usub_1() nounwind {
33 %t = call {i8, i1} @llvm.usub.with.overflow.i8(i8 4, i8 2)
37 ; CHECK: ret %i8i1 { i8 2, i1 false }
40 define {i8, i1} @usub_2() nounwind {
42 %t = call {i8, i1} @llvm.usub.with.overflow.i8(i8 4, i8 6)
46 ; CHECK: ret %i8i1 { i8 -2, i1 true }
49 ;;-----------------------------
51 ;;-----------------------------
53 define {i8, i1} @sadd_1() nounwind {
55 %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 42, i8 2)
59 ; CHECK: ret %i8i1 { i8 44, i1 false }
62 define {i8, i1} @sadd_2() nounwind {
64 %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 120, i8 10)
68 ; CHECK: ret %i8i1 { i8 -126, i1 true }
71 define {i8, i1} @sadd_3() nounwind {
73 %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 -120, i8 10)
77 ; CHECK: ret %i8i1 { i8 -110, i1 false }
80 define {i8, i1} @sadd_4() nounwind {
82 %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 -120, i8 -10)
86 ; CHECK: ret %i8i1 { i8 126, i1 true }
89 define {i8, i1} @sadd_5() nounwind {
91 %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 2, i8 -10)
95 ; CHECK: ret %i8i1 { i8 -8, i1 false }
99 ;;-----------------------------
101 ;;-----------------------------
103 define {i8, i1} @ssub_1() nounwind {
105 %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 4, i8 2)
109 ; CHECK: ret %i8i1 { i8 2, i1 false }
112 define {i8, i1} @ssub_2() nounwind {
114 %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 4, i8 6)
118 ; CHECK: ret %i8i1 { i8 -2, i1 false }
121 define {i8, i1} @ssub_3() nounwind {
123 %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 -10, i8 120)
127 ; CHECK: ret %i8i1 { i8 126, i1 true }
130 define {i8, i1} @ssub_3b() nounwind {
132 %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 -10, i8 10)
136 ; CHECK: ret %i8i1 { i8 -20, i1 false }
139 define {i8, i1} @ssub_4() nounwind {
141 %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 120, i8 -10)
145 ; CHECK: ret %i8i1 { i8 -126, i1 true }
148 define {i8, i1} @ssub_4b() nounwind {
150 %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 20, i8 -10)
154 ; CHECK: ret %i8i1 { i8 30, i1 false }
157 define {i8, i1} @ssub_5() nounwind {
159 %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 -20, i8 -10)
163 ; CHECK: ret %i8i1 { i8 -10, i1 false }
168 declare {i8, i1} @llvm.uadd.with.overflow.i8(i8, i8)
169 declare {i8, i1} @llvm.usub.with.overflow.i8(i8, i8)
171 declare {i8, i1} @llvm.sadd.with.overflow.i8(i8, i8)
172 declare {i8, i1} @llvm.ssub.with.overflow.i8(i8, i8)
173 declare {i8, i1} @llvm.smul.with.overflow.i8(i8, i8)
176 define {i8, i1} @smul_1() nounwind {
178 %t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 -20, i8 -10)
182 ; CHECK: ret %i8i1 { i8 -56, i1 true }