brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 695830b Raw
48 lines · plain
1; RUN: opt < %s -S -passes=instcombine | FileCheck %s2; Note: This is testing functionality in computeKnownBits.  I'd have rather3; used instsimplify, but the bit test folding is apparently only in instcombine.4 5declare i16 @llvm.bswap.i16(i16)6declare i32 @llvm.bswap.i32(i32)7 8define i1 @test1(i16 %arg) {9; CHECK-LABEL: @test110; CHECK: ret i1 true11  %a = or i16 %arg, 51112  %b = call i16 @llvm.bswap.i16(i16 %a)13  %and = and i16 %b, 25614  %res = icmp eq i16 %and, 25615  ret i1 %res16}17 18define i1 @test2(i16 %arg) {19; CHECK-LABEL: @test220; CHECK: ret i1 true21  %a = or i16 %arg, 122  %b = call i16 @llvm.bswap.i16(i16 %a)23  %and = and i16 %b, 25624  %res = icmp eq i16 %and, 25625  ret i1 %res26}27 28 29define i1 @test3(i16 %arg) {30; CHECK-LABEL: @test331; CHECK: ret i1 true32  %a = or i16 %arg, 25633  %b = call i16 @llvm.bswap.i16(i16 %a)34  %and = and i16 %b, 135  %res = icmp eq i16 %and, 136  ret i1 %res37}38 39define i1 @test4(i32 %arg) {40; CHECK-LABEL: @test441; CHECK: ret i1 true42  %a = or i32 %arg, 2147483647  ; i32_MAX43  %b = call i32 @llvm.bswap.i32(i32 %a)44  %and = and i32 %b, 12745  %res = icmp eq i32 %and, 12746  ret i1 %res47}48