llvm.org GIT mirror llvm / 7f61762
[InstCombine] add tests for casted sign-bit cmp (PR36682); NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327243 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 2 years ago
1 changed file(s) with 27 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
33043304 ; Don't crash by assuming the compared values are integers.
33053305 define <2 x i1> @PR36583(<2 x i8*>) {
33063306 ; CHECK-LABEL: @PR36583(
3307 ; CHECK-NEXT: entry:
33083307 ; CHECK-NEXT: [[RES:%.*]] = icmp eq <2 x i8*> %0, zeroinitializer
33093308 ; CHECK-NEXT: ret <2 x i1> [[RES]]
33103309 ;
3311 entry:
33123310 %cast = ptrtoint <2 x i8*> %0 to <2 x i64>
33133311 %res = icmp eq <2 x i64> %cast, zeroinitializer
33143312 ret <2 x i1> %res
33153313 }
3314
3315 define i1 @doublecast_signbit_set(i64 %x) {
3316 ; CHECK-LABEL: @doublecast_signbit_set(
3317 ; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[X:%.*]] to float
3318 ; CHECK-NEXT: [[I:%.*]] = bitcast float [[F]] to i32
3319 ; CHECK-NEXT: [[R:%.*]] = icmp slt i32 [[I]], 0
3320 ; CHECK-NEXT: ret i1 [[R]]
3321 ;
3322 %f = sitofp i64 %x to float
3323 %i = bitcast float %f to i32
3324 %r = icmp slt i32 %i, 0
3325 ret i1 %r
3326 }
3327
3328 define <3 x i1> @doublecast_signbit_clear(<3 x i32> %x) {
3329 ; CHECK-LABEL: @doublecast_signbit_clear(
3330 ; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i32> [[X:%.*]] to <3 x double>
3331 ; CHECK-NEXT: [[I:%.*]] = bitcast <3 x double> [[F]] to <3 x i64>
3332 ; CHECK-NEXT: [[R:%.*]] = icmp sgt <3 x i64> [[I]],
3333 ; CHECK-NEXT: ret <3 x i1> [[R]]
3334 ;
3335 %f = sitofp <3 x i32> %x to <3 x double>
3336 %i = bitcast <3 x double> %f to <3 x i64>
3337 %r = icmp sgt <3 x i64> %i,
3338 ret <3 x i1> %r
3339 }
3340