1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt < %s -passes=ipsccp -S | FileCheck %s
6 define i1 @constant_range_xor(i64 %a) {
7 ; CHECK-LABEL: define i1 @constant_range_xor(
8 ; CHECK-SAME: i64 [[A:%.*]]) {
10 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i64 [[A]], 8192
11 ; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]]
13 ; CHECK-NEXT: [[CTLZ:%.*]] = call i64 @llvm.ctlz.i64(i64 [[A]], i1 true)
14 ; CHECK-NEXT: [[CONV:%.*]] = xor i64 [[CTLZ]], 63
15 ; CHECK-NEXT: ret i1 false
17 ; CHECK-NEXT: ret i1 false
20 %cmp = icmp ugt i64 %a, 8192
21 br i1 %cmp, label %then, label %else
23 %ctlz = call i64 @llvm.ctlz.i64(i64 %a, i1 true) ;[0, 50]
24 %conv = xor i64 %ctlz, 63 ;[13, 63]
25 %cmp1 = icmp ult i64 %conv, 13
31 define i1 @constant_range_xor_negative(i64 %a) {
32 ; CHECK-LABEL: define i1 @constant_range_xor_negative(
33 ; CHECK-SAME: i64 [[A:%.*]]) {
35 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i64 [[A]], 8192
36 ; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]]
38 ; CHECK-NEXT: [[CTLZ:%.*]] = call i64 @llvm.ctlz.i64(i64 [[A]], i1 true)
39 ; CHECK-NEXT: [[CONV:%.*]] = xor i64 [[CTLZ]], 62
40 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[CONV]], 13
41 ; CHECK-NEXT: ret i1 [[CMP1]]
43 ; CHECK-NEXT: ret i1 false
46 %cmp = icmp ugt i64 %a, 8192
47 br i1 %cmp, label %then, label %else
49 %ctlz = call i64 @llvm.ctlz.i64(i64 %a, i1 true) ;[0, 50]
50 %conv = xor i64 %ctlz, 62 ;[12, 63]
51 %cmp1 = icmp ult i64 %conv, 13