1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -instcombine -S < %s | FileCheck %s 3 4define i32 @ctlz_true_bitreverse(i32 %x) { 5; CHECK-LABEL: @ctlz_true_bitreverse( 6; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.cttz.i32(i32 [[X:%.*]], i1 true), !range !0 7; CHECK-NEXT: ret i32 [[TMP1]] 8; 9 %a = tail call i32 @llvm.bitreverse.i32(i32 %x) 10 %b = tail call i32 @llvm.ctlz.i32(i32 %a, i1 true) 11 ret i32 %b 12} 13 14define <2 x i64> @ctlz_true_bitreverse_vec(<2 x i64> %x) { 15; CHECK-LABEL: @ctlz_true_bitreverse_vec( 16; CHECK-NEXT: [[TMP1:%.*]] = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> [[X:%.*]], i1 true) 17; CHECK-NEXT: ret <2 x i64> [[TMP1]] 18; 19 %a = tail call <2 x i64> @llvm.bitreverse.v2i64(<2 x i64> %x) 20 %b = tail call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %a, i1 true) 21 ret <2 x i64> %b 22} 23 24define i32 @ctlz_false_bitreverse(i32 %x) { 25; CHECK-LABEL: @ctlz_false_bitreverse( 26; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.cttz.i32(i32 [[X:%.*]], i1 false), !range !0 27; CHECK-NEXT: ret i32 [[TMP1]] 28; 29 %a = tail call i32 @llvm.bitreverse.i32(i32 %x) 30 %b = tail call i32 @llvm.ctlz.i32(i32 %a, i1 false) 31 ret i32 %b 32} 33 34define i32 @cttz_true_bitreverse(i32 %x) { 35; CHECK-LABEL: @cttz_true_bitreverse( 36; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.ctlz.i32(i32 [[X:%.*]], i1 true), !range !0 37; CHECK-NEXT: ret i32 [[TMP1]] 38; 39 %a = tail call i32 @llvm.bitreverse.i32(i32 %x) 40 %b = tail call i32 @llvm.cttz.i32(i32 %a, i1 true) 41 ret i32 %b 42} 43 44define <2 x i64> @cttz_true_bitreverse_vec(<2 x i64> %x) { 45; CHECK-LABEL: @cttz_true_bitreverse_vec( 46; CHECK-NEXT: [[TMP1:%.*]] = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> [[X:%.*]], i1 true) 47; CHECK-NEXT: ret <2 x i64> [[TMP1]] 48; 49 %a = tail call <2 x i64> @llvm.bitreverse.v2i64(<2 x i64> %x) 50 %b = tail call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 true) 51 ret <2 x i64> %b 52} 53 54define i32 @cttz_false_bitreverse(i32 %x) { 55; CHECK-LABEL: @cttz_false_bitreverse( 56; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.ctlz.i32(i32 [[X:%.*]], i1 false), !range !0 57; CHECK-NEXT: ret i32 [[TMP1]] 58; 59 %a = tail call i32 @llvm.bitreverse.i32(i32 %x) 60 %b = tail call i32 @llvm.cttz.i32(i32 %a, i1 false) 61 ret i32 %b 62} 63 64declare i32 @llvm.bitreverse.i32(i32) 65declare <2 x i64> @llvm.bitreverse.v2i64(<2 x i64>) 66declare i32 @llvm.ctlz.i32(i32, i1) 67declare i32 @llvm.cttz.i32(i32, i1) 68declare <2 x i64> @llvm.ctlz.v2i64(<2 x i64>, i1) 69declare <2 x i64> @llvm.cttz.v2i64(<2 x i64>, i1) 70