2017-04-14 00:44:25 +08:00
|
|
|
; RUN: opt -S -demanded-bits -analyze < %s | FileCheck %s
|
|
|
|
; RUN: opt -S -disable-output -passes="print<demanded-bits>" < %s 2>&1 | FileCheck %s
|
|
|
|
|
2017-12-29 01:00:37 +08:00
|
|
|
; CHECK-DAG: DemandedBits: 0xff000000 for %1 = or i32 %x, 1
|
|
|
|
; CHECK-DAG: DemandedBits: 0xff for %2 = call i32 @llvm.bitreverse.i32(i32 %1)
|
|
|
|
; CHECK-DAG: DemandedBits: 0xff for %3 = trunc i32 %2 to i8
|
2017-04-14 00:44:25 +08:00
|
|
|
define i8 @test_bswap(i32 %x) {
|
|
|
|
%1 = or i32 %x, 1
|
|
|
|
%2 = call i32 @llvm.bswap.i32(i32 %1)
|
|
|
|
%3 = trunc i32 %2 to i8
|
|
|
|
ret i8 %3
|
|
|
|
}
|
|
|
|
declare i32 @llvm.bswap.i32(i32)
|
|
|
|
|
2017-12-29 01:00:37 +08:00
|
|
|
; CHECK-DAG: DemandedBits: 0xff000000 for %1 = or i32 %x, 1
|
|
|
|
; CHECK-DAG: DemandedBits: 0xff for %2 = call i32 @llvm.bswap.i32(i32 %1)
|
|
|
|
; CHECK-DAG: DemandedBits: 0xff for %3 = trunc i32 %2 to i8
|
2017-04-14 00:44:25 +08:00
|
|
|
define i8 @test_bitreverse(i32 %x) {
|
|
|
|
%1 = or i32 %x, 1
|
|
|
|
%2 = call i32 @llvm.bitreverse.i32(i32 %1)
|
|
|
|
%3 = trunc i32 %2 to i8
|
|
|
|
ret i8 %3
|
|
|
|
}
|
|
|
|
declare i32 @llvm.bitreverse.i32(i32)
|
|
|
|
|