1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -mtriple=x86_64-unknown-unknown -S | FileCheck %s
4 declare { i8, i32 } @llvm.x86.addcarry.32(i8, i32, i32)
5 declare { i8, i64 } @llvm.x86.addcarry.64(i8, i64, i64)
7 define i32 @no_carryin_i32(i32 %x, i32 %y, i8* %p) {
8 ; CHECK-LABEL: @no_carryin_i32(
9 ; CHECK-NEXT: [[TMP1:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 [[X:%.*]], i32 [[Y:%.*]])
10 ; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { i32, i1 } [[TMP1]], 0
11 ; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i32, i1 } [[TMP1]], 1
12 ; CHECK-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i8
13 ; CHECK-NEXT: store i8 [[TMP4]], i8* [[P:%.*]], align 1
14 ; CHECK-NEXT: ret i32 [[TMP2]]
16 %s = call { i8, i32 } @llvm.x86.addcarry.32(i8 0, i32 %x, i32 %y)
17 %ov = extractvalue { i8, i32 } %s, 0
19 %r = extractvalue { i8, i32 } %s, 1
23 define i64 @no_carryin_i64(i64 %x, i64 %y, i8* %p) {
24 ; CHECK-LABEL: @no_carryin_i64(
25 ; CHECK-NEXT: [[TMP1:%.*]] = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 [[X:%.*]], i64 [[Y:%.*]])
26 ; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { i64, i1 } [[TMP1]], 0
27 ; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP1]], 1
28 ; CHECK-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i8
29 ; CHECK-NEXT: store i8 [[TMP4]], i8* [[P:%.*]], align 1
30 ; CHECK-NEXT: ret i64 [[TMP2]]
32 %s = call { i8, i64 } @llvm.x86.addcarry.64(i8 0, i64 %x, i64 %y)
33 %ov = extractvalue { i8, i64 } %s, 0
35 %r = extractvalue { i8, i64 } %s, 1