1; RUN: opt -S -disable-output -passes="print<demanded-bits>" < %s 2>&1 | FileCheck %s 2 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, 4 6; CHECK-DAG: DemandedBits: 0xf for %a in %shl = shl i32 %a, 4 7; CHECK-DAG: DemandedBits: 0xffffffff for 4 in %shl = shl i32 %a, 4 8; CHECK-DAG: DemandedBits: 0xff for %shl.t = trunc i32 %shl to i8 9; CHECK-DAG: DemandedBits: 0xff for %shl in %shl.t = trunc i32 %shl to i8 10; 11 %shl = shl i32 %a, 4 12 %shl.t = trunc i32 %shl to i8 13 ret i8 %shl.t 14} 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, 5 19; CHECK-DAG: DemandedBits: 0x7 for %a in %shl = shl i32 %a, 5 20; CHECK-DAG: DemandedBits: 0xffffffff for 5 in %shl = shl i32 %a, 5 21; CHECK-DAG: DemandedBits: 0xff for %shl.t = trunc i32 %shl to i8 22; CHECK-DAG: DemandedBits: 0xff for %shl in %shl.t = trunc i32 %shl to i8 23; 24 %shl = shl i32 %a, 5 25 %shl.t = trunc i32 %shl to i8 26 ret i8 %shl.t 27} 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 i8 32; CHECK-DAG: DemandedBits: 0xff for %shl in %shl.t = trunc i32 %shl to i8 33; CHECK-DAG: DemandedBits: 0xff for %shl = shl i32 %a, 8 34; CHECK-DAG: DemandedBits: 0x0 for %a in %shl = shl i32 %a, 8 35; CHECK-DAG: DemandedBits: 0xffffffff for 8 in %shl = shl i32 %a, 8 36; 37 %shl = shl i32 %a, 8 38 %shl.t = trunc i32 %shl to i8 39 ret i8 %shl.t 40} 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, 9 45; CHECK-DAG: DemandedBits: 0x0 for %a in %shl = shl i32 %a, 9 46; CHECK-DAG: DemandedBits: 0xffffffff for 9 in %shl = shl i32 %a, 9 47; CHECK-DAG: DemandedBits: 0xff for %shl.t = trunc i32 %shl to i8 48; CHECK-DAG: DemandedBits: 0xff for %shl in %shl.t = trunc i32 %shl to i8 49; 50 %shl = shl i32 %a, 9 51 %shl.t = trunc i32 %shl to i8 52 ret i8 %shl.t 53} 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 i8 58; CHECK-DAG: DemandedBits: 0xff for %shl in %shl.t = trunc i32 %shl to i8 59; CHECK-DAG: DemandedBits: 0xff for %shl = shl i32 %a, %b 60; CHECK-DAG: DemandedBits: 0xffffffff for %a in %shl = shl i32 %a, %b 61; CHECK-DAG: DemandedBits: 0xffffffff for %b in %shl = shl i32 %a, %b 62; 63 %shl = shl i32 %a, %b 64 %shl.t = trunc i32 %shl to i8 65 ret i8 %shl.t 66} 67