[llvm] r327243 - [InstCombine] add tests for casted sign-bit cmp (PR36682); NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 11 09:45:31 PDT 2018
Author: spatel
Date: Sun Mar 11 09:45:31 2018
New Revision: 327243
URL: http://llvm.org/viewvc/llvm-project?rev=327243&view=rev
Log:
[InstCombine] add tests for casted sign-bit cmp (PR36682); NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/icmp.ll
Modified: llvm/trunk/test/Transforms/InstCombine/icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp.ll?rev=327243&r1=327242&r2=327243&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Sun Mar 11 09:45:31 2018
@@ -3305,12 +3305,37 @@ define i1 @PR35794(i32* %a) {
; Don't crash by assuming the compared values are integers.
define <2 x i1> @PR36583(<2 x i8*>) {
; CHECK-LABEL: @PR36583(
-; CHECK-NEXT: entry:
; CHECK-NEXT: [[RES:%.*]] = icmp eq <2 x i8*> %0, zeroinitializer
; CHECK-NEXT: ret <2 x i1> [[RES]]
;
-entry:
%cast = ptrtoint <2 x i8*> %0 to <2 x i64>
%res = icmp eq <2 x i64> %cast, zeroinitializer
ret <2 x i1> %res
}
+
+define i1 @doublecast_signbit_set(i64 %x) {
+; CHECK-LABEL: @doublecast_signbit_set(
+; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[X:%.*]] to float
+; CHECK-NEXT: [[I:%.*]] = bitcast float [[F]] to i32
+; CHECK-NEXT: [[R:%.*]] = icmp slt i32 [[I]], 0
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %f = sitofp i64 %x to float
+ %i = bitcast float %f to i32
+ %r = icmp slt i32 %i, 0
+ ret i1 %r
+}
+
+define <3 x i1> @doublecast_signbit_clear(<3 x i32> %x) {
+; CHECK-LABEL: @doublecast_signbit_clear(
+; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i32> [[X:%.*]] to <3 x double>
+; CHECK-NEXT: [[I:%.*]] = bitcast <3 x double> [[F]] to <3 x i64>
+; CHECK-NEXT: [[R:%.*]] = icmp sgt <3 x i64> [[I]], <i64 -1, i64 undef, i64 -1>
+; CHECK-NEXT: ret <3 x i1> [[R]]
+;
+ %f = sitofp <3 x i32> %x to <3 x double>
+ %i = bitcast <3 x double> %f to <3 x i64>
+ %r = icmp sgt <3 x i64> %i, <i64 -1, i64 undef, i64 -1>
+ ret <3 x i1> %r
+}
+
More information about the llvm-commits
mailing list