brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.0 KiB · c872d2d Raw
199 lines · plain
1; RUN: opt -S -disable-output -passes="print<demanded-bits>" < %s 2>&1 | FileCheck %s2 3define i8 @test_shl_const_amount_4(i32 %a) {4; CHECK-LABEL: 'test_shl_const_amount_4'5; CHECK-DAG:  DemandedBits: 0xff for %shl = shl i32 %a, 46; CHECK-DAG:  DemandedBits: 0xf for %a in %shl = shl i32 %a, 47; CHECK-DAG:  DemandedBits: 0xffffffff for 4 in %shl = shl i32 %a, 48; CHECK-DAG:  DemandedBits: 0xff for %shl.t = trunc i32 %shl to i89; CHECK-DAG:  DemandedBits: 0xff for %shl in %shl.t = trunc i32 %shl to i810;11  %shl = shl i32 %a, 412  %shl.t = trunc i32 %shl to i813  ret i8 %shl.t14}15 16define i8 @test_shl_const_amount_5(i32 %a) {17; CHECK-LABEL: 'test_shl_const_amount_5'18; CHECK-DAG:  DemandedBits: 0xff for %shl = shl i32 %a, 519; CHECK-DAG:  DemandedBits: 0x7 for %a in %shl = shl i32 %a, 520; CHECK-DAG:  DemandedBits: 0xffffffff for 5 in %shl = shl i32 %a, 521; CHECK-DAG:  DemandedBits: 0xff for %shl.t = trunc i32 %shl to i822; CHECK-DAG:  DemandedBits: 0xff for %shl in %shl.t = trunc i32 %shl to i823;24  %shl = shl i32 %a, 525  %shl.t = trunc i32 %shl to i826  ret i8 %shl.t27}28 29define i8 @test_shl_const_amount_8(i32 %a) {30; CHECK-LABEL: 'test_shl_const_amount_8'31; CHECK-DAG:  DemandedBits: 0xff for %shl.t = trunc i32 %shl to i832; CHECK-DAG:  DemandedBits: 0xff for %shl in %shl.t = trunc i32 %shl to i833; CHECK-DAG:  DemandedBits: 0xff for %shl = shl i32 %a, 834; CHECK-DAG:  DemandedBits: 0x0 for %a in %shl = shl i32 %a, 835; CHECK-DAG:  DemandedBits: 0xffffffff for 8 in %shl = shl i32 %a, 836;37  %shl = shl i32 %a, 838  %shl.t = trunc i32 %shl to i839  ret i8 %shl.t40}41 42define i8 @test_shl_const_amount_9(i32 %a) {43; CHECK-LABEL: 'test_shl_const_amount_9'44; CHECK-DAG:  DemandedBits: 0xff for %shl = shl i32 %a, 945; CHECK-DAG:  DemandedBits: 0x0 for %a in %shl = shl i32 %a, 946; CHECK-DAG:  DemandedBits: 0xffffffff for 9 in %shl = shl i32 %a, 947; CHECK-DAG:  DemandedBits: 0xff for %shl.t = trunc i32 %shl to i848; CHECK-DAG:  DemandedBits: 0xff for %shl in %shl.t = trunc i32 %shl to i849;50  %shl = shl i32 %a, 951  %shl.t = trunc i32 %shl to i852  ret i8 %shl.t53}54 55define i8 @test_shl(i32 %a, i32 %b) {56; CHECK-LABEL: 'test_shl'57; CHECK-DAG:  DemandedBits: 0xff for %shl.t = trunc i32 %shl to i858; CHECK-DAG:  DemandedBits: 0xff for %shl in %shl.t = trunc i32 %shl to i859; CHECK-DAG:  DemandedBits: 0xff for %shl = shl i32 %a, %b60; CHECK-DAG:  DemandedBits: 0xff for %a in %shl = shl i32 %a, %b61; CHECK-DAG:  DemandedBits: 0xffffffff for %b in %shl = shl i32 %a, %b62;63  %shl = shl i32 %a, %b64  %shl.t = trunc i32 %shl to i865  ret i8 %shl.t66}67 68define i8 @test_shl_range_1(i32 %a, i32 %b) {69; CHECK-LABEL: 'test_shl_range_1'70; CHECK-DAG:  DemandedBits: 0xff for   %shl = shl i32 %a, %b271; CHECK-DAG:  DemandedBits: 0xff for %a in   %shl = shl i32 %a, %b272; CHECK-DAG:  DemandedBits: 0xffffffff for %b2 in   %shl = shl i32 %a, %b273; CHECK-DAG:  DemandedBits: 0xff for   %shl.t = trunc i32 %shl to i874; CHECK-DAG:  DemandedBits: 0xff for %shl in   %shl.t = trunc i32 %shl to i875; CHECK-DAG:  DemandedBits: 0xffffffff for   %b2 = and i32 %b, 376; CHECK-DAG:  DemandedBits: 0x3 for %b in   %b2 = and i32 %b, 377; CHECK-DAG:  DemandedBits: 0xffffffff for 3 in   %b2 = and i32 %b, 378;79  %b2 = and i32 %b, 380  %shl = shl i32 %a, %b281  %shl.t = trunc i32 %shl to i882  ret i8 %shl.t83}84 85define i32 @test_shl_range_2(i32 %a, i32 %b) {86; CHECK-LABEL: 'test_shl_range_2'87; CHECK-DAG:  DemandedBits: 0xffffffff for   %b2 = and i32 %b, 388; CHECK-DAG:  DemandedBits: 0x3 for %b in   %b2 = and i32 %b, 389; CHECK-DAG:  DemandedBits: 0xffffffff for 3 in   %b2 = and i32 %b, 390; CHECK-DAG:  DemandedBits: 0xffffffff for   %shl = shl i32 %a, %b291; CHECK-DAG:  DemandedBits: 0xffffffff for %a in   %shl = shl i32 %a, %b292; CHECK-DAG:  DemandedBits: 0xffffffff for %b2 in   %shl = shl i32 %a, %b293;94  %b2 = and i32 %b, 395  %shl = shl i32 %a, %b296  ret i32 %shl97}98 99define i32 @test_shl_range_3(i32 %a, i32 %b) {100; CHECK-LABEL: 'test_shl_range_3'101; CHECK-DAG:  DemandedBits: 0xffffffff for   %shr = lshr i32 %shl, 16102; CHECK-DAG:  DemandedBits: 0xffff0000 for %shl in   %shr = lshr i32 %shl, 16103; CHECK-DAG:  DemandedBits: 0xffffffff for 16 in   %shr = lshr i32 %shl, 16104; CHECK-DAG:  DemandedBits: 0xffff0000 for   %shl = shl i32 %a, %b105; CHECK-DAG:  DemandedBits: 0xffffffff for %a in   %shl = shl i32 %a, %b106; CHECK-DAG:  DemandedBits: 0xffffffff for %b in   %shl = shl i32 %a, %b107;108  %shl = shl i32 %a, %b109  %shr = lshr i32 %shl, 16110  ret i32 %shr111}112 113define i32 @test_shl_range_4(i32 %a, i32 %b) {114; CHECK-LABEL: 'test_shl_range_4'115; CHECK-DAG:  DemandedBits: 0xffffffff for   %shr = ashr i32 %shl, 8116; CHECK-DAG:  DemandedBits: 0xffffff00 for %shl in   %shr = ashr i32 %shl, 8117; CHECK-DAG:  DemandedBits: 0xffffffff for 8 in   %shr = ashr i32 %shl, 8118; CHECK-DAG:  DemandedBits: 0xffffff00 for   %shl = shl i32 %a, %b119; CHECK-DAG:  DemandedBits: 0xffffffff for %a in   %shl = shl i32 %a, %b120; CHECK-DAG:  DemandedBits: 0xffffffff for %b in   %shl = shl i32 %a, %b121  %shl = shl i32 %a, %b122  %shr = ashr i32 %shl, 8123  ret i32 %shr124}125 126define i32 @test_shl_range_5(i32 %a, i32 %b) {127; CHECK-LABEL: 'test_shl_range_5'128; CHECK-DAG:  DemandedBits: 0xff for   %1 = shl i32 %a, %b129; CHECK-DAG:  DemandedBits: 0xff for %a in   %1 = shl i32 %a, %b130; CHECK-DAG:  DemandedBits: 0xffffffff for %b in   %1 = shl i32 %a, %b131; CHECK-DAG:  DemandedBits: 0xffffffff for   %2 = and i32 %1, 255132; CHECK-DAG:  DemandedBits: 0xff for %1 in   %2 = and i32 %1, 255133; CHECK-DAG:  DemandedBits: 0xffffffff for 255 in   %2 = and i32 %1, 255134;135  %1 = shl i32 %a, %b136  %2 = and i32 %1, 255137  ret i32 %2138}139 140define i32 @test_shl_range_6(i32 %a, i32 %b) {141; CHECK-LABEL: 'test_shl_range_6'142; CHECK-DAG:  DemandedBits: 0xffffffff for   %shl.2 = shl i32 %shl.1, 16143; CHECK-DAG:  DemandedBits: 0xffff for %shl.1 in   %shl.2 = shl i32 %shl.1, 16144; CHECK-DAG:  DemandedBits: 0xffffffff for 16 in   %shl.2 = shl i32 %shl.1, 16145; CHECK-DAG:  DemandedBits: 0xffff for   %shl.1 = shl i32 %a, %b146; CHECK-DAG:  DemandedBits: 0xffff for %a in   %shl.1 = shl i32 %a, %b147; CHECK-DAG:  DemandedBits: 0xffffffff for %b in   %shl.1 = shl i32 %a, %b148;149  %shl.1 = shl i32 %a, %b150  %shl.2 = shl i32 %shl.1, 16151  ret i32 %shl.2152}153 154define i8 @test_shl_var_amount(i32 %a, i32 %b){155; CHECK-LABEL: 'test_shl_var_amount'156; CHECK-DAG: DemandedBits: 0xff for   %5 = trunc i32 %4 to i8157; CHECK-DAG: DemandedBits: 0xff for %4 in   %5 = trunc i32 %4 to i8158; CHECK-DAG: DemandedBits: 0xff for   %4 = shl i32 %1, %3159; CHECK-DAG: DemandedBits: 0xff for %1 in   %4 = shl i32 %1, %3160; CHECK-DAG: DemandedBits: 0xffffffff for %3 in   %4 = shl i32 %1, %3161; CHECK-DAG: DemandedBits: 0xff for   %2 = trunc i32 %1 to i8162; CHECK-DAG: DemandedBits: 0xff for %1 in   %2 = trunc i32 %1 to i8163; CHECK-DAG: DemandedBits: 0xffffffff for   %3 = zext i8 %2 to i32164; CHECK-DAG: DemandedBits: 0xff for %2 in   %3 = zext i8 %2 to i32165; CHECK-DAG: DemandedBits: 0xff for   %1 = add nsw i32 %a, %b166; CHECK-DAG: DemandedBits: 0xff for %a in   %1 = add nsw i32 %a, %b167; CHECK-DAG: DemandedBits: 0xff for %b in   %1 = add nsw i32 %a, %b168;169  %1 = add nsw i32 %a, %b170  %2 = trunc i32 %1 to i8171  %3 = zext i8 %2 to i32172  %4 = shl i32 %1, %3173  %5 = trunc i32 %4 to i8174  ret i8 %5175}176 177define i8 @test_shl_var_amount_nsw(i32 %a, i32 %b){178 ; CHECK-LABEL 'test_shl_var_amount_nsw'179 ; CHECK-DAG: DemandedBits: 0xff for   %5 = trunc i32 %4 to i8180 ; CHECK-DAG: DemandedBits: 0xff for %4 in   %5 = trunc i32 %4 to i8181 ; CHECK-DAG: DemandedBits: 0xff for   %4 = shl nsw i32 %1, %3182 ; CHECK-DAG: DemandedBits: 0xffffffff for %1 in   %4 = shl nsw i32 %1, %3183 ; CHECK-DAG: DemandedBits: 0xffffffff for %3 in   %4 = shl nsw i32 %1, %3184 ; CHECK-DAG: DemandedBits: 0xffffffff for   %3 = zext i8 %2 to i32185 ; CHECK-DAG: DemandedBits: 0xff for %2 in   %3 = zext i8 %2 to i32186 ; CHECK-DAG: DemandedBits: 0xff for   %2 = trunc i32 %1 to i8187 ; CHECK-DAG: DemandedBits: 0xff for %1 in   %2 = trunc i32 %1 to i8188 ; CHECK-DAG: DemandedBits: 0xffffffff for   %1 = add nsw i32 %a, %b189 ; CHECK-DAG: DemandedBits: 0xffffffff for %a in   %1 = add nsw i32 %a, %b190 ; CHECK-DAG: DemandedBits: 0xffffffff for %b in   %1 = add nsw i32 %a, %b191 ;192  %1 = add nsw i32 %a, %b193  %2 = trunc i32 %1 to i8194  %3 = zext i8 %2 to i32195  %4 = shl nsw i32 %1, %3196  %5 = trunc i32 %4 to i8197  ret i8 %5198}199