[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / unsigned-promotion.c
blob234ed7529db5253db063794c76b4dc35e9b517bb
1 // Check -fsanitize=signed-integer-overflow and
2 // -fsanitize=unsigned-integer-overflow with promoted unsigned types
3 //
4 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s \
5 // RUN: -fsanitize=signed-integer-overflow | FileCheck %s --check-prefix=CHECKS
6 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s \
7 // RUN: -fsanitize=unsigned-integer-overflow | FileCheck %s --check-prefix=CHECKU
9 unsigned short si, sj, sk;
11 // CHECKS-LABEL: define{{.*}} void @testshortmul()
12 // CHECKU-LABEL: define{{.*}} void @testshortmul()
13 void testshortmul(void) {
15 // CHECKS: load i16, ptr @sj
16 // CHECKS: load i16, ptr @sk
17 // CHECKS: [[T1:%.*]] = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[T2:%.*]], i32 [[T3:%.*]])
18 // CHECKS-NEXT: [[T4:%.*]] = extractvalue { i32, i1 } [[T1]], 0
19 // CHECKS-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T1]], 1
20 // CHECKS: call void @__ubsan_handle_mul_overflow
22 // CHECKU: [[T1:%.*]] = load i16, ptr @sj
23 // CHECKU: [[T2:%.*]] = zext i16 [[T1]]
24 // CHECKU: [[T3:%.*]] = load i16, ptr @sk
25 // CHECKU: [[T4:%.*]] = zext i16 [[T3]]
26 // CHECKU-NOT: llvm.smul
27 // CHECKU-NOT: llvm.umul
28 // CHECKU: [[T5:%.*]] = mul nsw i32 [[T2]], [[T4]]
29 si = sj * sk;