1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=instsimplify -S < %s | FileCheck %s
3 declare i8 @llvm.abs.i8(i8, i1)
5 define i1 @abs_low_bit_set(i8 %x) {
6 ; CHECK-LABEL: @abs_low_bit_set(
7 ; CHECK-NEXT: ret i1 false
11 %abs = call i8 @llvm.abs.i8(i8 %v, i1 true)
13 %r = icmp eq i8 %and, 0
17 define i1 @abs_unknown_low_bit_set_fail(i8 %x) {
18 ; CHECK-LABEL: @abs_unknown_low_bit_set_fail(
19 ; CHECK-NEXT: [[V:%.*]] = or i8 [[X:%.*]], 2
20 ; CHECK-NEXT: [[ABS:%.*]] = call i8 @llvm.abs.i8(i8 [[V]], i1 true)
21 ; CHECK-NEXT: [[AND:%.*]] = and i8 [[ABS]], 2
22 ; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[AND]], 0
23 ; CHECK-NEXT: ret i1 [[R]]
26 %abs = call i8 @llvm.abs.i8(i8 %v, i1 true)
28 %r = icmp eq i8 %and, 0
32 define i1 @abs_negative(i8 %x) {
33 ; CHECK-LABEL: @abs_negative(
34 ; CHECK-NEXT: ret i1 false
38 %abs = call i8 @llvm.abs.i8(i8 %v, i1 true)
40 %r = icmp eq i8 %and, 0
44 define i1 @abs_negative2(i8 %x) {
45 ; CHECK-LABEL: @abs_negative2(
46 ; CHECK-NEXT: ret i1 false
49 %abs = call i8 @llvm.abs.i8(i8 %v, i1 true)
51 %r = icmp eq i8 %and, 2
55 define i1 @abs_negative_no_carry_info_fail(i8 %x) {
56 ; CHECK-LABEL: @abs_negative_no_carry_info_fail(
57 ; CHECK-NEXT: [[V:%.*]] = or i8 [[X:%.*]], -126
58 ; CHECK-NEXT: [[ABS:%.*]] = call i8 @llvm.abs.i8(i8 [[V]], i1 true)
59 ; CHECK-NEXT: [[AND:%.*]] = and i8 [[ABS]], 2
60 ; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[AND]], 0
61 ; CHECK-NEXT: ret i1 [[R]]
64 %abs = call i8 @llvm.abs.i8(i8 %v, i1 true)
66 %r = icmp eq i8 %and, 0