brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · 6edb24e Raw
98 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64)5declare { i8, i1 } @llvm.uadd.with.overflow.i8(i8, i8)6 7define i1 @test_generic(i64 %a, i64 %b) {8; CHECK-LABEL: @test_generic(9; CHECK-NEXT:    [[RES:%.*]] = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 [[A:%.*]], i64 [[B:%.*]])10; CHECK-NEXT:    [[OVERFLOW:%.*]] = extractvalue { i64, i1 } [[RES]], 111; CHECK-NEXT:    ret i1 [[OVERFLOW]]12;13  %res = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %a, i64 %b)14  %overflow = extractvalue { i64, i1 } %res, 115  ret i1 %overflow16}17 18define i1 @test_constant0(i8 %a) {19; CHECK-LABEL: @test_constant0(20; CHECK-NEXT:    ret i1 false21;22  %res = tail call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %a, i8 0)23  %overflow = extractvalue { i8, i1 } %res, 124  ret i1 %overflow25}26 27define i1 @test_constant1(i8 %a) {28; CHECK-LABEL: @test_constant1(29; CHECK-NEXT:    [[OVERFLOW:%.*]] = icmp eq i8 [[A:%.*]], -130; CHECK-NEXT:    ret i1 [[OVERFLOW]]31;32  %res = tail call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %a, i8 1)33  %overflow = extractvalue { i8, i1 } %res, 134  ret i1 %overflow35}36 37define i1 @test_constant2(i8 %a) {38; CHECK-LABEL: @test_constant2(39; CHECK-NEXT:    [[OVERFLOW:%.*]] = icmp ugt i8 [[A:%.*]], -340; CHECK-NEXT:    ret i1 [[OVERFLOW]]41;42  %res = tail call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %a, i8 2)43  %overflow = extractvalue { i8, i1 } %res, 144  ret i1 %overflow45}46 47define i1 @test_constant3(i8 %a) {48; CHECK-LABEL: @test_constant3(49; CHECK-NEXT:    [[OVERFLOW:%.*]] = icmp ugt i8 [[A:%.*]], -450; CHECK-NEXT:    ret i1 [[OVERFLOW]]51;52  %res = tail call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %a, i8 3)53  %overflow = extractvalue { i8, i1 } %res, 154  ret i1 %overflow55}56 57define i1 @test_constant4(i8 %a) {58; CHECK-LABEL: @test_constant4(59; CHECK-NEXT:    [[OVERFLOW:%.*]] = icmp ugt i8 [[A:%.*]], -560; CHECK-NEXT:    ret i1 [[OVERFLOW]]61;62  %res = tail call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %a, i8 4)63  %overflow = extractvalue { i8, i1 } %res, 164  ret i1 %overflow65}66 67 68define i1 @test_constant127(i8 %a) {69; CHECK-LABEL: @test_constant127(70; CHECK-NEXT:    [[OVERFLOW:%.*]] = icmp ugt i8 [[A:%.*]], -12871; CHECK-NEXT:    ret i1 [[OVERFLOW]]72;73  %res = tail call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %a, i8 127)74  %overflow = extractvalue { i8, i1 } %res, 175  ret i1 %overflow76}77 78define i1 @test_constant128(i8 %a) {79; CHECK-LABEL: @test_constant128(80; CHECK-NEXT:    [[OVERFLOW:%.*]] = icmp slt i8 [[A:%.*]], 081; CHECK-NEXT:    ret i1 [[OVERFLOW]]82;83  %res = tail call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %a, i8 128)84  %overflow = extractvalue { i8, i1 } %res, 185  ret i1 %overflow86}87 88define i1 @test_constant255(i8 %a) {89; CHECK-LABEL: @test_constant255(90; CHECK-NEXT:    [[OVERFLOW:%.*]] = icmp ne i8 [[A:%.*]], 091; CHECK-NEXT:    ret i1 [[OVERFLOW]]92;93  %res = tail call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %a, i8 255)94  %overflow = extractvalue { i8, i1 } %res, 195  ret i1 %overflow96}97 98