brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · b461b6a Raw
66 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 52; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s3 4; Check that we convert5;   trunc(C * a) -> trunc(C) * trunc(a)6; if C is a constant.7define i8 @trunc_of_mul(i32 %a) {8; CHECK-LABEL: 'trunc_of_mul'9; CHECK-NEXT:  Classifying expressions for: @trunc_of_mul10; CHECK-NEXT:    %b = mul i32 %a, 10011; CHECK-NEXT:    --> (100 * %a) U: [0,-3) S: [-2147483648,2147483645)12; CHECK-NEXT:    %c = trunc i32 %b to i813; CHECK-NEXT:    --> (100 * (trunc i32 %a to i8)) U: [0,-3) S: [-128,125)14; CHECK-NEXT:  Determining loop execution counts for: @trunc_of_mul15;16  %b = mul i32 %a, 10017  %c = trunc i32 %b to i818  ret i8 %c19}20 21; Check that we convert22;   trunc(C + a) -> trunc(C) + trunc(a)23; if C is a constant.24define i8 @trunc_of_add(i32 %a) {25; CHECK-LABEL: 'trunc_of_add'26; CHECK-NEXT:  Classifying expressions for: @trunc_of_add27; CHECK-NEXT:    %b = add i32 %a, 10028; CHECK-NEXT:    --> (100 + %a) U: full-set S: full-set29; CHECK-NEXT:    %c = trunc i32 %b to i830; CHECK-NEXT:    --> (100 + (trunc i32 %a to i8)) U: full-set S: full-set31; CHECK-NEXT:  Determining loop execution counts for: @trunc_of_add32;33  %b = add i32 %a, 10034  %c = trunc i32 %b to i835  ret i8 %c36}37 38; Check that we truncate to zero values assumed to have at least as many39; trailing zeros as the target type.40define i8 @trunc_to_assumed_zeros(ptr %p) {41; CHECK-LABEL: 'trunc_to_assumed_zeros'42; CHECK-NEXT:  Classifying expressions for: @trunc_to_assumed_zeros43; CHECK-NEXT:    %a = load i32, ptr %p, align 444; CHECK-NEXT:    --> %a U: [0,-255) S: [-2147483648,2147483393)45; CHECK-NEXT:    %and = and i32 %a, 25546; CHECK-NEXT:    --> 0 U: [0,1) S: [0,1)47; CHECK-NEXT:    %c = trunc i32 %a to i848; CHECK-NEXT:    --> 0 U: [0,1) S: [0,1)49; CHECK-NEXT:    %d = trunc i32 %a to i150; CHECK-NEXT:    --> false U: [0,-1) S: [0,-1)51; CHECK-NEXT:    %e = trunc i32 %a to i1652; CHECK-NEXT:    --> (trunc i32 %a to i16) U: [0,-255) S: [-32768,32513)53; CHECK-NEXT:  Determining loop execution counts for: @trunc_to_assumed_zeros54;55  %a = load i32, ptr %p56  %and = and i32 %a, 25557  %cmp = icmp eq i32 %and, 058  tail call void @llvm.assume(i1 %cmp)59  %c = trunc i32 %a to i860  %d = trunc i32 %a to i161  %e = trunc i32 %a to i1662  ret i8 %c63}64 65declare void @llvm.assume(i1 noundef) nofree nosync nounwind willreturn66