From d5c7d4b5224b6fbdfd35b9a81bb0ca80a35189b6 Mon Sep 17 00:00:00 2001 From: Chenbing Zheng Date: Wed, 18 May 2022 10:01:44 +0800 Subject: [PATCH] [InstCombine] add tests for icmp-fsh --- llvm/test/Transforms/InstCombine/icmp-fsh.ll | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/icmp-fsh.ll b/llvm/test/Transforms/InstCombine/icmp-fsh.ll index 4c3bd74..a1ef8c3 100644 --- a/llvm/test/Transforms/InstCombine/icmp-fsh.ll +++ b/llvm/test/Transforms/InstCombine/icmp-fsh.ll @@ -66,6 +66,43 @@ define <2 x i1> @rotl_ne_n1_undef(<2 x i5> %x, <2 x i5> %y) { ret <2 x i1> %r } +define <2 x i1> @rotl_eq_0_undef(<2 x i5> %x, <2 x i5> %y) { +; CHECK-LABEL: @rotl_eq_0_undef( +; CHECK-NEXT: [[ROT:%.*]] = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5> [[X:%.*]], <2 x i5> [[X]], <2 x i5> [[Y:%.*]]) +; CHECK-NEXT: [[R:%.*]] = icmp eq <2 x i5> [[ROT]], +; CHECK-NEXT: ret <2 x i1> [[R]] +; + %rot = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5>%x, <2 x i5> %x, <2 x i5> %y) + %r = icmp eq <2 x i5> %rot, + ret <2 x i1> %r +} + +; negative test - wrong constant value + +define <2 x i1> @rotl_eq_1_undef(<2 x i5> %x, <2 x i5> %y) { +; CHECK-LABEL: @rotl_eq_1_undef( +; CHECK-NEXT: [[ROT:%.*]] = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5> [[X:%.*]], <2 x i5> [[X]], <2 x i5> [[Y:%.*]]) +; CHECK-NEXT: [[R:%.*]] = icmp eq <2 x i5> [[ROT]], +; CHECK-NEXT: ret <2 x i1> [[R]] +; + %rot = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5>%x, <2 x i5> %x, <2 x i5> %y) + %r = icmp eq <2 x i5> %rot, + ret <2 x i1> %r +} + +; negative test - wrong predicate + +define <2 x i1> @rotl_sgt_0_undef(<2 x i5> %x, <2 x i5> %y) { +; CHECK-LABEL: @rotl_sgt_0_undef( +; CHECK-NEXT: [[ROT:%.*]] = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5> [[X:%.*]], <2 x i5> [[X]], <2 x i5> [[Y:%.*]]) +; CHECK-NEXT: [[R:%.*]] = icmp sgt <2 x i5> [[ROT]], +; CHECK-NEXT: ret <2 x i1> [[R]] +; + %rot = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5>%x, <2 x i5> %x, <2 x i5> %y) + %r = icmp sgt <2 x i5> %rot, + ret <2 x i1> %r +} + define i1 @rotr_eq_0(i8 %x, i8 %y) { ; CHECK-LABEL: @rotr_eq_0( ; CHECK-NEXT: [[ROT:%.*]] = tail call i8 @llvm.fshr.i8(i8 [[X:%.*]], i8 [[X]], i8 [[Y:%.*]]) -- 2.7.4