brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.6 KiB · 0421b23 Raw
112 lines · plain
1; RUN: opt -S -disable-output -passes="print<demanded-bits>" < %s 2>&1 | FileCheck %s2 3; CHECK-LABEL: Printing analysis 'Demanded Bits Analysis' for function 'test_bswap':4; CHECK-DAG: DemandedBits: 0xff000000 for   %1 = or i32 %x, 15; CHECK-DAG: DemandedBits: 0xff for   %2 = call i32 @llvm.bswap.i32(i32 %1)6; CHECK-DAG: DemandedBits: 0xff for   %3 = trunc i32 %2 to i87define i8 @test_bswap(i32 %x) {8  %1 = or i32 %x, 19  %2 = call i32 @llvm.bswap.i32(i32 %1)10  %3 = trunc i32 %2 to i811  ret i8 %312}13declare i32 @llvm.bswap.i32(i32)14 15; CHECK-LABEL: Printing analysis 'Demanded Bits Analysis' for function 'test_bitreverse':16; CHECK-DAG: DemandedBits: 0xff000000 for   %1 = or i32 %x, 117; CHECK-DAG: DemandedBits: 0xff for   %2 = call i32 @llvm.bitreverse.i32(i32 %1)18; CHECK-DAG: DemandedBits: 0xff for   %3 = trunc i32 %2 to i819define i8 @test_bitreverse(i32 %x) {20  %1 = or i32 %x, 121  %2 = call i32 @llvm.bitreverse.i32(i32 %1)22  %3 = trunc i32 %2 to i823  ret i8 %324}25declare i32 @llvm.bitreverse.i32(i32)26 27; Funnel shifts28declare i32 @llvm.fshl.i32(i32, i32, i32)29declare i33 @llvm.fshr.i33(i33, i33, i33)30 31; CHECK-LABEL: Printing analysis 'Demanded Bits Analysis' for function 'test_fshl':32; CHECK-DAG: DemandedBits: 0xff for   %x2 = or i32 %x, 133; CHECK-DAG: DemandedBits: 0xff000000 for   %y2 = or i32 %y, 134; CHECK-DAG: DemandedBits: 0xffff for   %z = call i32 @llvm.fshl.i32(i32 %x2, i32 %y2, i32 8)35; CHECK-DAG: DemandedBits: 0xffffffff for   %r = and i32 %z, 6553536define i32 @test_fshl(i32 %x, i32 %y) {37  %x2 = or i32 %x, 138  %y2 = or i32 %y, 139  %z = call i32 @llvm.fshl.i32(i32 %x2, i32 %y2, i32 8)40  %r = and i32 %z, 6553541  ret i32 %r42}43 44; CHECK-LABEL: Printing analysis 'Demanded Bits Analysis' for function 'test_fshr':45; CHECK-DAG: DemandedBits: 0xff for   %x2 = or i33 %x, 146; CHECK-DAG: DemandedBits: 0x1fe000000 for   %y2 = or i33 %y, 147; CHECK-DAG: DemandedBits: 0xffff for   %z = call i33 @llvm.fshr.i33(i33 %x2, i33 %y2, i33 25)48; CHECK-DAG: DemandedBits: 0x1ffffffff for   %r = and i33 %z, 6553549define i33 @test_fshr(i33 %x, i33 %y) {50  %x2 = or i33 %x, 151  %y2 = or i33 %y, 152  %z = call i33 @llvm.fshr.i33(i33 %x2, i33 %y2, i33 25)53  %r = and i33 %z, 6553554  ret i33 %r55}56 57; CHECK-LABEL: Printing analysis 'Demanded Bits Analysis' for function 'test_fshl_zero_shift':58; CHECK-DAG: DemandedBits: 0xffff for   %x2 = or i32 %x, 159; CHECK-DAG: DemandedBits: 0x0 for   %y2 = or i32 %y, 160; CHECK-DAG: DemandedBits: 0xffff for   %z = call i32 @llvm.fshl.i32(i32 %x2, i32 %y2, i32 0)61; CHECK-DAG: DemandedBits: 0xffffffff for   %r = and i32 %z, 6553562define i32 @test_fshl_zero_shift(i32 %x, i32 %y) {63  %x2 = or i32 %x, 164  %y2 = or i32 %y, 165  %z = call i32 @llvm.fshl.i32(i32 %x2, i32 %y2, i32 0)66  %r = and i32 %z, 6553567  ret i32 %r68}69 70; CHECK-LABEL: Printing analysis 'Demanded Bits Analysis' for function 'test_fshr_full_shift':71; CHECK-DAG: DemandedBits: 0x0 for   %x2 = or i33 %x, 172; CHECK-DAG: DemandedBits: 0xffff for   %y2 = or i33 %y, 173; CHECK-DAG: DemandedBits: 0xffff for   %z = call i33 @llvm.fshr.i33(i33 %x2, i33 %y2, i33 33)74; CHECK-DAG: DemandedBits: 0x1ffffffff for   %r = and i33 %z, 6553575define i33 @test_fshr_full_shift(i33 %x, i33 %y) {76  %x2 = or i33 %x, 177  %y2 = or i33 %y, 178  %z = call i33 @llvm.fshr.i33(i33 %x2, i33 %y2, i33 33)79  %r = and i33 %z, 6553580  ret i33 %r81}82 83; CHECK-LABEL: Printing analysis 'Demanded Bits Analysis' for function 'test_fshl_pow2_bitwidth':84; CHECK-DAG: DemandedBits: 0xffffffff for   %x2 = or i32 %x, 185; CHECK-DAG: DemandedBits: 0xffffffff for   %y2 = or i32 %y, 186; CHECK-DAG: DemandedBits: 0x1f for   %z2 = or i32 %z, 187; CHECK-DAG: DemandedBits: 0xffff for   %f = call i32 @llvm.fshl.i32(i32 %x2, i32 %y2, i32 %z2)88; CHECK-DAG: DemandedBits: 0xffffffff for   %r = and i32 %f, 6553589define i32 @test_fshl_pow2_bitwidth(i32 %x, i32 %y, i32 %z) {90  %x2 = or i32 %x, 191  %y2 = or i32 %y, 192  %z2 = or i32 %z, 193  %f = call i32 @llvm.fshl.i32(i32 %x2, i32 %y2, i32 %z2)94  %r = and i32 %f, 6553595  ret i32 %r96}97 98; CHECK-LABEL: Printing analysis 'Demanded Bits Analysis' for function 'test_fshr_non_pow2_bitwidth':99; CHECK-DAG: DemandedBits: 0x1ffffffff for   %x2 = or i33 %x, 1100; CHECK-DAG: DemandedBits: 0x1ffffffff for   %y2 = or i33 %y, 1101; CHECK-DAG: DemandedBits: 0x1ffffffff for   %z2 = or i33 %z, 1102; CHECK-DAG: DemandedBits: 0xffff for   %f = call i33 @llvm.fshr.i33(i33 %x2, i33 %y2, i33 %z2)103; CHECK-DAG: DemandedBits: 0x1ffffffff for   %r = and i33 %f, 65535104define i33 @test_fshr_non_pow2_bitwidth(i33 %x, i33 %y, i33 %z) {105  %x2 = or i33 %x, 1106  %y2 = or i33 %y, 1107  %z2 = or i33 %z, 1108  %f = call i33 @llvm.fshr.i33(i33 %x2, i33 %y2, i33 %z2)109  %r = and i33 %f, 65535110  ret i33 %r111}112