2 ; Verify codegen's don't crash on overflow intrinsics.
6 define zeroext i8 @sadd_i8(i8 signext %a, i8 signext %b) nounwind ssp {
8 %sadd = tail call { i8, i1 } @llvm.sadd.with.overflow.i8(i8 %a, i8 %b)
9 %cmp = extractvalue { i8, i1 } %sadd, 1
10 %sadd.result = extractvalue { i8, i1 } %sadd, 0
11 %X = select i1 %cmp, i8 %sadd.result, i8 42
15 declare { i8, i1 } @llvm.sadd.with.overflow.i8(i8, i8) nounwind readnone
17 define zeroext i16 @sadd_i16(i16 signext %a, i16 signext %b) nounwind ssp {
19 %sadd = tail call { i16, i1 } @llvm.sadd.with.overflow.i16(i16 %a, i16 %b)
20 %cmp = extractvalue { i16, i1 } %sadd, 1
21 %sadd.result = extractvalue { i16, i1 } %sadd, 0
22 %X = select i1 %cmp, i16 %sadd.result, i16 42
26 declare { i16, i1 } @llvm.sadd.with.overflow.i16(i16, i16) nounwind readnone
28 define zeroext i32 @sadd_i32(i32 signext %a, i32 signext %b) nounwind ssp {
30 %sadd = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %a, i32 %b)
31 %cmp = extractvalue { i32, i1 } %sadd, 1
32 %sadd.result = extractvalue { i32, i1 } %sadd, 0
33 %X = select i1 %cmp, i32 %sadd.result, i32 42
37 declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32) nounwind readnone
42 define zeroext i8 @uadd_i8(i8 signext %a, i8 signext %b) nounwind ssp {
44 %uadd = tail call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %a, i8 %b)
45 %cmp = extractvalue { i8, i1 } %uadd, 1
46 %uadd.result = extractvalue { i8, i1 } %uadd, 0
47 %X = select i1 %cmp, i8 %uadd.result, i8 42
51 declare { i8, i1 } @llvm.uadd.with.overflow.i8(i8, i8) nounwind readnone
53 define zeroext i16 @uadd_i16(i16 signext %a, i16 signext %b) nounwind ssp {
55 %uadd = tail call { i16, i1 } @llvm.uadd.with.overflow.i16(i16 %a, i16 %b)
56 %cmp = extractvalue { i16, i1 } %uadd, 1
57 %uadd.result = extractvalue { i16, i1 } %uadd, 0
58 %X = select i1 %cmp, i16 %uadd.result, i16 42
62 declare { i16, i1 } @llvm.uadd.with.overflow.i16(i16, i16) nounwind readnone
64 define zeroext i32 @uadd_i32(i32 signext %a, i32 signext %b) nounwind ssp {
66 %uadd = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %a, i32 %b)
67 %cmp = extractvalue { i32, i1 } %uadd, 1
68 %uadd.result = extractvalue { i32, i1 } %uadd, 0
69 %X = select i1 %cmp, i32 %uadd.result, i32 42
73 declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32) nounwind readnone
79 define zeroext i8 @ssub_i8(i8 signext %a, i8 signext %b) nounwind ssp {
81 %ssub = tail call { i8, i1 } @llvm.ssub.with.overflow.i8(i8 %a, i8 %b)
82 %cmp = extractvalue { i8, i1 } %ssub, 1
83 %ssub.result = extractvalue { i8, i1 } %ssub, 0
84 %X = select i1 %cmp, i8 %ssub.result, i8 42
88 declare { i8, i1 } @llvm.ssub.with.overflow.i8(i8, i8) nounwind readnone
90 define zeroext i16 @ssub_i16(i16 signext %a, i16 signext %b) nounwind ssp {
92 %ssub = tail call { i16, i1 } @llvm.ssub.with.overflow.i16(i16 %a, i16 %b)
93 %cmp = extractvalue { i16, i1 } %ssub, 1
94 %ssub.result = extractvalue { i16, i1 } %ssub, 0
95 %X = select i1 %cmp, i16 %ssub.result, i16 42
99 declare { i16, i1 } @llvm.ssub.with.overflow.i16(i16, i16) nounwind readnone
101 define zeroext i32 @ssub_i32(i32 signext %a, i32 signext %b) nounwind ssp {
103 %ssub = tail call { i32, i1 } @llvm.ssub.with.overflow.i32(i32 %a, i32 %b)
104 %cmp = extractvalue { i32, i1 } %ssub, 1
105 %ssub.result = extractvalue { i32, i1 } %ssub, 0
106 %X = select i1 %cmp, i32 %ssub.result, i32 42
110 declare { i32, i1 } @llvm.ssub.with.overflow.i32(i32, i32) nounwind readnone
115 define zeroext i8 @usub_i8(i8 signext %a, i8 signext %b) nounwind ssp {
117 %usub = tail call { i8, i1 } @llvm.usub.with.overflow.i8(i8 %a, i8 %b)
118 %cmp = extractvalue { i8, i1 } %usub, 1
119 %usub.result = extractvalue { i8, i1 } %usub, 0
120 %X = select i1 %cmp, i8 %usub.result, i8 42
124 declare { i8, i1 } @llvm.usub.with.overflow.i8(i8, i8) nounwind readnone
126 define zeroext i16 @usub_i16(i16 signext %a, i16 signext %b) nounwind ssp {
128 %usub = tail call { i16, i1 } @llvm.usub.with.overflow.i16(i16 %a, i16 %b)
129 %cmp = extractvalue { i16, i1 } %usub, 1
130 %usub.result = extractvalue { i16, i1 } %usub, 0
131 %X = select i1 %cmp, i16 %usub.result, i16 42
135 declare { i16, i1 } @llvm.usub.with.overflow.i16(i16, i16) nounwind readnone
137 define zeroext i32 @usub_i32(i32 signext %a, i32 signext %b) nounwind ssp {
139 %usub = tail call { i32, i1 } @llvm.usub.with.overflow.i32(i32 %a, i32 %b)
140 %cmp = extractvalue { i32, i1 } %usub, 1
141 %usub.result = extractvalue { i32, i1 } %usub, 0
142 %X = select i1 %cmp, i32 %usub.result, i32 42
146 declare { i32, i1 } @llvm.usub.with.overflow.i32(i32, i32) nounwind readnone
152 define zeroext i8 @smul_i8(i8 signext %a, i8 signext %b) nounwind ssp {
154 %smul = tail call { i8, i1 } @llvm.smul.with.overflow.i8(i8 %a, i8 %b)
155 %cmp = extractvalue { i8, i1 } %smul, 1
156 %smul.result = extractvalue { i8, i1 } %smul, 0
157 %X = select i1 %cmp, i8 %smul.result, i8 42
161 declare { i8, i1 } @llvm.smul.with.overflow.i8(i8, i8) nounwind readnone
163 define zeroext i16 @smul_i16(i16 signext %a, i16 signext %b) nounwind ssp {
165 %smul = tail call { i16, i1 } @llvm.smul.with.overflow.i16(i16 %a, i16 %b)
166 %cmp = extractvalue { i16, i1 } %smul, 1
167 %smul.result = extractvalue { i16, i1 } %smul, 0
168 %X = select i1 %cmp, i16 %smul.result, i16 42
172 declare { i16, i1 } @llvm.smul.with.overflow.i16(i16, i16) nounwind readnone
174 define zeroext i32 @smul_i32(i32 signext %a, i32 signext %b) nounwind ssp {
176 %smul = tail call { i32, i1 } @llvm.smul.with.overflow.i32(i32 %a, i32 %b)
177 %cmp = extractvalue { i32, i1 } %smul, 1
178 %smul.result = extractvalue { i32, i1 } %smul, 0
179 %X = select i1 %cmp, i32 %smul.result, i32 42
183 declare { i32, i1 } @llvm.smul.with.overflow.i32(i32, i32) nounwind readnone
188 define zeroext i8 @umul_i8(i8 signext %a, i8 signext %b) nounwind ssp {
190 %umul = tail call { i8, i1 } @llvm.umul.with.overflow.i8(i8 %a, i8 %b)
191 %cmp = extractvalue { i8, i1 } %umul, 1
192 %umul.result = extractvalue { i8, i1 } %umul, 0
193 %X = select i1 %cmp, i8 %umul.result, i8 42
197 declare { i8, i1 } @llvm.umul.with.overflow.i8(i8, i8) nounwind readnone
199 define zeroext i16 @umul_i16(i16 signext %a, i16 signext %b) nounwind ssp {
201 %umul = tail call { i16, i1 } @llvm.umul.with.overflow.i16(i16 %a, i16 %b)
202 %cmp = extractvalue { i16, i1 } %umul, 1
203 %umul.result = extractvalue { i16, i1 } %umul, 0
204 %X = select i1 %cmp, i16 %umul.result, i16 42
208 declare { i16, i1 } @llvm.umul.with.overflow.i16(i16, i16) nounwind readnone
210 define zeroext i32 @umul_i32(i32 signext %a, i32 signext %b) nounwind ssp {
212 %umul = tail call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %a, i32 %b)
213 %cmp = extractvalue { i32, i1 } %umul, 1
214 %umul.result = extractvalue { i32, i1 } %umul, 0
215 %X = select i1 %cmp, i32 %umul.result, i32 42
219 declare { i32, i1 } @llvm.umul.with.overflow.i32(i32, i32) nounwind readnone